From f5fc4f7e17c3b4d8538a7b00c61f5fa3bdbcfdde Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Sat, 23 Oct 2021 15:18:02 +0530 Subject: [PATCH 01/52] Create android.yaml --- .github/workflows/android.yaml | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/android.yaml diff --git a/.github/workflows/android.yaml b/.github/workflows/android.yaml new file mode 100644 index 00000000..9b8f888a --- /dev/null +++ b/.github/workflows/android.yaml @@ -0,0 +1,40 @@ +name: Android CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: ๐Ÿงฑ Set Up JDK + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: ๐Ÿงช Run Tests + run: ./gradlew test + + - name: ๐Ÿ›  Build Project with Spotless Check + run: ./gradlew spotlessCheck assemble lintDebug --stacktrace + + - name: โณ Build with Gradle + run: ./gradlew build + + - name: ๐Ÿ— Build APK + run: bash ./gradlew assembleProductionDebug --stacktrace + + - name: ๐Ÿš€ Upload APK ๐Ÿ“ฑ + uses: actions/upload-artifact@v2 + with: + name: app + path: app/build/outputs/apk/debug/app-debug.apk + retention-days: 3 From 8aa46ceb3bc429ff785d533a43c7b0f490ce1663 Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Sat, 23 Oct 2021 15:21:33 +0530 Subject: [PATCH 02/52] Update android.yaml --- .github/workflows/android.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/android.yaml b/.github/workflows/android.yaml index 9b8f888a..f38f9567 100644 --- a/.github/workflows/android.yaml +++ b/.github/workflows/android.yaml @@ -19,6 +19,9 @@ jobs: uses: actions/setup-java@v1 with: java-version: 11 + + - name: Grant Gradlew rights + run: chmod +x gradlew - name: ๐Ÿงช Run Tests run: ./gradlew test From 460e4949eae1adc3c1ac47921d5308a8795a2e9c Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Sun, 24 Oct 2021 10:36:41 +0530 Subject: [PATCH 03/52] spotless formatting --- .../yogeshpaliyal/keypass/CustomTestRunner.kt | 2 +- .../keypass/ui/nav/DashboardActivityTest.kt | 30 ++++--------------- .../com/yogeshpaliyal/keypass/AppDatabase.kt | 1 - build.gradle | 1 + 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/app/src/androidTest/java/com/yogeshpaliyal/keypass/CustomTestRunner.kt b/app/src/androidTest/java/com/yogeshpaliyal/keypass/CustomTestRunner.kt index 641b70a5..f2e487d4 100644 --- a/app/src/androidTest/java/com/yogeshpaliyal/keypass/CustomTestRunner.kt +++ b/app/src/androidTest/java/com/yogeshpaliyal/keypass/CustomTestRunner.kt @@ -11,4 +11,4 @@ class CustomTestRunner : AndroidJUnitRunner() { override fun newApplication(cl: ClassLoader?, name: String?, context: Context?): Application { return super.newApplication(cl, HiltTestApplication::class.java.name, context) } -} \ No newline at end of file +} diff --git a/app/src/androidTest/java/com/yogeshpaliyal/keypass/ui/nav/DashboardActivityTest.kt b/app/src/androidTest/java/com/yogeshpaliyal/keypass/ui/nav/DashboardActivityTest.kt index 67887acd..57d021b8 100644 --- a/app/src/androidTest/java/com/yogeshpaliyal/keypass/ui/nav/DashboardActivityTest.kt +++ b/app/src/androidTest/java/com/yogeshpaliyal/keypass/ui/nav/DashboardActivityTest.kt @@ -1,6 +1,5 @@ package com.yogeshpaliyal.keypass.ui.nav -import androidx.test.espresso.Espresso.onData import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.action.ViewActions.replaceText @@ -8,24 +7,16 @@ import androidx.test.espresso.assertion.ViewAssertions.doesNotExist import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers.* import androidx.test.ext.junit.rules.ActivityScenarioRule -import androidx.test.ext.junit.rules.activityScenarioRule -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.filters.LargeTest import com.yogeshpaliyal.keypass.AppDatabase import com.yogeshpaliyal.keypass.R import com.yogeshpaliyal.keypass.data.AccountModel import dagger.hilt.android.testing.HiltAndroidRule import dagger.hilt.android.testing.HiltAndroidTest -import dagger.hilt.android.testing.HiltTestApplication import org.hamcrest.CoreMatchers.not import org.junit.Assert.* - import org.junit.Before -import org.junit.FixMethodOrder import org.junit.Rule import org.junit.Test -import org.junit.runner.OrderWith -import org.junit.runner.RunWith import javax.inject.Inject @HiltAndroidTest @@ -35,7 +26,6 @@ class DashboardActivityTest { @get:Rule(order = 1) var activityScenarioRule = ActivityScenarioRule(DashboardActivity::class.java) - @Inject lateinit var appDatabase: AppDatabase @@ -46,8 +36,7 @@ class DashboardActivityTest { appDatabase.clearAllTables() } - - private fun getDummyAccount() : AccountModel{ + private fun getDummyAccount(): AccountModel { val accountModel = AccountModel() accountModel.title = "Github ${System.currentTimeMillis()}" accountModel.username = "yogeshpaliyal" @@ -59,14 +48,14 @@ class DashboardActivityTest { } @Test - fun addAccountAndDetailAndDeleteTest(){ + fun addAccountAndDetailAndDeleteTest() { val accountModel = getDummyAccount() addAccount(accountModel) checkAccountDetail(accountModel) deleteAccount(accountModel) } - private fun addAccount(accountModel: AccountModel){ + private fun addAccount(accountModel: AccountModel) { // Navigate to add screen onView(withId(R.id.btnAdd)).perform(click()) @@ -90,9 +79,7 @@ class DashboardActivityTest { onView(withText(accountModel.username)).check(matches(isDisplayed())) } - - - private fun checkAccountDetail(accountModel: AccountModel){ + private fun checkAccountDetail(accountModel: AccountModel) { // Navigate to account detail onView(withText(accountModel.username)).perform(click()) @@ -109,10 +96,9 @@ class DashboardActivityTest { onView(withId(R.id.etWebsite)).check(matches(withText(accountModel.password))) onView(withId(R.id.etNotes)).check(matches(withText(accountModel.notes))) - } - private fun deleteAccount(accountModel: AccountModel){ + private fun deleteAccount(accountModel: AccountModel) { // delete account onView(withId(R.id.action_delete)).perform(click()) @@ -121,8 +107,4 @@ class DashboardActivityTest { // is not showing in listing onView(withText(accountModel.username)).check(doesNotExist()) } - - - - -} \ No newline at end of file +} diff --git a/app/src/main/java/com/yogeshpaliyal/keypass/AppDatabase.kt b/app/src/main/java/com/yogeshpaliyal/keypass/AppDatabase.kt index 8ead0ced..c89002c1 100644 --- a/app/src/main/java/com/yogeshpaliyal/keypass/AppDatabase.kt +++ b/app/src/main/java/com/yogeshpaliyal/keypass/AppDatabase.kt @@ -20,5 +20,4 @@ abstract class AppDatabase : RoomDatabase() { // define DAO start abstract fun getDao(): DbDao // define DAO end - } diff --git a/build.gradle b/build.gradle index e8d19183..1b1534a2 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,7 @@ buildscript { classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version" + // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } From ac6cfcbd828157e4e08e19d16e70bd15ace63a9a Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Tue, 26 Oct 2021 09:17:26 +0530 Subject: [PATCH 04/52] Update android.yaml --- .github/workflows/android.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yaml b/.github/workflows/android.yaml index f38f9567..9a030c90 100644 --- a/.github/workflows/android.yaml +++ b/.github/workflows/android.yaml @@ -27,7 +27,7 @@ jobs: run: ./gradlew test - name: ๐Ÿ›  Build Project with Spotless Check - run: ./gradlew spotlessCheck assemble lintDebug --stacktrace + run: ./gradlew spotlessCheck - name: โณ Build with Gradle run: ./gradlew build From 3ad945b0870087d9e04ddd2ad65bf94214e6379e Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Tue, 26 Oct 2021 09:18:52 +0530 Subject: [PATCH 05/52] Create detekt-analysis.yml --- .github/workflows/detekt-analysis.yml | 103 ++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/detekt-analysis.yml diff --git a/.github/workflows/detekt-analysis.yml b/.github/workflows/detekt-analysis.yml new file mode 100644 index 00000000..994634a5 --- /dev/null +++ b/.github/workflows/detekt-analysis.yml @@ -0,0 +1,103 @@ +# This workflow performs a static analysis of your Kotlin source code using +# Detekt. +# +# Scans are triggered: +# 1. On every push to default and protected branches +# 2. On every Pull Request targeting the default branch +# 3. On a weekly schedule +# 4. Manually, on demand, via the "workflow_dispatch" event +# +# The workflow should work with no modifications, but you might like to use a +# later version of the Detekt CLI by modifing the $DETEKT_RELEASE_TAG +# environment variable. +name: Scan with Detekt + +on: + # Triggers the workflow on push or pull request events but only for default and protected branches + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '19 0 * * 2' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + # Release tag associated with version of Detekt to be installed + # SARIF support (required for this workflow) was introduced in Detekt v1.15.0 + DETEKT_RELEASE_TAG: v1.15.0 + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "scan" + scan: + name: Scan + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Gets the download URL associated with the $DETEKT_RELEASE_TAG + - name: Get Detekt download URL + id: detekt_info + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + DETEKT_DOWNLOAD_URL=$( gh api graphql --field tagName=$DETEKT_RELEASE_TAG --raw-field query=' + query getReleaseAssetDownloadUrl($tagName: String!) { + repository(name: "detekt", owner: "detekt") { + release(tagName: $tagName) { + releaseAssets(name: "detekt", first: 1) { + nodes { + downloadUrl + } + } + } + } + } + ' | \ + jq --raw-output '.data.repository.release.releaseAssets.nodes[0].downloadUrl' ) + echo "::set-output name=download_url::$DETEKT_DOWNLOAD_URL" + + # Sets up the detekt cli + - name: Setup Detekt + run: | + dest=$( mktemp -d ) + curl --request GET \ + --url ${{ steps.detekt_info.outputs.download_url }} \ + --silent \ + --location \ + --output $dest/detekt + chmod a+x $dest/detekt + echo $dest >> $GITHUB_PATH + + # Performs static analysis using Detekt + - name: Run Detekt + continue-on-error: true + run: | + detekt --input ${{ github.workspace }} --report sarif:${{ github.workspace }}/detekt.sarif.json + + # Modifies the SARIF output produced by Detekt so that absolute URIs are relative + # This is so we can easily map results onto their source files + # This can be removed once relative URI support lands in Detekt: https://git.io/JLBbA + - name: Make artifact location URIs relative + continue-on-error: true + run: | + echo "$( + jq \ + --arg github_workspace ${{ github.workspace }} \ + '. | ( .runs[].results[].locations[].physicalLocation.artifactLocation.uri |= if test($github_workspace) then .[($github_workspace | length | . + 1):] else . end )' \ + ${{ github.workspace }}/detekt.sarif.json + )" > ${{ github.workspace }}/detekt.sarif.json + + # Uploads results to GitHub repository using the upload-sarif action + - uses: github/codeql-action/upload-sarif@v1 + with: + # Path to SARIF file relative to the root of the repository + sarif_file: ${{ github.workspace }}/detekt.sarif.json + checkout_path: ${{ github.workspace }} From 98eb452c0e6c7a3f4e9a1f6525d3bc20f3fa8759 Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Tue, 26 Oct 2021 09:39:30 +0530 Subject: [PATCH 06/52] Update android.yaml --- .github/workflows/android.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yaml b/.github/workflows/android.yaml index 9a030c90..ce22c851 100644 --- a/.github/workflows/android.yaml +++ b/.github/workflows/android.yaml @@ -39,5 +39,5 @@ jobs: uses: actions/upload-artifact@v2 with: name: app - path: app/build/outputs/apk/debug/app-debug.apk + path: app/build/outputs/apk/production/*.apk retention-days: 3 From 7ab2a61eb9dab6982f98e414a58697604b2a1c3c Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Tue, 26 Oct 2021 09:49:02 +0530 Subject: [PATCH 07/52] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 801a11db..2acefc6b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # KeyPass : Offline Password Manager ![GitHub release (latest by date)](https://img.shields.io/github/v/release/yogeshpaliyal/KeyPass?style=for-the-badge) - +[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fyogeshpaliyal%2FKeyPass&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=true)](https://yogeshpaliyal.com) ![Cover Image](https://github.com/yogeshpaliyal/KeyPass/raw/master/images/KeyPass%20Cover.jpg) From bbc1ed856d0b3ba60bced53016ef41a0854b11ca Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Tue, 26 Oct 2021 09:52:32 +0530 Subject: [PATCH 08/52] Update android.yaml --- .github/workflows/android.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yaml b/.github/workflows/android.yaml index ce22c851..14b613a4 100644 --- a/.github/workflows/android.yaml +++ b/.github/workflows/android.yaml @@ -39,5 +39,5 @@ jobs: uses: actions/upload-artifact@v2 with: name: app - path: app/build/outputs/apk/production/*.apk + path: app/build/outputs/apk/production/debug/*.apk retention-days: 3 From 2bb7dc2181f27e3462d594a1fe32342f8c647cd3 Mon Sep 17 00:00:00 2001 From: Bharath K Malviya Date: Wed, 27 Oct 2021 00:37:05 +0530 Subject: [PATCH 09/52] - Crash fix on Password generator when all the checkboxes are unselected - minor ui fix in Password Generator TextInputEditText View --- .idea/misc.xml | 1 + .idea/vcs.xml | 7 ------- .../ui/generate/GeneratePasswordActivity.kt | 10 ++++++---- .../keypass/utils/PasswordGenerator.kt | 14 ++++++++------ 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 597cc2d2..d65d2f21 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,7 @@