mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
* 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
90 lines
2.8 KiB
YAML
90 lines
2.8 KiB
YAML
name: Android CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
concurrency:
|
|
group: build-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Run tests and generate APK
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
api-level: [23]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2.4.0
|
|
|
|
- name: Set up JDK
|
|
uses: actions/setup-java@v2.5.0
|
|
with:
|
|
distribution: "temurin"
|
|
java-version: 8
|
|
|
|
- name: Cache packages
|
|
id: cache-packages
|
|
uses: actions/cache@v2.1.7
|
|
with:
|
|
path: |
|
|
~/.gradle/caches
|
|
~/.gradle/wrapper
|
|
key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
|
|
restore-keys: gradle-packages-${{ runner.os }}
|
|
|
|
- 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
|
|
run: |
|
|
curl -Os https://uploader.codecov.io/latest/linux/codecov
|
|
chmod +x codecov
|
|
./codecov -f "app/build/reports/jacoco/testBetaDebugUnitTestCoverage/testBetaDebugUnitTestCoverage.xml" -Z
|
|
|
|
- name: Generate betaDebug APK
|
|
run: bash ./gradlew assembleBetaDebug --stacktrace
|
|
|
|
- name: Upload betaDebug APK
|
|
uses: actions/upload-artifact@v2.3.1
|
|
with:
|
|
name: betaDebugAPK
|
|
path: app/build/outputs/apk/beta/debug/app-*.apk
|
|
|
|
- name: Generate prodDebug APK
|
|
run: bash ./gradlew assembleProdDebug --stacktrace
|
|
|
|
- name: Upload prodDebug APK
|
|
uses: actions/upload-artifact@v2.3.1
|
|
with:
|
|
name: prodDebugAPK
|
|
path: app/build/outputs/apk/prod/debug/app-*.apk
|