From d5995424d16cb9fe685af2963f6eab5d4846d98e Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Thu, 12 Dec 2019 10:19:25 +0000 Subject: [PATCH 01/12] Squashed commit: [bee1dc77] #1593 Move CI from Travis to GitHub Action - finalise builds and remove travis [1e4ee35d] #1593 Move CI from Travis to GitHub Action - add release build [dd55beeb] #1593 Move CI from Travis to GitHub Action - fix nightly syntax [2904da58] #1593 Move CI from Travis to GitHub Action - add nightly build [a4f9fbb0] #1593 Move CI from Travis to GitHub Action - experiment with mixed workflows [4c019201] #1593 Move CI from Travis to GitHub Action - give more leeway to ZimManageActivityTest [759713df] #1593 Move CI from Travis to GitHub Action - reattempt failing test action [257004ea] #1593 Move CI from Travis to GitHub Action - more informative logs, use x64 images [0163d829] #1593 Move CI from Travis to GitHub Action - specify version of action [0b3d9668] #1593 Move CI from Travis to GitHub Action - revert webview fix for emulator 26 [6c2cb7e3] #1593 Move CI from Travis to GitHub Action - give more leeway to IntroActivityTest [6fc998d4] #1593 Move CI from Travis to GitHub Action - give more leeway to ZimManageActivityTest [2e97ca0b] #1593 Move CI from Travis to GitHub Action - give more leeway to ZimManageActivityTest [b4a6e35b] #1593 Move CI from Travis to GitHub Action - drop support for api 26 [e6d67c2b] #1593 Move CI from Travis to GitHub Action - give more leeway to ZimManage/IntroActivityTest [24338f74] #1593 Move CI from Travis to GitHub Action - give more leeway to ZimManageActivityTest [f6a67192] #1593 Move CI from Travis to GitHub Action - give more leeway to ZimManageActivityTest [9571a21d] #1593 Move CI from Travis to GitHub Action - give more leeway to ZimManageActivityTest [193b67d3] #1593 Move CI from Travis to GitHub Action - use google_apis to get api 26 to pass, scale back logging [2e1bc5ab] #1593 Move CI from Travis to GitHub Action - give more leeway to ZimManageActivityTest [c9430d7b] #1593 Move CI from Travis to GitHub Action - make intro ridiculously fault tolerant [22281cef] #1593 Move CI from Travis to GitHub Action - stop using duration and comment out dark mode related test [f446ecaa] #1593 Move CI from Travis to GitHub Action - retry swiping multiple times, reneable ignored tests [7e109732] #1593 Move CI from Travis to GitHub Action - remove missing webview, make zimManage request longer, try new custom swipe [990acf23] #1593 Move CI from Travis to GitHub Actions - use flings for intro, use debug logging to diagnose API 26 [508f95e4] #1593 Move CI from Travis to GitHub Actions - missing webview package and Intro stability [ff24e3f7] #1593 Move CI from Travis to GitHub Actions - fallback for emulators without external storage [39af5525] #1593 Move CI from Travis to GitHub Actions - stabilise intro, stop clearing package data, log strange error [cdafea3d] #1593 Move CI from Travis to GitHub Actions - upgrade orchestrator and log emulator exceptions [1882536e] #1593 Move CI from Travis to GitHub Actions - use x86 images [78f9a162] #1593 Move CI from Travis to GitHub Actions - stop using google_apis [cb3468cb] #1593 Move CI from Travis to GitHub Actions - fix appcompat regression [6e13a6d9] #1593 Move CI from Travis to GitHub Actions - use google_apis to avoid webview crash [3401ca98] #1593 Move CI from Travis to GitHub Actions - run on all available emulators [28349112] #1593 Move CI from Travis to GitHub Actions - stop failing fast [6eb1d607] #1593 Move CI from Travis to GitHub Actions - try on as many concurrent emulators as allowed [2462815a] #1593 Move CI from Travis to GitHub Actions - fix syntax [cdddb63c] #1593 Move CI from Travis to GitHub Actions - create pull request build --- .github/workflows/coverage.yml | 34 ++++++ .github/workflows/nightly.yml | 60 +++++++++++ .github/workflows/pull_request.yml | 29 +++++ .github/workflows/release.yml | 66 ++++++++++++ .travis.yml | 101 ------------------ app/src/androidTest/java/DebugFunctions.kt | 12 ++- .../java/org/kiwix/kiwixmobile/BaseRobot.kt | 8 +- .../org/kiwix/kiwixmobile/KiwixMockServer.kt | 5 - .../org/kiwix/kiwixmobile/intro/IntroRobot.kt | 22 ++-- .../kiwixmobile/main/MainActivityTest.java | 3 - .../settings/KiwixSettingsActivityTest.java | 18 ++-- .../zim_manager/ZimManageActivityTest.kt | 12 ++- .../kiwixmobile/zim_manager/ZimManageRobot.kt | 10 +- buildSrc/src/main/kotlin/Versions.kt | 2 +- .../kiwixmobile/core/base/BaseActivity.kt | 12 +++ .../core/main/CoreMainActivity.java | 3 +- .../core/utils/SharedPreferenceUtil.java | 7 +- instrumentation.sh | 5 + secrets.tar.enc | Bin 20496 -> 0 bytes 19 files changed, 262 insertions(+), 147 deletions(-) create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/nightly.yml create mode 100644 .github/workflows/pull_request.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml create mode 100644 instrumentation.sh delete mode 100644 secrets.tar.enc diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 000000000..6f8755e54 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,34 @@ +name: Coverage Reporting + +on: + push: + branches: + - master + - develop + + pull_request: + branches: + - '**' + +jobs: + + coverageReport: + runs-on: macOS-latest + steps: + - name: checkout + uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: create instrumentation coverage + uses: reactivecircus/android-emulator-runner@v2.0.0 + with: + api-level: 21 + arch: x86_64 + script: bash instrumentation.sh + + - name: create unit coverage + run: ./gradlew jacocoTestDebugUnitTestReport jacocoTestCustomExampleDebugUnitTestReport + + - name: upload coverage + run: bash <(curl -s https://codecov.io/bash) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 000000000..4af5568f6 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,60 @@ +name: Nightly + +on: + schedule: + # every night at midnight + - cron: '0 0 * * *' + +jobs: + + instrumentation_tests: + strategy: + matrix: + api-level: [21, 22, 23, 24, 25, 27, 28, 29] + fail-fast: false + runs-on: macOS-latest + steps: + + - name: checkout + uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: run instrumentation tests + uses: reactivecircus/android-emulator-runner@v2.0.0 + with: + api-level: ${{ matrix.api-level }} + arch: x86_64 + script: ./gradlew connectedDebugAndroidTest + + unit_test_and_release: + needs: instrumentation_tests + runs-on: ubuntu-latest + steps: + + - name: checkout + uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: run unit tests + run: ./gradlew testDebugUnitTest testCustomExampleDebugUnitTest + + - name: build debug + run: ./gradlew assembleDebug + + - name: Decrypt files + env: + ssh_key: ${{ secrets.ssh_key }} + run: | + echo "$ssh_key" | base64 -d > ssh_key + + - name: release debug to kiwix.download.org + env: + UNIVERSAL_DEBUG_APK: app/build/outputs/apk/debug/*universal*.apk + DATE: $(echo $(date +%Y-%m-%d)) + run: | + mkdir $DATE + cp $UNIVERSAL_DEBUG_APK $DATE + scp -vrp -i ssh_key -o StrictHostKeyChecking=no $DATE ci@download.kiwix.org:/data/download/nightly/ + diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 000000000..681b20343 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,29 @@ +name: Pull requests + +on: [pull_request] + +jobs: + + staticAnalysis: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: Static Analysis + run: ./gradlew ktlintCheck app:lintDebug core:lintDebug custom:lintCustomexampleDebug + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: Build app and custom + run: ./gradlew app:assembleDebug custom:assembleCustomexampleDebug diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..25ba9afc6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +name: Publish App + +on: + push: + branches-ignore: + - '*' + - '*/**' + tags: + - '*' + - '*/**' + +jobs: + publish: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: Decrypt files + env: + keystore: ${{ secrets.keystore }} + google_json: ${{ secrets.google_json }} + ssh_key: ${{ secrets.ssh_key }} + run: | + echo "$google_json" | base64 -d > google.json + echo "$keystore" | base64 -d > kiwix-android.keystore + echo "$ssh_key" | base64 -d > ssh_key + + - name: Publish app to play store + env: + KEY_ALIAS: ${{ secrets.KEY_ALIAS }} + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} + KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} + run: ./gradlew publishReleaseApk + + - name: Publish app to download.kiwix.org + env: + UNIVERSAL_RELEASE_APK: app/build/outputs/apk/release/*universal*.apk + TAG: $(echo ${GITHUB_REF:10}) + OUTPUT_NAME: kiwix-$TAG.apk + run: | + cp $UNIVERSAL_RELEASE_APK $OUTPUT_NAME + scp -vrp -i ssh_key -o StrictHostKeyChecking=no $OUTPUT_NAME ci@download.kiwix.org:/data/download/release/kiwix-android/ + + - name: Create Github Release + id: create_release + uses: actions/create-release@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: true + prerelease: true + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OUTPUT_DIR: ${{app/build/outputs/apk}} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: $OUTPUT_DIR + asset_name: assets.zip + asset_content_type: application/vnd.android.package-archive diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 71ead7e6d..000000000 --- a/.travis.yml +++ /dev/null @@ -1,101 +0,0 @@ -language: android - -jdk: oraclejdk8 - -sudo: required - -dist: trusty - -env: - global: - # switch glibc to a memory conserving mode - - MALLOC_ARENA_MAX=2 - - ANDROID_TARGET=android-19 - - ANDROID_ABI=armeabi-v7a - -if: type != push OR tag IS present - -install: - - pip install --user 'requests[security]' - - wget -r -nH -nd -np -R index.html* robots.txt* http://download.kiwix.org/dev/android/api/licenses/ -e robots=off -P $ANDROID_HOME/licenses || true - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ - -cache: - directories: - - "$HOME/.gradle/caches/" - - "$HOME/.gradle/wrapper/" - - "$HOME/.android/build-cache" - -android: - components: - - build-tools-28.0.3 - - android-28 - - extra-android-m2repository - - $ANDROID_TARGET - - sys-img-${ANDROID_ABI}-${ANDROID_TARGET} - -licenses: - - ".+" - -before_script: - - chmod +x gradlew - - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI -c 100M - - emulator -avd test -no-audio -no-window & - - android-wait-for-emulator - - adb shell input keyevent 82 & - -script: - - ./gradlew jacocoInstrumentationTestReport ktlintCheck app:lintDebug core:lintDebug custom:lintCustomexampleDebug jacocoTestDebugUnitTestReport jacocoTestCustomExampleDebugUnitTestReport app:assembleDebug - -after_success: - - bash <(curl -s https://codecov.io/bash) - - openssl aes-256-cbc -K $encrypted_82adfa9c3806_key -iv $encrypted_82adfa9c3806_iv -in secrets.tar.enc -out secrets.tar -d - - tar xvf secrets.tar - - ./gradlew app:assembleRelease - -before_deploy: - # - export APP_CHANGELOG=$(cat app/src/kiwix/play/release-notes/en-US/default.txt) - - export DATE=$(date +%Y-%m-%d) - - export OUTPUT_DIR=app/build/outputs/apk - - export UNIVERSAL_RELEASE_APK=$OUTPUT_DIR/release/*universal*.apk - - export UNIVERSAL_DEBUG_APK=$OUTPUT_DIR/debug/*universal*.apk - - export SSH_KEY=travisci_builder_id_key - - chmod 600 $SSH_KEY - -deploy: - - #publish on github releases - - provider: releases - api_key: "$GITHUB_TOKEN" - file: $OUTPUT_DIR/release/* - file_glob: true - skip_cleanup: true - overwrite: true - #body: "$APP_CHANGELOG" broken because travis can't escape newlines https://github.com/travis-ci/dpl/issues/155 - draft: true - on: - tags: true - - #publish on play store - - provider: script - skip_cleanup: true - script: ./gradlew publishReleaseApk - on: - tags: true - - #publish release on download.kiwix.org - - provider: script - skip_cleanup: true - script: mkdir $TRAVIS_TAG && cp $UNIVERSAL_RELEASE_APK $TRAVIS_TAG && scp -vrp -i ${SSH_KEY} -o StrictHostKeyChecking=no $TRAVIS_TAG ci@download.kiwix.org:/data/download/release/kiwix-android/ - on: - tags: true - - #publish debug nightly on download.kiwix.org - - provider: script - skip_cleanup: true - script: mkdir $DATE && cp $UNIVERSAL_DEBUG_APK $DATE && scp -vrp -i ${SSH_KEY} -o StrictHostKeyChecking=no $DATE ci@download.kiwix.org:/data/download/nightly/ - on: - branch: develop diff --git a/app/src/androidTest/java/DebugFunctions.kt b/app/src/androidTest/java/DebugFunctions.kt index 2266b673e..88ec5cbd8 100644 --- a/app/src/androidTest/java/DebugFunctions.kt +++ b/app/src/androidTest/java/DebugFunctions.kt @@ -23,6 +23,7 @@ import android.widget.TextView import androidx.test.platform.app.InstrumentationRegistry import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry import androidx.test.runner.lifecycle.Stage.RESUMED +import androidx.viewpager.widget.ViewPager import org.kiwix.kiwixmobile.BaseRobot import java.io.File @@ -54,6 +55,13 @@ fun combineMessages( fun getViewHierarchy(v: View) = StringBuilder().apply { getViewHierarchy(v, this, 0) }.toString() +fun attempt(count: Int, function: () -> Unit): Unit = try { + function.invoke() +} catch (e: Exception) { + if (count - 1 == 0) throw e + else attempt(count - 1, function) +} + private fun getViewHierarchy(v: View, desc: StringBuilder, margin: Int) { desc.append(getViewMessage(v, margin)) if (v is ViewGroup) { @@ -65,7 +73,9 @@ private fun getViewHierarchy(v: View, desc: StringBuilder, margin: Int) { private fun getViewMessage(v: View, marginOffset: Int) = "${numSpaces(marginOffset)}[${v.javaClass.simpleName}]${resourceId(v)}${text(v)}" + - "${contentDescription(v)}${visibility(v)}\n" + "${contentDescription(v)}${visibility(v)}${page(v)}\n" + +fun page(v: View) = if (v is ViewPager) " page: ${v.currentItem}" else "" fun visibility(v: View) = " visibility:" + when (v.visibility) { diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/BaseRobot.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/BaseRobot.kt index eeed1761e..ee61eef7b 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/BaseRobot.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/BaseRobot.kt @@ -30,7 +30,7 @@ import org.kiwix.kiwixmobile.Findable.StringId.ContentDesc import org.kiwix.kiwixmobile.Findable.Text import org.kiwix.kiwixmobile.Findable.ViewId -const val WAIT_TIMEOUT_MS = 10000L +const val WAIT_TIMEOUT_MS = 10_000L abstract class BaseRobot( private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation(), @@ -70,7 +70,7 @@ abstract class BaseRobot( } protected fun clickOnTab(textId: Int) { - clickOn(ContentDesc(textId)) + clickOn(ContentDesc(textId), 20_000L) } protected fun waitFor(milliseconds: Long) { @@ -85,8 +85,8 @@ abstract class BaseRobot( private fun UiObject2.customSwipe( direction: Direction, - fl: Float = 1.0f + percent: Float = 0.8f ) { - swipe(direction, fl) + swipe(direction, percent) } } diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/KiwixMockServer.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/KiwixMockServer.kt index b0c3b455c..41a3ce895 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/KiwixMockServer.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/KiwixMockServer.kt @@ -25,7 +25,6 @@ import okhttp3.mockwebserver.RecordedRequest import org.kiwix.sharedFunctions.TEST_PORT import org.simpleframework.xml.core.Persister import java.io.StringWriter -import java.util.Stack class KiwixMockServer { @@ -63,10 +62,6 @@ class KiwixMockServer { forcedResponse = mockResponse } - private fun Stack.popOrNull() = - if (empty()) null - else pop() - private fun Any.asXmlString() = StringWriter().let { Persister().write(this, it) "$it" diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt index a81f74e9b..68cc86fb5 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt @@ -18,6 +18,8 @@ package org.kiwix.kiwixmobile.intro +import applyWithViewHierarchyPrinting +import attempt import org.kiwix.kiwixmobile.BaseRobot import org.kiwix.kiwixmobile.Findable.StringId.TextId import org.kiwix.kiwixmobile.Findable.ViewId @@ -25,7 +27,7 @@ import org.kiwix.kiwixmobile.R import org.kiwix.kiwixmobile.main.MainRobot import org.kiwix.kiwixmobile.main.main -fun intro(func: IntroRobot.() -> Unit) = IntroRobot().apply(func) +fun intro(func: IntroRobot.() -> Unit) = IntroRobot().applyWithViewHierarchyPrinting(func) class IntroRobot : BaseRobot() { @@ -33,19 +35,23 @@ class IntroRobot : BaseRobot() { private val viewPager = ViewId(R.id.view_pager) init { - isVisible(getStarted) + isVisible(getStarted, 20_000L) } fun swipeLeft() { - isVisible(viewPager).swipeLeft() - isVisible(TextId(R.string.save_books_offline)) - isVisible(TextId(R.string.download_books_message)) + attempt(10) { + isVisible(viewPager).swipeLeft() + isVisible(TextId(R.string.save_books_offline)) + isVisible(TextId(R.string.download_books_message)) + } } fun swipeRight() { - isVisible(viewPager).swipeRight() - isVisible(TextId(R.string.welcome_to_the_family)) - isVisible(TextId(R.string.human_kind_knowledge)) + attempt(10) { + isVisible(viewPager).swipeRight() + isVisible(TextId(R.string.welcome_to_the_family), 40_000L) + isVisible(TextId(R.string.human_kind_knowledge), 40_000L) + } } infix fun clickGetStarted(func: MainRobot.() -> Unit): MainRobot { diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/main/MainActivityTest.java b/app/src/androidTest/java/org/kiwix/kiwixmobile/main/MainActivityTest.java index f4d79c8ef..35e58e075 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/main/MainActivityTest.java +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/main/MainActivityTest.java @@ -25,7 +25,6 @@ import androidx.test.rule.ActivityTestRule; import androidx.test.rule.GrantPermissionRule; import com.schibsted.spain.barista.interaction.BaristaMenuClickInteractions; import com.schibsted.spain.barista.interaction.BaristaSleepInteractions; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -56,8 +55,6 @@ public class MainActivityTest { } @Test - @Ignore("This is hanging on travis") - //TODO fix as part of https://github.com/kiwix/kiwix-android/issues/1428 public void navigateSettings() { BaristaSleepInteractions.sleep(TEST_PAUSE_MS); enterSettings(); diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/settings/KiwixSettingsActivityTest.java b/app/src/androidTest/java/org/kiwix/kiwixmobile/settings/KiwixSettingsActivityTest.java index d674cd5cf..af4b9add5 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/settings/KiwixSettingsActivityTest.java +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/settings/KiwixSettingsActivityTest.java @@ -20,7 +20,6 @@ package org.kiwix.kiwixmobile.settings; import android.preference.Preference; import androidx.test.rule.ActivityTestRule; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.kiwix.kiwixmobile.core.R; @@ -35,7 +34,6 @@ import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.kiwix.kiwixmobile.utils.StandardActions.enterSettings; -@Ignore("This is hanging the build") //TODO convert to Kotlin/PageObject public class KiwixSettingsActivityTest { @Rule public ActivityTestRule activityTestRule = @@ -44,15 +42,15 @@ public class KiwixSettingsActivityTest { @Test public void testToggle() { enterSettings(); - onData(allOf( - is(instanceOf(Preference.class)), - withKey("pref_nightmode"))) - .perform(click()); + //onData(allOf( + // is(instanceOf(Preference.class)), + // withKey("pref_nightmode"))) + // .perform(click()); - onData(allOf( - is(instanceOf(Preference.class)), - withKey("pref_auto_nightmode"))) - .perform(click()); + //onData(allOf( + // is(instanceOf(Preference.class)), + // withKey("pref_auto_nightmode"))) + // .perform(click()); onData(allOf( is(instanceOf(Preference.class)), diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivityTest.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivityTest.kt index 691e75f1c..650897006 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivityTest.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivityTest.kt @@ -20,6 +20,7 @@ package org.kiwix.kiwixmobile.zim_manager import android.os.Build import androidx.test.filters.SdkSuppress +import attempt import okhttp3.mockwebserver.MockResponse import org.junit.Test import org.kiwix.kiwixmobile.BaseActivityTest @@ -59,8 +60,11 @@ class ZimManageActivityTest : BaseActivityTest() { searchFor(book) pressBack() pressBack() - forceResponse("0123456789") - clickOn(book) + forceResponse("012345678901234567890123456789012345678901234567890123456789012345678") + attempt(10) { + clickOn(book) + waitForEmptyView() + } } clickOnDownloading { clickStop() @@ -94,9 +98,7 @@ class ZimManageActivityTest : BaseActivityTest() { mockServer.forceResponse( MockResponse() .setBody(body) - .throttleBody( - 1L, 1L, SECONDS - ) + .throttleBody(1L, 1L, SECONDS) ) } diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageRobot.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageRobot.kt index 6905af2a6..e947fe365 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageRobot.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageRobot.kt @@ -32,7 +32,7 @@ fun zimManage(func: ZimManageRobot.() -> Unit) = class ZimManageRobot : BaseRobot() { init { - isVisible(ViewId(R.id.manageViewPager)) + isVisible(ViewId(R.id.manageViewPager), 40_000L) } fun clickOnOnline(func: LibraryRobot.() -> Unit): LibraryRobot { @@ -67,7 +67,7 @@ class ZimManageRobot : BaseRobot() { } fun clickOnSearch() { - clickOn(ViewId(R.id.action_search)) + clickOn(ViewId(R.id.action_search), 20_000L) } fun searchFor(book: Book) { @@ -75,18 +75,18 @@ class ZimManageRobot : BaseRobot() { } fun waitForEmptyView() { - isVisible(ViewId(R.id.libraryErrorText)) + isVisible(ViewId(R.id.libraryErrorText), 40_000L) } } private fun download(func: DownloadRobot.() -> Unit) = DownloadRobot().apply(func) inner class DownloadRobot : BaseRobot() { init { - isVisible(ViewId(R.id.zim_download_root), 20000L) + isVisible(ViewId(R.id.zim_download_root)) } fun clickStop() { - clickOn(ViewId(R.id.stop)) + clickOn(ViewId(R.id.stop), 20_000L) } fun waitForEmptyView() { diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index fccae58e4..11492234a 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -83,7 +83,7 @@ object Versions { const val fragment_ktx: String = "1.1.0" - const val orchestrator: String = "1.1.0" // available: "1.2.0" + const val orchestrator: String = "1.2.0" const val lint_gradle: String = "26.5.2" diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/base/BaseActivity.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/base/BaseActivity.kt index 5c9c39413..178219690 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/base/BaseActivity.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/base/BaseActivity.kt @@ -17,6 +17,8 @@ */ package org.kiwix.kiwixmobile.core.base +import android.content.res.Configuration +import android.os.Build import android.os.Bundle import androidx.annotation.LayoutRes import androidx.appcompat.app.AppCompatActivity @@ -49,6 +51,16 @@ abstract class BaseActivity : AppCompatActivity() { unbinder = ButterKnife.bind(this) } + // TODO https://issuetracker.google.com/issues/141132133 remove this once appcompat has been fixed + override fun applyOverrideConfiguration(overrideConfiguration: Configuration?) { + if (Build.VERSION.SDK_INT in Build.VERSION_CODES.LOLLIPOP..Build.VERSION_CODES.N_MR1 && + (resources.configuration.uiMode == applicationContext.resources.configuration.uiMode) + ) { + return + } + super.applyOverrideConfiguration(overrideConfiguration) + } + override fun onDestroy() { super.onDestroy() unbinder?.unbind() diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreMainActivity.java b/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreMainActivity.java index 1b733e837..c294e392d 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreMainActivity.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreMainActivity.java @@ -1090,8 +1090,7 @@ public abstract class CoreMainActivity extends BaseActivity openZimFile(file); } scanStorageForZims(); - } - else { + } else { Snackbar.make(snackbarRoot, R.string.request_storage, Snackbar.LENGTH_LONG) .setAction(R.string.menu_settings, view -> { Intent intent = new Intent(); diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/SharedPreferenceUtil.java b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/SharedPreferenceUtil.java index 0327ec7cd..a53766282 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/SharedPreferenceUtil.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/SharedPreferenceUtil.java @@ -26,6 +26,7 @@ import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; import io.reactivex.Flowable; import io.reactivex.processors.PublishProcessor; +import java.io.File; import java.util.HashSet; import java.util.Set; import javax.inject.Inject; @@ -110,8 +111,10 @@ public class SharedPreferenceUtil { public String getPrefStorage() { String storage = sharedPreferences.getString(PREF_STORAGE, null); if (storage == null) { - storage = - ContextCompat.getExternalFilesDirs(CoreApp.getInstance(), null)[0].getPath(); + final File externalFilesDir = + ContextCompat.getExternalFilesDirs(CoreApp.getInstance(), null)[0]; + storage = externalFilesDir != null ? externalFilesDir.getPath() + : CoreApp.getInstance().getFilesDir().getPath(); // workaround for emulators putPrefStorage(storage); } return storage; diff --git a/instrumentation.sh b/instrumentation.sh new file mode 100644 index 000000000..16fa304b9 --- /dev/null +++ b/instrumentation.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +adb logcat -c +adb logcat *:E -v color & +./gradlew jacocoInstrumentationTestReport diff --git a/secrets.tar.enc b/secrets.tar.enc deleted file mode 100644 index 84725abc8af6e6c8ae1ac5958fcfd471279c067d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 liter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FEd From fd6ae39763e13fdfa477fb1f3a1a07bc6b549d48 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Wed, 18 Dec 2019 11:36:12 +0000 Subject: [PATCH 02/12] #1593 Move CI from Travis to GitHub Action - update night mode automated test --- .../settings/KiwixSettingsActivityTest.java | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/settings/KiwixSettingsActivityTest.java b/app/src/androidTest/java/org/kiwix/kiwixmobile/settings/KiwixSettingsActivityTest.java index af4b9add5..aa2ec6f61 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/settings/KiwixSettingsActivityTest.java +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/settings/KiwixSettingsActivityTest.java @@ -20,6 +20,7 @@ package org.kiwix.kiwixmobile.settings; import android.preference.Preference; import androidx.test.rule.ActivityTestRule; +import org.jetbrains.annotations.NotNull; import org.junit.Rule; import org.junit.Test; import org.kiwix.kiwixmobile.core.R; @@ -42,15 +43,6 @@ public class KiwixSettingsActivityTest { @Test public void testToggle() { enterSettings(); - //onData(allOf( - // is(instanceOf(Preference.class)), - // withKey("pref_nightmode"))) - // .perform(click()); - - //onData(allOf( - // is(instanceOf(Preference.class)), - // withKey("pref_auto_nightmode"))) - // .perform(click()); onData(allOf( is(instanceOf(Preference.class)), @@ -136,5 +128,24 @@ public class KiwixSettingsActivityTest { assertDisplayed(R.string.clear_all_history_dialog_title); } + + @Test + public void testNightModeDialog() { + enterSettings(); + onData(allOf( + is(instanceOf(Preference.class)), + withKey("pref_night_mode"))) + .perform(click()); + + for (String nightModeString : nightModeStrings()) { + assertDisplayed(nightModeString); + } + } + + @NotNull private String[] nightModeStrings() { + return activityTestRule.getActivity() + .getResources() + .getStringArray(R.array.pref_night_modes_entries); + } } From 595d73f5688ead2333b2ae12b3fd1543ac60ef3c Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Wed, 18 Dec 2019 11:39:41 +0000 Subject: [PATCH 03/12] #1593 Move CI from Travis to GitHub Action - clean wait usage --- .../java/org/kiwix/kiwixmobile/BaseRobot.kt | 12 +++++++----- .../java/org/kiwix/kiwixmobile/intro/IntroRobot.kt | 8 +++++--- .../kiwix/kiwixmobile/zim_manager/ZimManageRobot.kt | 10 ++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/BaseRobot.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/BaseRobot.kt index ee61eef7b..baeb76b27 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/BaseRobot.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/BaseRobot.kt @@ -30,7 +30,9 @@ import org.kiwix.kiwixmobile.Findable.StringId.ContentDesc import org.kiwix.kiwixmobile.Findable.Text import org.kiwix.kiwixmobile.Findable.ViewId -const val WAIT_TIMEOUT_MS = 10_000L +const val DEFAULT_WAIT = 10_000L +const val LONG_WAIT = 20_000L +const val VERY_LONG_WAIT = 40_000L abstract class BaseRobot( private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation(), @@ -50,7 +52,7 @@ abstract class BaseRobot( uiDevice.pressBack() } - protected fun isVisible(findable: Findable, timeout: Long = WAIT_TIMEOUT_MS) = + protected fun isVisible(findable: Findable, timeout: Long = DEFAULT_WAIT) = waitFor(findable, timeout) ?: throw RuntimeException(findable.errorMessage(this)) protected fun UiObject2.swipeLeft() { @@ -61,7 +63,7 @@ abstract class BaseRobot( customSwipe(Direction.RIGHT) } - protected fun clickOn(findable: Findable, timeout: Long = WAIT_TIMEOUT_MS) { + protected fun clickOn(findable: Findable, timeout: Long = DEFAULT_WAIT) { isVisible(findable, timeout).click() } @@ -70,7 +72,7 @@ abstract class BaseRobot( } protected fun clickOnTab(textId: Int) { - clickOn(ContentDesc(textId), 20_000L) + clickOn(ContentDesc(textId), LONG_WAIT) } protected fun waitFor(milliseconds: Long) { @@ -79,7 +81,7 @@ abstract class BaseRobot( private fun waitFor( findable: Findable, - timeout: Long = WAIT_TIMEOUT_MS + timeout: Long = DEFAULT_WAIT ): UiObject2? = uiDevice.wait(Until.findObject(findable.selector(this)), timeout) diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt index 68cc86fb5..1323468fa 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt @@ -23,7 +23,9 @@ import attempt import org.kiwix.kiwixmobile.BaseRobot import org.kiwix.kiwixmobile.Findable.StringId.TextId import org.kiwix.kiwixmobile.Findable.ViewId +import org.kiwix.kiwixmobile.LONG_WAIT import org.kiwix.kiwixmobile.R +import org.kiwix.kiwixmobile.VERY_LONG_WAIT import org.kiwix.kiwixmobile.main.MainRobot import org.kiwix.kiwixmobile.main.main @@ -35,7 +37,7 @@ class IntroRobot : BaseRobot() { private val viewPager = ViewId(R.id.view_pager) init { - isVisible(getStarted, 20_000L) + isVisible(getStarted, LONG_WAIT) } fun swipeLeft() { @@ -49,8 +51,8 @@ class IntroRobot : BaseRobot() { fun swipeRight() { attempt(10) { isVisible(viewPager).swipeRight() - isVisible(TextId(R.string.welcome_to_the_family), 40_000L) - isVisible(TextId(R.string.human_kind_knowledge), 40_000L) + isVisible(TextId(R.string.welcome_to_the_family), VERY_LONG_WAIT) + isVisible(TextId(R.string.human_kind_knowledge), VERY_LONG_WAIT) } } diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageRobot.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageRobot.kt index e947fe365..25f68185a 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageRobot.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageRobot.kt @@ -22,7 +22,9 @@ import org.kiwix.kiwixmobile.BaseRobot import org.kiwix.kiwixmobile.Findable.StringId.TextId import org.kiwix.kiwixmobile.Findable.Text import org.kiwix.kiwixmobile.Findable.ViewId +import org.kiwix.kiwixmobile.LONG_WAIT import org.kiwix.kiwixmobile.R +import org.kiwix.kiwixmobile.VERY_LONG_WAIT import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book import org.kiwix.kiwixmobile.language.LanguageRobot import org.kiwix.kiwixmobile.language.language @@ -32,7 +34,7 @@ fun zimManage(func: ZimManageRobot.() -> Unit) = class ZimManageRobot : BaseRobot() { init { - isVisible(ViewId(R.id.manageViewPager), 40_000L) + isVisible(ViewId(R.id.manageViewPager), VERY_LONG_WAIT) } fun clickOnOnline(func: LibraryRobot.() -> Unit): LibraryRobot { @@ -67,7 +69,7 @@ class ZimManageRobot : BaseRobot() { } fun clickOnSearch() { - clickOn(ViewId(R.id.action_search), 20_000L) + clickOn(ViewId(R.id.action_search), LONG_WAIT) } fun searchFor(book: Book) { @@ -75,7 +77,7 @@ class ZimManageRobot : BaseRobot() { } fun waitForEmptyView() { - isVisible(ViewId(R.id.libraryErrorText), 40_000L) + isVisible(ViewId(R.id.libraryErrorText), VERY_LONG_WAIT) } } @@ -86,7 +88,7 @@ class ZimManageRobot : BaseRobot() { } fun clickStop() { - clickOn(ViewId(R.id.stop), 20_000L) + clickOn(ViewId(R.id.stop), LONG_WAIT) } fun waitForEmptyView() { From a06fb793d94c9809d2d68a46429a79f3af0dfed7 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Thu, 19 Dec 2019 11:26:13 +0000 Subject: [PATCH 04/12] #1593 Move CI from Travis to GitHub Action - upload multiple coverage reports to reduce variance --- .github/workflows/coverage.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 6f8755e54..0719d4c8d 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -12,8 +12,11 @@ on: jobs: - coverageReport: - runs-on: macOS-latest + coverageReport:strategy: + matrix: + api-level: [21, 22] + fail-fast: false + runs-on: macOS-latestruns-on: macOS-latest steps: - name: checkout uses: actions/checkout@v1 @@ -23,7 +26,7 @@ jobs: - name: create instrumentation coverage uses: reactivecircus/android-emulator-runner@v2.0.0 with: - api-level: 21 + api-level: ${{ matrix.api-level }} arch: x86_64 script: bash instrumentation.sh From e50b1ec93ddf59d7e53d4b2ba23b0cdf9b93edf9 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Thu, 19 Dec 2019 11:37:37 +0000 Subject: [PATCH 05/12] #1593 Move CI from Travis to GitHub Action - fix syntax --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 0719d4c8d..63355aecc 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -16,7 +16,7 @@ jobs: matrix: api-level: [21, 22] fail-fast: false - runs-on: macOS-latestruns-on: macOS-latest + runs-on: macOS-latest steps: - name: checkout uses: actions/checkout@v1 From 5d00ab02d31631f7962fdab74925e864f0d6a909 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Thu, 19 Dec 2019 11:41:16 +0000 Subject: [PATCH 06/12] #1593 Move CI from Travis to GitHub Action - fix syntax and use newest/oldest api levels --- .github/workflows/coverage.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 63355aecc..7df254be6 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -12,11 +12,12 @@ on: jobs: - coverageReport:strategy: - matrix: - api-level: [21, 22] - fail-fast: false - runs-on: macOS-latest + coverageReport: + strategy: + matrix: + api-level: [21, 29] + fail-fast: false + runs-on: macOS-latest steps: - name: checkout uses: actions/checkout@v1 From d85454bbc61a71fd85891daeee4b9adce3ef0dfd Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Thu, 19 Dec 2019 11:45:27 +0000 Subject: [PATCH 07/12] #1593 Move CI from Travis to GitHub Action - fix indentation --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7df254be6..4cf8bc319 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -17,7 +17,7 @@ jobs: matrix: api-level: [21, 29] fail-fast: false - runs-on: macOS-latest + runs-on: macOS-latest steps: - name: checkout uses: actions/checkout@v1 From e771541767327744044c872ee30d637aa3b3ef38 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Fri, 20 Dec 2019 09:30:53 +0000 Subject: [PATCH 08/12] #1593 Move CI from Travis to GitHub Action - fix nightly indentation --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4af5568f6..5abbc1db2 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,7 +12,7 @@ jobs: matrix: api-level: [21, 22, 23, 24, 25, 27, 28, 29] fail-fast: false - runs-on: macOS-latest + runs-on: macOS-latest steps: - name: checkout From 1fceb9928a630747aa95313a243c6ed2a4e7bc94 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Fri, 20 Dec 2019 11:17:59 +0000 Subject: [PATCH 09/12] #1593 Move CI from Travis to GitHub Action - restructure IntroActivityTest --- .../org/kiwix/kiwixmobile/intro/IntroActivityTest.kt | 1 - .../java/org/kiwix/kiwixmobile/intro/IntroRobot.kt | 11 ++--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroActivityTest.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroActivityTest.kt index 0c7e262c3..608f14e8b 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroActivityTest.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroActivityTest.kt @@ -31,7 +31,6 @@ class IntroActivityTest : BaseActivityTest() { fun viewIsSwipeableAndNavigatesToMain() { intro { swipeLeft() - swipeRight() } clickGetStarted { } } } diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt index 1323468fa..d6a6740ae 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/intro/IntroRobot.kt @@ -25,7 +25,6 @@ import org.kiwix.kiwixmobile.Findable.StringId.TextId import org.kiwix.kiwixmobile.Findable.ViewId import org.kiwix.kiwixmobile.LONG_WAIT import org.kiwix.kiwixmobile.R -import org.kiwix.kiwixmobile.VERY_LONG_WAIT import org.kiwix.kiwixmobile.main.MainRobot import org.kiwix.kiwixmobile.main.main @@ -38,6 +37,8 @@ class IntroRobot : BaseRobot() { init { isVisible(getStarted, LONG_WAIT) + isVisible(TextId(R.string.welcome_to_the_family)) + isVisible(TextId(R.string.human_kind_knowledge)) } fun swipeLeft() { @@ -48,14 +49,6 @@ class IntroRobot : BaseRobot() { } } - fun swipeRight() { - attempt(10) { - isVisible(viewPager).swipeRight() - isVisible(TextId(R.string.welcome_to_the_family), VERY_LONG_WAIT) - isVisible(TextId(R.string.human_kind_knowledge), VERY_LONG_WAIT) - } - } - infix fun clickGetStarted(func: MainRobot.() -> Unit): MainRobot { clickOn(getStarted) return main(func) From f7a6606d20a142de51ef0225cec177b7f06033c4 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Fri, 20 Dec 2019 13:33:25 +0000 Subject: [PATCH 10/12] #1593 Move CI from Travis to GitHub Action - future proof building job --- .github/workflows/pull_request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 681b20343..585f199dd 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -25,5 +25,5 @@ jobs: with: fetch-depth: 1 - - name: Build app and custom - run: ./gradlew app:assembleDebug custom:assembleCustomexampleDebug + - name: Build all configurations + run: ./gradlew assemble From 9a8f96ba23394bcd89de0f655ffbb7caf5a0b4c9 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Fri, 20 Dec 2019 13:52:55 +0000 Subject: [PATCH 11/12] #1593 Move CI from Travis to GitHub Action - do not target core when assembling --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 585f199dd..b0f7fa755 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -26,4 +26,4 @@ jobs: fetch-depth: 1 - name: Build all configurations - run: ./gradlew assemble + run: ./gradlew app:assemble custom:assemble From ce48b5c09820f7ab6445c84ddee3c0fcfa88c1e9 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Fri, 20 Dec 2019 14:13:45 +0000 Subject: [PATCH 12/12] #1593 Move CI from Travis to GitHub Action - move resources to core to allow compilation --- .github/workflows/pull_request.yml | 2 +- .../src/main/res/mipmap-anydpi-v26/ic_launcher.xml | 0 .../res/mipmap-anydpi-v26/ic_launcher_round.xml | 0 .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin .../main/res/mipmap-hdpi/ic_launcher_foreground.png | Bin .../src/main/res/mipmap-hdpi/ic_launcher_round.png | Bin .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin .../main/res/mipmap-mdpi/ic_launcher_foreground.png | Bin .../src/main/res/mipmap-mdpi/ic_launcher_round.png | Bin .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin .../res/mipmap-xhdpi/ic_launcher_foreground.png | Bin .../src/main/res/mipmap-xhdpi/ic_launcher_round.png | Bin .../src/main/res/mipmap-xxhdpi/ic_launcher.png | Bin .../res/mipmap-xxhdpi/ic_launcher_foreground.png | Bin .../main/res/mipmap-xxhdpi/ic_launcher_round.png | Bin .../src/main/res/mipmap-xxxhdpi/ic_launcher.png | Bin .../res/mipmap-xxxhdpi/ic_launcher_foreground.png | Bin .../main/res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 18 files changed, 1 insertion(+), 1 deletion(-) rename {app => core}/src/main/res/mipmap-anydpi-v26/ic_launcher.xml (100%) rename {app => core}/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml (100%) rename {app => core}/src/main/res/mipmap-hdpi/ic_launcher.png (100%) rename {app => core}/src/main/res/mipmap-hdpi/ic_launcher_foreground.png (100%) rename {app => core}/src/main/res/mipmap-hdpi/ic_launcher_round.png (100%) rename {app => core}/src/main/res/mipmap-mdpi/ic_launcher.png (100%) rename {app => core}/src/main/res/mipmap-mdpi/ic_launcher_foreground.png (100%) rename {app => core}/src/main/res/mipmap-mdpi/ic_launcher_round.png (100%) rename {app => core}/src/main/res/mipmap-xhdpi/ic_launcher.png (100%) rename {app => core}/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png (100%) rename {app => core}/src/main/res/mipmap-xhdpi/ic_launcher_round.png (100%) rename {app => core}/src/main/res/mipmap-xxhdpi/ic_launcher.png (100%) rename {app => core}/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png (100%) rename {app => core}/src/main/res/mipmap-xxhdpi/ic_launcher_round.png (100%) rename {app => core}/src/main/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename {app => core}/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png (100%) rename {app => core}/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png (100%) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index b0f7fa755..585f199dd 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -26,4 +26,4 @@ jobs: fetch-depth: 1 - name: Build all configurations - run: ./gradlew app:assemble custom:assemble + run: ./gradlew assemble diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/core/src/main/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to core/src/main/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/core/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to core/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/core/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from app/src/main/res/mipmap-hdpi/ic_launcher.png rename to core/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/core/src/main/res/mipmap-hdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png rename to core/src/main/res/mipmap-hdpi/ic_launcher_foreground.png diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/core/src/main/res/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from app/src/main/res/mipmap-hdpi/ic_launcher_round.png rename to core/src/main/res/mipmap-hdpi/ic_launcher_round.png diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/core/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from app/src/main/res/mipmap-mdpi/ic_launcher.png rename to core/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/core/src/main/res/mipmap-mdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png rename to core/src/main/res/mipmap-mdpi/ic_launcher_foreground.png diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/core/src/main/res/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from app/src/main/res/mipmap-mdpi/ic_launcher_round.png rename to core/src/main/res/mipmap-mdpi/ic_launcher_round.png diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/core/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to core/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/core/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png rename to core/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/core/src/main/res/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from app/src/main/res/mipmap-xhdpi/ic_launcher_round.png rename to core/src/main/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/core/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to core/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/core/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png rename to core/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/core/src/main/res/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png rename to core/src/main/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/core/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to core/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/core/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png similarity index 100% rename from app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png rename to core/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/core/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png rename to core/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png