From c2669595e381e84ca4ed5eebb7946718ab043079 Mon Sep 17 00:00:00 2001 From: Gjorgji Kjosev Date: Sun, 18 Aug 2024 13:39:30 +0100 Subject: [PATCH] feat: add AVD snapshot generation --- .github/workflows/ccpp.yml | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 0a092ec..db0cf17 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -22,6 +22,9 @@ jobs: test: needs: build runs-on: ubuntu-latest + strategy: + matrix: + api-level: [29] steps: - uses: actions/checkout@v4 - name: prepare @@ -39,15 +42,32 @@ jobs: 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: 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 -camera-back none + disable-animations: false + script: echo "Generated AVD snapshot for caching." + + - name: run tests uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 29 - script: | - sudo bash -c 'env PATH=/usr/local/lib/android/sdk/platform-tools:$PATH ./tests/run.sh' - # services: - # emulator: - # image: budtmo/docker-android:emulator_12.0 - # options: --privileged - # - name: run-tests - # run: sudo bash ./docker/run-docker-test.sh \ No newline at end of file + 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: sudo env PATH=/usr/local/lib/android/sdk/platform-tools:$PATH ./tests/run.sh