From d80ad00b6aac1321472ac17c37e25872fd71b7db Mon Sep 17 00:00:00 2001 From: Kyle Corry Date: Sun, 21 Jul 2024 06:49:37 -0400 Subject: [PATCH] Update android test action --- .github/workflows/android-test.yml | 46 +++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android-test.yml b/.github/workflows/android-test.yml index 366c8b72b..9a1203599 100644 --- a/.github/workflows/android-test.yml +++ b/.github/workflows/android-test.yml @@ -9,18 +9,56 @@ on: jobs: android_test: runs-on: ubuntu-latest + strategy: + matrix: + api-level: [23, 35] steps: - - name: Checkout code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: 17 + - name: Make gradlew executable + run: chmod +x gradlew + - name: Enable KVM 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: Run tests + - name: Gradle cache + uses: gradle/actions/setup-gradle@v3 + + - name: AVD cache + uses: actions/cache@v4 + 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\ + disable-animations: false + script: echo "Generated AVD snapshot for caching." + + - name: run tests uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 23 + api-level: ${{ matrix.api-level }} + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim + disable-animations: true script: ./gradlew connectedCheck \ No newline at end of file