From 135715e10163c431f2348e2d17f38eca81dd2309 Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Sun, 14 Feb 2021 22:18:21 +0100 Subject: [PATCH 01/20] 79: set legacy external storage in manifest to be compatible with API <30 --- app/src/main/AndroidManifest.xml | 3 ++- azure-pipelines.yml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b262a27a..cb8e7f7f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -10,7 +10,8 @@ android:label="" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/AppTheme"> + android:theme="@style/AppTheme" + android:requestLegacyExternalStorage="true"> Date: Sun, 14 Feb 2021 23:29:13 +0100 Subject: [PATCH 02/20] 79: to use legacy storage we should target api 29 --- app/build.gradle | 2 +- library/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b901bd02..30c4f9fe 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,7 +9,7 @@ android { defaultConfig { applicationId "com.example.crosswordToLearn" minSdkVersion 16 - targetSdkVersion 30 + targetSdkVersion 29 versionCode 1 versionName "1.0" diff --git a/library/build.gradle b/library/build.gradle index 7388d9ba..f5f64467 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -12,7 +12,7 @@ android { defaultConfig { minSdkVersion 16 - targetSdkVersion 30 + targetSdkVersion 29 versionCode 1 versionName "1.0" From c08185034fce0303c836a429e38037394f6d4af0 Mon Sep 17 00:00:00 2001 From: omen273 <38621722+omen273@users.noreply.github.com> Date: Mon, 15 Feb 2021 20:31:38 +0100 Subject: [PATCH 03/20] 97 update kotlin version, update gradle, set 21 as min version --- app/build.gradle | 11 +++-------- build.gradle | 6 +++--- library/build.gradle | 4 ++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b901bd02..14d3cb7d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,18 +8,13 @@ android { defaultConfig { applicationId "com.example.crosswordToLearn" - minSdkVersion 16 + minSdkVersion 21 targetSdkVersion 30 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments clearPackageData: 'true' - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } } testOptions { @@ -44,9 +39,9 @@ android { dependencies { implementation 'androidx.legacy:legacy-support-v13:1.0.0' - implementation 'com.google.android.material:material:1.2.1' + implementation 'com.google.android.material:material:1.3.0' implementation project(':library') - implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.21" + implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.30" implementation 'androidx.core:core-ktx:1.3.2' implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' diff --git a/build.gradle b/build.gradle index 8282fa27..7bd0fc09 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,13 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = "1.4.21" + ext.kotlin_version = "1.4.30" repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21" + classpath 'com.android.tools.build:gradle:4.1.2' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/library/build.gradle b/library/build.gradle index 7388d9ba..3ea817dc 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -11,7 +11,7 @@ android { } defaultConfig { - minSdkVersion 16 + minSdkVersion 21 targetSdkVersion 30 versionCode 1 versionName "1.0" @@ -53,7 +53,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //noinspection GradleDependency - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.20-RC" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.30" testImplementation 'junit:junit:4.13.1' //noinspection GradleDependency From e9198d68d2d5b9ded4f22c3d845f6c87532bcc68 Mon Sep 17 00:00:00 2001 From: omen273 <38621722+omen273@users.noreply.github.com> Date: Tue, 16 Feb 2021 18:20:11 +0100 Subject: [PATCH 04/20] 100-implementation --- .../BadImageReadingInstrumentedTest.kt | 5 ++ .../ChooseTopicsInstrumentedTest.kt | 4 ++ .../SolveCrosswordWithTipsInstrumentedTest.kt | 4 ++ .../com/example/crosswordToLearn/Utils.kt | 49 +++++++++++++++++++ build.gradle | 2 +- 5 files changed, 63 insertions(+), 1 deletion(-) diff --git a/app/src/androidTest/java/com/example/crosswordToLearn/BadImageReadingInstrumentedTest.kt b/app/src/androidTest/java/com/example/crosswordToLearn/BadImageReadingInstrumentedTest.kt index eb630cb6..d81a5326 100644 --- a/app/src/androidTest/java/com/example/crosswordToLearn/BadImageReadingInstrumentedTest.kt +++ b/app/src/androidTest/java/com/example/crosswordToLearn/BadImageReadingInstrumentedTest.kt @@ -9,6 +9,7 @@ import androidx.test.espresso.assertion.ViewAssertions import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.ext.junit.runners.AndroidJUnit4 import org.junit.Before +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import java.io.File @@ -17,6 +18,10 @@ import java.io.FileOutputStream @RunWith(AndroidJUnit4::class) class BadImageReadingInstrumentedTest { + @Rule + @JvmField + val retryTestRule = RetryTestRule() + @Before fun addBadData() { if (Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED) { diff --git a/app/src/androidTest/java/com/example/crosswordToLearn/ChooseTopicsInstrumentedTest.kt b/app/src/androidTest/java/com/example/crosswordToLearn/ChooseTopicsInstrumentedTest.kt index cbb3d960..710f1ac0 100644 --- a/app/src/androidTest/java/com/example/crosswordToLearn/ChooseTopicsInstrumentedTest.kt +++ b/app/src/androidTest/java/com/example/crosswordToLearn/ChooseTopicsInstrumentedTest.kt @@ -23,6 +23,10 @@ class ChooseTopicsInstrumentedTest { var activityTestRule: ActivityScenarioRule = ActivityScenarioRule(MainActivity::class.java) + @Rule + @JvmField + val retryTestRule = RetryTestRule() + @Test fun chooseTopicsInstrumentedTest() { chooseGenerateCrossword() diff --git a/app/src/androidTest/java/com/example/crosswordToLearn/SolveCrosswordWithTipsInstrumentedTest.kt b/app/src/androidTest/java/com/example/crosswordToLearn/SolveCrosswordWithTipsInstrumentedTest.kt index 03a01261..4bf4e576 100644 --- a/app/src/androidTest/java/com/example/crosswordToLearn/SolveCrosswordWithTipsInstrumentedTest.kt +++ b/app/src/androidTest/java/com/example/crosswordToLearn/SolveCrosswordWithTipsInstrumentedTest.kt @@ -23,6 +23,10 @@ class SolveCrosswordWithTipsInstrumentedTest { var activityTestRule: ActivityScenarioRule = ActivityScenarioRule(MainActivity::class.java) + @Rule + @JvmField + val retryTestRule = RetryTestRule() + private fun menuClick(name: Int, id: Int, price: Int): Int { var stars = readConfig() openActionBarOverflowOrOptionsMenu( diff --git a/app/src/androidTest/java/com/example/crosswordToLearn/Utils.kt b/app/src/androidTest/java/com/example/crosswordToLearn/Utils.kt index 6b14c0a5..47f68266 100644 --- a/app/src/androidTest/java/com/example/crosswordToLearn/Utils.kt +++ b/app/src/androidTest/java/com/example/crosswordToLearn/Utils.kt @@ -2,6 +2,7 @@ package com.example.crosswordToLearn import android.content.Context import android.content.Intent +import android.util.Log import android.view.View import android.view.ViewGroup import android.view.WindowManager @@ -23,6 +24,8 @@ import org.akop.ararat.core.buildCrossword import org.akop.ararat.io.UClickJsonFormatter import org.hamcrest.* import org.junit.Rule +import org.junit.rules.TestRule +import org.junit.runners.model.Statement import java.io.File import java.util.concurrent.Callable import java.util.concurrent.TimeoutException @@ -228,12 +231,50 @@ class ToastMatcher : } } +class RetryTestRule(val retryCount: Int = 3) : TestRule { + + override fun apply(base: Statement?, description: org.junit.runner.Description?): Statement { + return statement(base, description) + } + + private fun statement(base: Statement?, description: org.junit.runner.Description?): Statement { + return object : Statement() { + @Throws(Throwable::class) + override fun evaluate() { + var caughtThrowable: Throwable? = null + + // implement retry logic here + for (i in 0 until retryCount) { + try { + base?.evaluate() + return + } catch (t: Throwable) { + caughtThrowable = t + if (description != null) { + Log.e("ERROR", description.displayName + ": run " + (i + 1) + " failed") + } + } + } + + if (description != null) { + Log.e("ERROR", description.displayName + ": giving up after " + retryCount + " failures") + } + throw caughtThrowable!! + } + } + } +} + open class ChoseTopicsToastTest { @get:Rule var activityTestRule: ActivityScenarioRule = ActivityScenarioRule(MainActivity::class.java) + @Rule + @JvmField + val retryTestRule = RetryTestRule() + private lateinit var scenario: ActivityScenario fun choseTopicsImpl(fileName: String, message: String) { @@ -262,6 +303,10 @@ open class SolveCrossword { var activityTestRule: ActivityScenarioRule = ActivityScenarioRule(MainActivity::class.java) + @Rule + @JvmField + val retryTestRule = RetryTestRule() + protected lateinit var crossword: Crossword fun solve() { @@ -293,6 +338,10 @@ abstract class BadCrosswordDataTest { var activityTestRule: ActivityScenarioRule = ActivityScenarioRule(MainActivity::class.java) + @Rule + @JvmField + val retryTestRule = RetryTestRule() + abstract fun spoil() lateinit var crossword: Crossword diff --git a/build.gradle b/build.gradle index 8282fa27..52d9406b 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'com.android.tools.build:gradle:4.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From a871c9af04358938be24280c61bb5732d325a4ea Mon Sep 17 00:00:00 2001 From: omen273 <38621722+omen273@users.noreply.github.com> Date: Tue, 16 Feb 2021 19:22:14 +0100 Subject: [PATCH 05/20] 2-fix --- library/src/main/java/org/akop/ararat/view/CrosswordView.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/java/org/akop/ararat/view/CrosswordView.kt b/library/src/main/java/org/akop/ararat/view/CrosswordView.kt index dde8c8ae..bc650b30 100644 --- a/library/src/main/java/org/akop/ararat/view/CrosswordView.kt +++ b/library/src/main/java/org/akop/ararat/view/CrosswordView.kt @@ -342,7 +342,7 @@ class CrosswordView(context: Context, attrs: AttributeSet?) : viewR.viewTreeObserver.addOnGlobalLayoutListener { val r = Rect() viewR.getWindowVisibleDisplayFrame(r) - val heightDiff = viewR.rootView.height - r.height() + val heightDiff = viewR.rootView.height - toolbarHeight - r.height() val keyboardMinHeight = 300 if (heightDiff > keyboardMinHeight){ heightWithoutKeyboard = r.height() - toolbarHeight - hintView.height From 06bb2d6b23eef2afe5b24a8ace3b2439be61ecfd Mon Sep 17 00:00:00 2001 From: omen273 <38621722+omen273@users.noreply.github.com> Date: Tue, 16 Feb 2021 20:15:12 +0100 Subject: [PATCH 06/20] 100 replace assert with waitFor --- .../crosswordToLearn/SolveCrosswordWithTipsInstrumentedTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/androidTest/java/com/example/crosswordToLearn/SolveCrosswordWithTipsInstrumentedTest.kt b/app/src/androidTest/java/com/example/crosswordToLearn/SolveCrosswordWithTipsInstrumentedTest.kt index 4bf4e576..9ed4b67b 100644 --- a/app/src/androidTest/java/com/example/crosswordToLearn/SolveCrosswordWithTipsInstrumentedTest.kt +++ b/app/src/androidTest/java/com/example/crosswordToLearn/SolveCrosswordWithTipsInstrumentedTest.kt @@ -38,7 +38,7 @@ class SolveCrosswordWithTipsInstrumentedTest { pressBack() pressBack() loadFirstCrossword() - assertEquals(stars, readConfig()) + waitForCondition("Stars number checking", {stars==readConfig()}) return stars } From 53a433cbe1ac69da8fb4b3957db8a83107816918 Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Mon, 22 Feb 2021 21:48:10 +0100 Subject: [PATCH 07/20] 15: add action to run tests on FireBase --- .github/workflows/firebase.yml | 64 ++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/firebase.yml diff --git a/.github/workflows/firebase.yml b/.github/workflows/firebase.yml new file mode 100644 index 00000000..c36ca0eb --- /dev/null +++ b/.github/workflows/firebase.yml @@ -0,0 +1,64 @@ +name: FireBase + +on: + schedule: + # * is a special character in YAML so you have to quote this string + # run every day at 01:00 + - cron: '0 1 * * *' + +jobs: + assemble_ui_test_artifacts: + if: startsWith(github.head_ref, 'master') == true + name: Build artifacts + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Build APK for UI test after Unit tests + run: | + ./gradlew test + ./gradlew assembleDebug + ./gradlew assembleDebugAndroidTest + + - name: Upload app-debug APK + uses: actions/upload-artifact@v2 + with: + name: app-debug + path: app/build/outputs/apk/debug/app-debug.apk + + - name: Upload app-debug-androidTest APK + uses: actions/upload-artifact@v2 + with: + name: app-debug-androidTest + path: app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk + + run_ui_tests_on_firebase: + runs-on: ubuntu-latest + needs: assemble_ui_test_artifacts + steps: + - uses: actions/checkout@v2 + - name: Download app-debug APK + uses: actions/download-artifact@v1 + with: + name: app-debug + + - name: Download app-debug-androidTest APK + uses: actions/download-artifact@v1 + with: + name: app-debug-androidTest + + - name: Firebase auth with gcloud + uses: google-github-actions/setup-gcloud@master + with: + version: '290.0.1' + service_account_key: ${{ secrets.FIREBASE_KEY }} + project_id: ${{ secrets.PROJECT_ID }} + + - name: Run Instrumentation Tests in Firebase Test Lab + run: | + gcloud firebase test android models list + gcloud firebase test android run --type instrumentation --num-flaky-test-attempts 3 --use-orchestrator --app app-debug/app-debug.apk --test app-debug-androidTest/app-debug-androidTest.apk --device model=Pixel2,version=28,locale=en,orientation=portrait \ No newline at end of file From 654d68b3cdff6f0f229962f658aa23b0381e70ef Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Wed, 24 Feb 2021 21:29:50 +0100 Subject: [PATCH 08/20] 15: address feedback review --- .github/workflows/firebase.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/firebase.yml b/.github/workflows/firebase.yml index c36ca0eb..29191319 100644 --- a/.github/workflows/firebase.yml +++ b/.github/workflows/firebase.yml @@ -2,7 +2,6 @@ name: FireBase on: schedule: - # * is a special character in YAML so you have to quote this string # run every day at 01:00 - cron: '0 1 * * *' @@ -61,4 +60,6 @@ jobs: - name: Run Instrumentation Tests in Firebase Test Lab run: | gcloud firebase test android models list - gcloud firebase test android run --type instrumentation --num-flaky-test-attempts 3 --use-orchestrator --app app-debug/app-debug.apk --test app-debug-androidTest/app-debug-androidTest.apk --device model=Pixel2,version=28,locale=en,orientation=portrait \ No newline at end of file + gcloud firebase test android run --type instrumentation --use-orchestrator \ + --app app-debug/app-debug.apk --test app-debug-androidTest/app-debug-androidTest.apk \ + --device model=Pixel2,version=28,locale=en,orientation=portrait \ No newline at end of file From 6d1ce602f1226ab3c3cf0922f1a19b3f058b3157 Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Wed, 24 Feb 2021 23:55:44 +0100 Subject: [PATCH 09/20] 15: timezone added --- .github/workflows/firebase.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/firebase.yml b/.github/workflows/firebase.yml index 29191319..07962793 100644 --- a/.github/workflows/firebase.yml +++ b/.github/workflows/firebase.yml @@ -2,7 +2,7 @@ name: FireBase on: schedule: - # run every day at 01:00 + # run every day at 01:00 UTC+0 - cron: '0 1 * * *' jobs: From c1e03cbb585be69a0bfc9dff56a25686937f9c9b Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Thu, 25 Feb 2021 22:29:42 +0100 Subject: [PATCH 10/20] 15: remove condition - should run on master by default --- .github/workflows/firebase.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/firebase.yml b/.github/workflows/firebase.yml index 07962793..0e965501 100644 --- a/.github/workflows/firebase.yml +++ b/.github/workflows/firebase.yml @@ -7,7 +7,6 @@ on: jobs: assemble_ui_test_artifacts: - if: startsWith(github.head_ref, 'master') == true name: Build artifacts runs-on: ubuntu-latest steps: From b4d4e10bee4d1f16b1586476dc7ea6af6db87543 Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Fri, 26 Feb 2021 22:44:57 +0100 Subject: [PATCH 11/20] 15: set up physical device, add manual start and move start time later --- .github/workflows/firebase.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/firebase.yml b/.github/workflows/firebase.yml index 0e965501..52e5326e 100644 --- a/.github/workflows/firebase.yml +++ b/.github/workflows/firebase.yml @@ -1,9 +1,10 @@ name: FireBase on: + workflow_dispatch: schedule: - # run every day at 01:00 UTC+0 - - cron: '0 1 * * *' + # run every day at 04:00 UTC+0 + - cron: '0 4 * * *' jobs: assemble_ui_test_artifacts: @@ -61,4 +62,4 @@ jobs: gcloud firebase test android models list gcloud firebase test android run --type instrumentation --use-orchestrator \ --app app-debug/app-debug.apk --test app-debug-androidTest/app-debug-androidTest.apk \ - --device model=Pixel2,version=28,locale=en,orientation=portrait \ No newline at end of file + --device model=blueline,version=28,locale=en,orientation=portrait \ No newline at end of file From 5a00eeb4373506334c509c9aa9cbc35c5e2a1902 Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Sat, 27 Feb 2021 11:35:00 +0100 Subject: [PATCH 12/20] add comments about firebase --- .github/workflows/firebase.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/firebase.yml b/.github/workflows/firebase.yml index 52e5326e..edd5a898 100644 --- a/.github/workflows/firebase.yml +++ b/.github/workflows/firebase.yml @@ -1,6 +1,7 @@ name: FireBase on: + # allow to run manually workflow_dispatch: schedule: # run every day at 04:00 UTC+0 @@ -58,6 +59,10 @@ jobs: project_id: ${{ secrets.PROJECT_ID }} - name: Run Instrumentation Tests in Firebase Test Lab + # first command print all available devices + # current device: + # | MODEL_ID | MAKE | MODEL_NAME | FORM | RESOLUTION | OS_VERSION_IDS | + # | blueline | Google | Pixel 3 | PHYSICAL | 2160 x 1080 | 28 | run: | gcloud firebase test android models list gcloud firebase test android run --type instrumentation --use-orchestrator \ From e0274c70f91870bc170445a75edf99bc76e02fea Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Sat, 27 Feb 2021 17:47:52 +0100 Subject: [PATCH 13/20] 104: add retry into firebase --- .github/workflows/firebase.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/firebase.yml b/.github/workflows/firebase.yml index edd5a898..1344c587 100644 --- a/.github/workflows/firebase.yml +++ b/.github/workflows/firebase.yml @@ -67,4 +67,4 @@ jobs: gcloud firebase test android models list gcloud firebase test android run --type instrumentation --use-orchestrator \ --app app-debug/app-debug.apk --test app-debug-androidTest/app-debug-androidTest.apk \ - --device model=blueline,version=28,locale=en,orientation=portrait \ No newline at end of file + --device model=blueline,version=28,locale=en,orientation=portrait --num-flaky-test-attempts 3 \ No newline at end of file From 2db170c08935cf7a3cd88e15a18f7a337c1f087e Mon Sep 17 00:00:00 2001 From: omen273 <38621722+omen273@users.noreply.github.com> Date: Mon, 1 Mar 2021 22:25:37 +0100 Subject: [PATCH 14/20] 116 refactor activity_choose_topics.xml --- app/src/main/res/layout/activity_choose_topics.xml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/src/main/res/layout/activity_choose_topics.xml b/app/src/main/res/layout/activity_choose_topics.xml index 301b54d7..5b35cc09 100644 --- a/app/src/main/res/layout/activity_choose_topics.xml +++ b/app/src/main/res/layout/activity_choose_topics.xml @@ -12,12 +12,9 @@ android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintVertical_bias="1.0" - android:layout_marginLeft="100dp" - android:layout_marginStart="100dp"> + app:layout_constraintWidth_percent="0.5"> From adea44ce6ef047a8926b19196edfef09f8104547 Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Sat, 6 Mar 2021 22:56:00 +0100 Subject: [PATCH 15/20] 113: add clear data for firebase --- .github/workflows/firebase.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/firebase.yml b/.github/workflows/firebase.yml index 1344c587..5bc3fdae 100644 --- a/.github/workflows/firebase.yml +++ b/.github/workflows/firebase.yml @@ -66,5 +66,6 @@ jobs: run: | gcloud firebase test android models list gcloud firebase test android run --type instrumentation --use-orchestrator \ + --environment-variables clearPackageData=true \ --app app-debug/app-debug.apk --test app-debug-androidTest/app-debug-androidTest.apk \ --device model=blueline,version=28,locale=en,orientation=portrait --num-flaky-test-attempts 3 \ No newline at end of file From 921725217d4d35612c4b0152f98af695244b966e Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Sat, 13 Mar 2021 22:01:14 +0100 Subject: [PATCH 16/20] 9: create release apk --- .github/workflows/release_apk.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/release_apk.yml diff --git a/.github/workflows/release_apk.yml b/.github/workflows/release_apk.yml new file mode 100644 index 00000000..34b13a36 --- /dev/null +++ b/.github/workflows/release_apk.yml @@ -0,0 +1,31 @@ +name: Test_and_build_artifacts_on_release + +on: + push: + branches: [ master ] + +jobs: + build_apk_aab: + name: Build release artifacts + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build release APK and AAB after test + run: | + ./gradlew test + ./gradlew assembleRelease + ./gradlew bundleRelease + - name: Upload APK + uses: actions/upload-artifact@v2 + with: + name: app-release.apk + path: app/build/outputs/apk/release/app-release-unsigned.apk + - name: Upload AAB Bundle + uses: actions/upload-artifact@v2 + with: + name: app-release.aab + path: app/build/outputs/bundle/release/app-release.aab \ No newline at end of file From 67e594f5fe07475f20b0c32bf378fae7bae7e947 Mon Sep 17 00:00:00 2001 From: Katya Sokolova Date: Sun, 14 Mar 2021 22:29:47 +0100 Subject: [PATCH 17/20] rename artifact --- .github/workflows/release_apk.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_apk.yml b/.github/workflows/release_apk.yml index 34b13a36..65ddd260 100644 --- a/.github/workflows/release_apk.yml +++ b/.github/workflows/release_apk.yml @@ -22,10 +22,10 @@ jobs: - name: Upload APK uses: actions/upload-artifact@v2 with: - name: app-release.apk + name: crosslingo-release.apk path: app/build/outputs/apk/release/app-release-unsigned.apk - name: Upload AAB Bundle uses: actions/upload-artifact@v2 with: - name: app-release.aab - path: app/build/outputs/bundle/release/app-release.aab \ No newline at end of file + name: crosslingo-release.aab + path: app/build/outputs/bundle/release/app-release.aab From 25461f1327b3fdd6d54f1c744dbf97cf5c7cd148 Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Sun, 14 Mar 2021 23:06:37 +0100 Subject: [PATCH 18/20] address review feedback --- .github/workflows/release_apk.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_apk.yml b/.github/workflows/release_apk.yml index 34b13a36..45e6f117 100644 --- a/.github/workflows/release_apk.yml +++ b/.github/workflows/release_apk.yml @@ -7,6 +7,7 @@ on: jobs: build_apk_aab: name: Build release artifacts + # ubuntu is faster and it's crucial for using in actions because we have a limited amount of time runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From d70f51028897791d0045b4326fb6bcbafa31ff96 Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Mon, 15 Mar 2021 22:57:19 +0100 Subject: [PATCH 19/20] 122: sign apk in CI --- .github/workflows/release_apk.yml | 13 ++++++++++++- app/build.gradle | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_apk.yml b/.github/workflows/release_apk.yml index 1a0739dc..e753ae22 100644 --- a/.github/workflows/release_apk.yml +++ b/.github/workflows/release_apk.yml @@ -4,6 +4,11 @@ on: push: branches: [ master ] +env: + KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} + RELEASE_SIGN_KEY_ALIAS: ${{ secrets.RELEASE_SIGN_KEY_ALIAS }} + RELEASE_SIGN_KEY_PASSWORD: ${{ secrets.RELEASE_SIGN_KEY_PASSWORD }} + jobs: build_apk_aab: name: Build release artifacts @@ -15,6 +20,12 @@ jobs: uses: actions/setup-java@v1 with: java-version: 1.8 + - name: Checkout keystore repo + uses: actions/checkout@v2 + with: + repository: ${{ secrets.KEYSTORE_GIT_REPOSITORY }} + token: ${{ secrets.KEYSTORE_ACCESS_TOKEN }} + path: app/keystore - name: Build release APK and AAB after test run: | ./gradlew test @@ -24,7 +35,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: crosslingo-release.apk - path: app/build/outputs/apk/release/app-release-unsigned.apk + path: app/build/outputs/apk/release/app-release.apk - name: Upload AAB Bundle uses: actions/upload-artifact@v2 with: diff --git a/app/build.gradle b/app/build.gradle index 9b5cc787..b172cdf1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,19 @@ android { execution 'ANDROIDX_TEST_ORCHESTRATOR' } + + signingConfigs { + release { + storeFile file("keystore/my_app_keystore") + storePassword System.getenv('KEYSTORE_PASSWORD') + keyAlias System.getenv('RELEASE_SIGN_KEY_ALIAS') + keyPassword System.getenv('RELEASE_SIGN_KEY_PASSWORD') + } + } + buildTypes { release { + signingConfig signingConfigs.release minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } From 0a0cc43d4c36fc6c723a6ddb8fa5777aba4ae959 Mon Sep 17 00:00:00 2001 From: greenEkatherine Date: Wed, 17 Mar 2021 21:02:24 +0100 Subject: [PATCH 20/20] 122: fix signing in gradle for PR builds --- app/build.gradle | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b172cdf1..4b24e69a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,16 +24,25 @@ android { signingConfigs { release { - storeFile file("keystore/my_app_keystore") - storePassword System.getenv('KEYSTORE_PASSWORD') - keyAlias System.getenv('RELEASE_SIGN_KEY_ALIAS') - keyPassword System.getenv('RELEASE_SIGN_KEY_PASSWORD') + def keystorePropsFile = file("keystore/my_app_keystore") + + if (keystorePropsFile.exists()) + { + storeFile file("keystore/my_app_keystore") + storePassword System.getenv('KEYSTORE_PASSWORD') + keyAlias System.getenv('RELEASE_SIGN_KEY_ALIAS') + keyPassword System.getenv('RELEASE_SIGN_KEY_PASSWORD') + } } } buildTypes { release { - signingConfig signingConfigs.release + def keystorePropsFile = file("keystore/my_app_keystore") + + if (keystorePropsFile.exists()) { + signingConfig signingConfigs.release + } minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }