From 65e134ce7377b3cde95c02c0e6799714a3e3accb Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 16:54:53 -0800 Subject: [PATCH 01/22] Added in GitHub Continuous Integration --- .github/workflows/android.yml | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/android.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 00000000..b46ee390 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,39 @@ +name: Android CI + +on: + push: + branches: [ '**' ] + pull_request: + branches: [ '**' ] + +jobs: + build: + + #runs-on: ubuntu-latest + runs-on: macos-latest + + steps: + - name: checkout + uses: actions/checkout@v2 + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + cache: gradle + + - name: Create properties file with empty API key + run: echo mapsApiKey=a >> local.properties + - name: Build with Gradle + run: ./gradlew build + - name: Run Unit Tests + run: ./gradlew check + + - name: Run Instrumented Tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 24 + target: default #, google_apis + arch: x86 + profile: Nexus 6 + script: ./gradlew connectedCheck --stacktrace From df2fdfb16eb845ee705a65243ed8092ef690b1e2 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 17:04:24 -0800 Subject: [PATCH 02/22] Enable Git submodules on CI --- .github/workflows/android.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index b46ee390..355ad13f 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -15,6 +15,8 @@ jobs: steps: - name: checkout uses: actions/checkout@v2 + with: + submodules: recursive - name: set up JDK 11 uses: actions/setup-java@v2 with: From 42bda3515c330ca20e95931c6cd9760f6e12ddfa Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 17:09:32 -0800 Subject: [PATCH 03/22] Gradle needs all commit history to build --- .github/workflows/android.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 355ad13f..efa85d67 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -16,6 +16,7 @@ jobs: - name: checkout uses: actions/checkout@v2 with: + fetch-depth: 0 submodules: recursive - name: set up JDK 11 uses: actions/setup-java@v2 From bcd3b7bf6f69b21d0f41a420c0d6ec4bb47c8a42 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 17:21:14 -0800 Subject: [PATCH 04/22] Enabled stacktraces of failed builds --- .github/workflows/android.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index efa85d67..f032049b 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -28,9 +28,9 @@ jobs: - name: Create properties file with empty API key run: echo mapsApiKey=a >> local.properties - name: Build with Gradle - run: ./gradlew build + run: ./gradlew assembleDebug --stacktrace - name: Run Unit Tests - run: ./gradlew check + run: ./gradlew testDebug --stacktrace - name: Run Instrumented Tests uses: reactivecircus/android-emulator-runner@v2 From d4c027c7d33fb881b7baba414e057021510eb0c6 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 18:03:33 -0800 Subject: [PATCH 05/22] Use real Google Maps API key with Github secrets --- .github/workflows/android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index f032049b..8085179a 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -26,7 +26,7 @@ jobs: cache: gradle - name: Create properties file with empty API key - run: echo mapsApiKey=a >> local.properties + run: echo mapsApiKey="\"${{ secrets.mapsApiKey }}\"" >> local.properties - name: Build with Gradle run: ./gradlew assembleDebug --stacktrace - name: Run Unit Tests From ac190f1b1ebfe3a34b1ec031af40f0fe3b09db62 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 19:02:04 -0800 Subject: [PATCH 06/22] Build/test release and debug configurations and enable linter Currently, there are linting errors so the lint step is not marked as fatal. --- .github/workflows/android.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 8085179a..1f5afae4 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -27,10 +27,16 @@ jobs: - name: Create properties file with empty API key run: echo mapsApiKey="\"${{ secrets.mapsApiKey }}\"" >> local.properties + - name: Build with Gradle - run: ./gradlew assembleDebug --stacktrace + run: ./gradlew assemble --stacktrace + - name: Run Unit Tests - run: ./gradlew testDebug --stacktrace + run: ./gradlew test --stacktrace + + - name: Run Linter + run: ./gradlew lint --stacktrace + continue-on-error: true - name: Run Instrumented Tests uses: reactivecircus/android-emulator-runner@v2 From 7c0faeca1598229ba52572380a08b791d0bad165 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 19:17:06 -0800 Subject: [PATCH 07/22] Enable job matrix for testing on several API levels --- .github/workflows/android.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 1f5afae4..aef22a35 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -7,10 +7,16 @@ on: branches: [ '**' ] jobs: - build: + test: - #runs-on: ubuntu-latest + # macOS provided hardware-accelerated emulator runs-on: macos-latest + strategy: + fail-fast: false + matrix: + api-level: [ 15, 19, 24, 30 ] + target: [ default, google_apis ] + name: "Android CI for API ${{ matrix.api-level }} target ${{ matrix.target }}" steps: - name: checkout @@ -41,8 +47,8 @@ jobs: - name: Run Instrumented Tests uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 24 - target: default #, google_apis + api-level: ${{ matrix.api-level }} + target: ${{ matrix.target }} arch: x86 profile: Nexus 6 script: ./gradlew connectedCheck --stacktrace From 459df5ea374778721bbdb74cb35d5b006467073d Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 19:54:12 -0800 Subject: [PATCH 08/22] Broke it up into multiple, dependent jobs This allows common parts of the CI to run only once and for the final testing to all be done in parallel. --- .github/workflows/android.yml | 37 +++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index aef22a35..87940e66 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -7,16 +7,9 @@ on: branches: [ '**' ] jobs: - test: - - # macOS provided hardware-accelerated emulator + compile: runs-on: macos-latest - strategy: - fail-fast: false - matrix: - api-level: [ 15, 19, 24, 30 ] - target: [ default, google_apis ] - name: "Android CI for API ${{ matrix.api-level }} target ${{ matrix.target }}" + name: "Compile all sources" steps: - name: checkout @@ -34,9 +27,21 @@ jobs: - name: Create properties file with empty API key run: echo mapsApiKey="\"${{ secrets.mapsApiKey }}\"" >> local.properties - - name: Build with Gradle + - name: Build App run: ./gradlew assemble --stacktrace + - name: Build unit tests + run: ./gradlew assembleDebugUnitTest assembleReleaseUnitTest --stacktrace + + - name: Build instrumentation tests + run: ./gradlew assembleAndroidTest --stacktrace + + unit-test: + name: "Run all unit tests" + needs: compile + runs-on: macos-latest + + steps: - name: Run Unit Tests run: ./gradlew test --stacktrace @@ -44,6 +49,18 @@ jobs: run: ./gradlew lint --stacktrace continue-on-error: true + instrumentation: + name: "Testing on API ${{ matrix.api-level }} for ${{ matrix.target }}" + needs: compile + # macOS provided hardware-accelerated emulator + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + api-level: [ 15, 19, 24, 30 ] + target: [ default, google_apis ] + + steps: - name: Run Instrumented Tests uses: reactivecircus/android-emulator-runner@v2 with: From f7737f57173913cf999a2d33392b50f320cbb523 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 19:57:23 -0800 Subject: [PATCH 09/22] Added CI badge to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8badb977..afe7afb4 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ messages. APRSdroid is Open Source Software written in Scala and licensed under the GPLv2. +![Android CI](../../actions/workflows/android/badge.svg) + Quick links: - [Google Play](https://play.google.com/store/apps/details?id=org.aprsdroid.app) From 98c7b56ca19654eee6f04e682e015c693492dbd1 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 20:21:03 -0800 Subject: [PATCH 10/22] Fixes --- .github/workflows/android.yml | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 87940e66..12b29362 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -17,6 +17,7 @@ jobs: with: fetch-depth: 0 submodules: recursive + - name: set up JDK 11 uses: actions/setup-java@v2 with: @@ -24,6 +25,12 @@ jobs: distribution: 'adopt' cache: gradle + - name: Load build outputs + uses: actions/cache@v2 + with: + path: build + key: build-${{ github.sha }} + - name: Create properties file with empty API key run: echo mapsApiKey="\"${{ secrets.mapsApiKey }}\"" >> local.properties @@ -42,6 +49,25 @@ jobs: runs-on: macos-latest steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: recursive + + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + cache: gradle + + - name: Load build outputs + uses: actions/cache@v2 + with: + path: build + key: build-${{ github.sha }} + - name: Run Unit Tests run: ./gradlew test --stacktrace @@ -61,6 +87,25 @@ jobs: target: [ default, google_apis ] steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: recursive + + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + cache: gradle + + - name: Load build outputs + uses: actions/cache@v2 + with: + path: build + key: build-${{ github.sha }} + - name: Run Instrumented Tests uses: reactivecircus/android-emulator-runner@v2 with: From a87f955126168c0694cd9a01ce5f2ca8e747fd52 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 20:56:55 -0800 Subject: [PATCH 11/22] Save test reports on failure and upload APK on success --- .github/workflows/android.yml | 17 ++++++++++++++++- README.md | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 12b29362..b22a2af4 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -5,6 +5,7 @@ on: branches: [ '**' ] pull_request: branches: [ '**' ] + workflow_dispatch: jobs: compile: @@ -75,6 +76,13 @@ jobs: run: ./gradlew lint --stacktrace continue-on-error: true + - name: Upload reports + uses: actions/upload-artifact@v2 + with: + name: Unit Test Reports + path: build/outputs/reports + if: ${{ failure() }} + instrumentation: name: "Testing on API ${{ matrix.api-level }} for ${{ matrix.target }}" needs: compile @@ -83,7 +91,7 @@ jobs: strategy: fail-fast: false matrix: - api-level: [ 15, 19, 24, 30 ] + api-level: [ 15, 20, 24, 30 ] target: [ default, google_apis ] steps: @@ -114,3 +122,10 @@ jobs: arch: x86 profile: Nexus 6 script: ./gradlew connectedCheck --stacktrace + + - name: Save successful debug APK + uses: actions/upload-artifact@v2 + with: + name: debug apk + path: build/outputs/debug/aprsdroid-debug.apk + if: ${{ matrix.api-level == 30 && matrix.target == 'google_apis' }} diff --git a/README.md b/README.md index afe7afb4..64a9af56 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ messages. APRSdroid is Open Source Software written in Scala and licensed under the GPLv2. -![Android CI](../../actions/workflows/android/badge.svg) +[![Android CI](../../actions/workflows/android.yml/badge.svg)](../../actions/workflows/android.yml) Quick links: From 981915893aa7e34b1ba4bf6b77736c1a215a0b71 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 21:41:45 -0800 Subject: [PATCH 12/22] Added Android emulator snapshotting to improve start-up performance --- .github/workflows/android.yml | 37 ++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index b22a2af4..3353f35c 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -13,13 +13,13 @@ jobs: name: "Compile all sources" steps: - - name: checkout + - name: Checkout project uses: actions/checkout@v2 with: fetch-depth: 0 submodules: recursive - - name: set up JDK 11 + - name: Set up JDK 11 uses: actions/setup-java@v2 with: java-version: '11' @@ -50,13 +50,13 @@ jobs: runs-on: macos-latest steps: - - name: checkout + - name: Checkout project uses: actions/checkout@v2 with: fetch-depth: 0 submodules: recursive - - name: set up JDK 11 + - name: Set up JDK 11 uses: actions/setup-java@v2 with: java-version: '11' @@ -91,17 +91,17 @@ jobs: strategy: fail-fast: false matrix: - api-level: [ 15, 20, 24, 30 ] + api-level: [ 15, 21, 24, 31 ] target: [ default, google_apis ] steps: - - name: checkout + - name: Checkout project uses: actions/checkout@v2 with: fetch-depth: 0 submodules: recursive - - name: set up JDK 11 + - name: Set up JDK 11 uses: actions/setup-java@v2 with: java-version: '11' @@ -114,6 +114,26 @@ jobs: path: build key: build-${{ github.sha }} + - name: AVD cache + uses: actions/cache@v2 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ matrix.api-level }}-${{ matrix.target }} + + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-level }} + target: ${{ matrix.target }} + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: false + script: echo "Generated AVD snapshot for caching." + - name: Run Instrumented Tests uses: reactivecircus/android-emulator-runner@v2 with: @@ -121,6 +141,9 @@ jobs: target: ${{ matrix.target }} arch: x86 profile: Nexus 6 + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true script: ./gradlew connectedCheck --stacktrace - name: Save successful debug APK From 61c771ad0a13674d2f539fe082b23ac517734ae0 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 22:00:50 -0800 Subject: [PATCH 13/22] Exclude build combinations that won't start in emulator --- .github/workflows/android.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 3353f35c..d0c76030 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -91,8 +91,11 @@ jobs: strategy: fail-fast: false matrix: - api-level: [ 15, 21, 24, 31 ] + api-level: [ 15, 21, 24, 30 ] target: [ default, google_apis ] + exclude: + - api-level: 30 + target: default steps: - name: Checkout project From 2230a21d6270a29b7d0ed777e8d8ec988653507e Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 2 Jan 2022 22:02:34 -0800 Subject: [PATCH 14/22] API level 30 and above only supported with 64-bit --- .github/workflows/android.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index d0c76030..17246c26 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -80,8 +80,8 @@ jobs: uses: actions/upload-artifact@v2 with: name: Unit Test Reports - path: build/outputs/reports - if: ${{ failure() }} + path: build/reports + if: always() instrumentation: name: "Testing on API ${{ matrix.api-level }} for ${{ matrix.target }}" @@ -91,7 +91,7 @@ jobs: strategy: fail-fast: false matrix: - api-level: [ 15, 21, 24, 30 ] + api-level: [ 15, 21, 24, 31 ] target: [ default, google_apis ] exclude: - api-level: 30 @@ -132,6 +132,7 @@ jobs: with: api-level: ${{ matrix.api-level }} target: ${{ matrix.target }} + arch: ${{ matrix.api-level >= 30 && 'x86_64' || 'x86' }} force-avd-creation: false emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: false @@ -142,16 +143,23 @@ jobs: with: api-level: ${{ matrix.api-level }} target: ${{ matrix.target }} - arch: x86 + arch: ${{ matrix.api-level >= 30 && 'x86_64' || 'x86' }} profile: Nexus 6 force-avd-creation: false emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: ./gradlew connectedCheck --stacktrace + - name: Upload reports + uses: actions/upload-artifact@v2 + with: + name: Instrument Test Reports API ${{ matrix.api-level }} ${{ matrix.target }} + path: build/reports + if: always() + - name: Save successful debug APK uses: actions/upload-artifact@v2 with: name: debug apk - path: build/outputs/debug/aprsdroid-debug.apk - if: ${{ matrix.api-level == 30 && matrix.target == 'google_apis' }} + path: build/outputs/apk/debug/aprsdroid-debug.apk + if: matrix.api-level == 31 && matrix.target == 'google_apis' From 6951ebc73148656e9d78b5fc6e411bc256d31f41 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Mon, 3 Jan 2022 00:33:05 -0800 Subject: [PATCH 15/22] Only upload test reports on failure --- .github/workflows/android.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 17246c26..0b75e23b 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -81,7 +81,7 @@ jobs: with: name: Unit Test Reports path: build/reports - if: always() + if: failure() instrumentation: name: "Testing on API ${{ matrix.api-level }} for ${{ matrix.target }}" @@ -155,11 +155,11 @@ jobs: with: name: Instrument Test Reports API ${{ matrix.api-level }} ${{ matrix.target }} path: build/reports - if: always() + if: failure() - name: Save successful debug APK uses: actions/upload-artifact@v2 with: - name: debug apk + name: Debug APK path: build/outputs/apk/debug/aprsdroid-debug.apk if: matrix.api-level == 31 && matrix.target == 'google_apis' From 68d42fc7dc0349be8dfb73a7b53cdd5bdda2465d Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sat, 29 Jan 2022 23:21:42 -0800 Subject: [PATCH 16/22] Save logcat logs from failed test runs --- .github/workflows/android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 0b75e23b..e8cbe4d3 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -148,7 +148,7 @@ jobs: force-avd-creation: false emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true - script: ./gradlew connectedCheck --stacktrace + script: adb logcat -c && adb logcat -f /sdcard/logcat.txt & ./gradlew connectedCheck --stacktrace || ( adb pull /sdcard/logcat.txt build/reports/; exit 1 ) - name: Upload reports uses: actions/upload-artifact@v2 From e9acefd5524bcd661eaad5c7f3bba85db8c791f0 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 30 Jan 2022 00:05:54 -0800 Subject: [PATCH 17/22] Enable SD card needed for profile tests Use a separate cache for SD-enabled versions of emulator --- .github/workflows/android.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e8cbe4d3..03ca6d68 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -124,7 +124,7 @@ jobs: path: | ~/.android/avd/* ~/.android/adb* - key: avd-${{ matrix.api-level }}-${{ matrix.target }} + key: avd-${{ matrix.api-level }}-${{ matrix.target }}-sd - name: Create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' @@ -134,6 +134,7 @@ jobs: target: ${{ matrix.target }} arch: ${{ matrix.api-level >= 30 && 'x86_64' || 'x86' }} force-avd-creation: false + sdcard-path-or-size: '64M' emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: false script: echo "Generated AVD snapshot for caching." @@ -146,6 +147,7 @@ jobs: arch: ${{ matrix.api-level >= 30 && 'x86_64' || 'x86' }} profile: Nexus 6 force-avd-creation: false + sdcard-path-or-size: '64M' emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: adb logcat -c && adb logcat -f /sdcard/logcat.txt & ./gradlew connectedCheck --stacktrace || ( adb pull /sdcard/logcat.txt build/reports/; exit 1 ) From b85d28114e660a9a5cda0c62e5fdbfbc007b34ab Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Mon, 31 Jan 2022 23:52:19 -0800 Subject: [PATCH 18/22] Make the README CI badge only show the status of pushes to master --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 64a9af56..a5e59e69 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ messages. APRSdroid is Open Source Software written in Scala and licensed under the GPLv2. -[![Android CI](../../actions/workflows/android.yml/badge.svg)](../../actions/workflows/android.yml) +master: [![Android CI](../../actions/workflows/android.yml/badge.svg?branch=master&event=push)](../../actions/workflows/android.yml) Quick links: From f6327e82e405e840cb6a50aa6c16f5a95ee36333 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 4 Aug 2024 03:55:26 -0700 Subject: [PATCH 19/22] Bumped several GitHub Actions to newer releases --- .github/workflows/android.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 03ca6d68..e6be4af9 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -14,20 +14,20 @@ jobs: steps: - name: Checkout project - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 submodules: recursive - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: '11' distribution: 'adopt' cache: gradle - name: Load build outputs - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: build key: build-${{ github.sha }} @@ -51,20 +51,20 @@ jobs: steps: - name: Checkout project - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 submodules: recursive - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: '11' distribution: 'adopt' cache: gradle - name: Load build outputs - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: build key: build-${{ github.sha }} @@ -77,7 +77,7 @@ jobs: continue-on-error: true - name: Upload reports - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Unit Test Reports path: build/reports @@ -99,26 +99,26 @@ jobs: steps: - name: Checkout project - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 submodules: recursive - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: '11' distribution: 'adopt' cache: gradle - name: Load build outputs - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: build key: build-${{ github.sha }} - name: AVD cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: avd-cache with: path: | @@ -153,14 +153,14 @@ jobs: script: adb logcat -c && adb logcat -f /sdcard/logcat.txt & ./gradlew connectedCheck --stacktrace || ( adb pull /sdcard/logcat.txt build/reports/; exit 1 ) - name: Upload reports - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Instrument Test Reports API ${{ matrix.api-level }} ${{ matrix.target }} path: build/reports if: failure() - name: Save successful debug APK - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Debug APK path: build/outputs/apk/debug/aprsdroid-debug.apk From d709423031046c0b505a564cfd0a009125386eef Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Tue, 6 Aug 2024 02:37:40 -0700 Subject: [PATCH 20/22] Fixed exclude matcher for default target on API 31 --- .github/workflows/android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e6be4af9..e73723b5 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -94,7 +94,7 @@ jobs: api-level: [ 15, 21, 24, 31 ] target: [ default, google_apis ] exclude: - - api-level: 30 + - api-level: 31 # Was 30, is it needed for 31? target: default steps: From b554f97c5bda41a1ba09edddf67f1463ba3be908 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 4 Aug 2024 03:10:42 -0700 Subject: [PATCH 21/22] Attempt to bump Java version for Emulator The latest SDK Commandline tools starting with release 9.0 require Java 17 to execute. These are used by the Android Emulator GitHub Action so it will fail to run if the default Java environment is older than 17. Need JRE 17 to be installed and default, but not the full JDK. However, the build toolchain for Scala still requires to be run under Java 11 so we need both installed. We just need to make sure JAVA_HOME is set appropriately for JDK 11 when calling Gradle. Set JAVA_HOME to JDK 11 for gradle on instrumented tests. --- .github/workflows/android.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e73723b5..dc930c83 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -126,6 +126,14 @@ jobs: ~/.android/adb* key: avd-${{ matrix.api-level }}-${{ matrix.target }}-sd + - name: Set up JRE 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + java-package: 'jre' + #cache: gradle + - name: Create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@v2 @@ -150,7 +158,7 @@ jobs: sdcard-path-or-size: '64M' emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true - script: adb logcat -c && adb logcat -f /sdcard/logcat.txt & ./gradlew connectedCheck --stacktrace || ( adb pull /sdcard/logcat.txt build/reports/; exit 1 ) + script: adb logcat -c && adb logcat -f /sdcard/logcat.txt & JAVA_HOME="${JAVA_HOME_11_X64}" ./gradlew connectedCheck --stacktrace || ( adb pull /sdcard/logcat.txt build/reports/; exit 1 ) - name: Upload reports uses: actions/upload-artifact@v4 From 57a544db458ddf58ce1b97515c297878584a6207 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sun, 4 Aug 2024 21:33:03 -0700 Subject: [PATCH 22/22] Switched to Linux for better emulator performance Hardware acceleration is now possible with Linux runners on GitHub and have much better performance so no need for macOS anymore. --- .github/workflows/android.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index dc930c83..cd027940 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,7 +9,7 @@ on: jobs: compile: - runs-on: macos-latest + runs-on: ubuntu-latest name: "Compile all sources" steps: @@ -47,7 +47,7 @@ jobs: unit-test: name: "Run all unit tests" needs: compile - runs-on: macos-latest + runs-on: ubuntu-latest steps: - name: Checkout project @@ -87,7 +87,8 @@ jobs: name: "Testing on API ${{ matrix.api-level }} for ${{ matrix.target }}" needs: compile # macOS provided hardware-accelerated emulator - runs-on: macos-latest + # but now so does Linux + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -104,6 +105,12 @@ jobs: fetch-depth: 0 submodules: recursive + - name: Enable KVM + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + - name: Set up JDK 11 uses: actions/setup-java@v4 with: