Skip to content

Commit

Permalink
updating Ui testing workflow from the ReactiveCircus official repo
Browse files Browse the repository at this point in the history
  • Loading branch information
nabilBouzineDev committed Aug 13, 2024
1 parent b541009 commit 5341424
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,42 @@ jobs:
- name: Run unit tests
run: ./gradlew clean testDebug

android_test_job:
name: Android Test
test:
runs-on: macos-latest
continue-on-error: true
strategy:
matrix:
api-level: [ 21, 23, 29 ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: checkout
uses: actions/checkout@v3

- name: Grant execute permissions for gradlew
run: chmod +x gradlew
- name: Gradle cache
uses: gradle/gradle-build-action@v2

- name: Restore Cache
uses: actions/cache@v4
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: Run Android Instrumentation Tests
- 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: 29
script: ./gradlew connectedDebugAndroidTest
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: Upload Android Test Reports
if: ${{ always() }}
uses: actions/upload-artifact@v2
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
name: android-test-reports
path: '**/build/reports/androidTests/'
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
script: ./gradlew connectedCheck

0 comments on commit 5341424

Please sign in to comment.