Skip to content

Commit

Permalink
Update CI/CD based on docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AnasNaouchi committed May 29, 2024
1 parent 09f9686 commit 718d020
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 20 deletions.
37 changes: 26 additions & 11 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ jobs:
- name: Build project
run: ./gradlew sdk:build -x test

unit-intrumented-test-maven-publish:
name: Unit/Instrumented tests and Publish Maven package
runs-on: macos-latest
unit-intrumented-test:
name: Unit/Instrumented tests with coverage report
runs-on: ubuntu-22.04
timeout-minutes: 60
strategy:
matrix:
api-level: [ 29 ]
Expand All @@ -53,6 +54,12 @@ jobs:
distribution: 'zulu'
java-version: '17'

- name: Enable KVM group perms
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: Cache Gradle dependencies
uses: actions/cache@v3
with:
Expand All @@ -63,6 +70,15 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Determine emulator target
id: determine-target
run: |
TARGET="google_apis"
if [[ ${{ matrix.api-level }} -ge 34 ]]; then
TARGET="aosp_atd"
fi
echo "TARGET=$TARGET" >> $GITHUB_OUTPUT
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
Expand All @@ -77,12 +93,11 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
abi: arm64-v8a
target: ${{ steps.determine-target.outputs.TARGET }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
profile: Nexus 6
disable-animations: true
script: echo "Generated AVD snapshot for caching."

- name: Run unit/instrumented tests
Expand All @@ -91,12 +106,12 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: arm64-v8a
disable-animations: true
target: ${{ steps.determine-target.outputs.TARGET }}
arch: x86_64
force-avd-creation: false
profile: Nexus 6
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
profile: Nexus One
script: ./gradlew sdk:jacocoTestReport

- name: Publish Maven package
Expand Down
33 changes: 24 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:

unit-intrumented-test:
name: Unit/Instrumented tests with coverage report
runs-on: macos-latest
runs-on: ubuntu-22.04
timeout-minutes: 60
strategy:
matrix:
api-level: [ 29 ]
Expand All @@ -53,6 +54,12 @@ jobs:
distribution: 'zulu'
java-version: '17'

- name: Enable KVM group perms
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: Cache Gradle dependencies
uses: actions/cache@v3
with:
Expand All @@ -63,6 +70,15 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Determine emulator target
id: determine-target
run: |
TARGET="google_apis"
if [[ ${{ matrix.api-level }} -ge 34 ]]; then
TARGET="aosp_atd"
fi
echo "TARGET=$TARGET" >> $GITHUB_OUTPUT
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
Expand All @@ -77,12 +93,11 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: arm64-v8a
target: ${{ steps.determine-target.outputs.TARGET }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
profile: Nexus 6
disable-animations: true
script: echo "Generated AVD snapshot for caching."

- name: Run unit/instrumented tests
Expand All @@ -91,11 +106,11 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: arm64-v8a
disable-animations: true
target: ${{ steps.determine-target.outputs.TARGET }}
arch: x86_64
force-avd-creation: false
profile: Nexus 6
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
profile: Nexus One
script: ./gradlew sdk:jacocoTestReport sdk:sonar

0 comments on commit 718d020

Please sign in to comment.