Run Instrumentation tests and generates unified code coverage (#4828)

* Run instrumentation tests on CI and generate unified coverage report

* Fix ci

* Fix failing tests and use mac machine for HAXM

* Fix failing tests

* Fix coverage failure

* Try with ubuntu latest

* Change API level to 23

* Fix Failing Test

* Add prod APK generator workflow back
This commit is contained in:
Madhur Gupta 2022-02-18 11:48:29 +05:30 committed by GitHub
parent c6fda6dadb
commit 9205f37605
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 98 additions and 25 deletions

View file

@ -8,8 +8,11 @@ concurrency:
jobs:
build:
name: Build APK and Run Unit Tests
name: Run tests and generate APK
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [23]
steps:
- uses: actions/checkout@v2.4.0
@ -30,7 +33,36 @@ jobs:
key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
restore-keys: gradle-packages-${{ runner.os }}
- name: Build with Gradle and run Unit Tests
- name: AVD cache
uses: actions/cache@v2
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- 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 }}
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 Instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
profile: Nexus 6
script: ./gradlew connectedBetaDebugAndroidTest --stacktrace
- name: Run Unit tests
run: ./gradlew -Pcoverage testBetaDebugUnitTestCoverage --stacktrace
- name: Upload Test Report to Codecov