Skip to content

Commit

Permalink
Update CI to include instrumented tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AnasNaouchi committed May 28, 2024
1 parent 6feef52 commit 79af97c
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 12 deletions.
40 changes: 34 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
- name: Build project
run: ./gradlew sdk:build -x test

unit-test-maven-publish:
name: Unit test and Publish Maven package
runs-on: ubuntu-latest
unit-intrumented-test-maven-publish:
name: Unit/Instrumented tests and Publish Maven package
runs-on: macos-latest
needs: build
steps:
- name: Checkout code
Expand All @@ -60,9 +60,37 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Run unit tests
# Switch to jacocoTestReport when instrumentation flakiness is fixed
run: ./gradlew sdk:jacocoUnitTestReport
- name: AVD cache
uses: actions/cache@v3
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
profile: Nexus 6
script: echo "Generated AVD snapshot for caching."

- name: Run unit/instrumented tests
uses: reactivecircus/android-emulator-runner@v2
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
api-level: ${{ matrix.api-level }}
disable-animations: true
force-avd-creation: false
profile: Nexus 6
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
run: ./gradlew sdk:jacocoTestReport

- name: Publish Maven package
run: ./gradlew sdk:publish
Expand Down
38 changes: 32 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
- name: Build project
run: ./gradlew sdk:build -x test

unit-test:
name: Unit tests with coverage report
runs-on: ubuntu-latest
unit-intrumented-test:
name: Unit/Instrumented tests with coverage report
runs-on: macos-latest
needs: build
steps:
- name: Checkout code
Expand All @@ -60,9 +60,35 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Run unit tests
- name: AVD cache
uses: actions/cache@v3
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
profile: Nexus 6
script: echo "Generated AVD snapshot for caching."

- name: Run unit/instrumented tests
uses: reactivecircus/android-emulator-runner@v2
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# Switch to jacocoTestReport when instrumentation flakiness is fixed
run: ./gradlew sdk:jacocoUnitTestReport sdk:sonar
with:
api-level: ${{ matrix.api-level }}
disable-animations: true
force-avd-creation: false
profile: Nexus 6
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
run: ./gradlew sdk:jacocoTestReport sdk:sonar

0 comments on commit 79af97c

Please sign in to comment.