Skip to content

Commit 42c8101

Browse files
authored
Cache Android Emulator generation
As outline in https://github.com/marketplace/actions/android-emulator-runner#usage--examples we can cache the android emulator AVD generation.
1 parent b2ab4eb commit 42c8101

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

.github/workflows/agp-matrix.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,25 @@ jobs:
5454
sudo udevadm control --reload-rules
5555
sudo udevadm trigger --name-match=kvm
5656
57+
- name: AVD cache
58+
uses: actions/cache@v4
59+
id: avd-cache
60+
with:
61+
path: |
62+
~/.android/avd/*
63+
~/.android/adb*
64+
key: avd-${{ matrix.api-level }}
65+
66+
- name: Create AVD and generate snapshot for caching
67+
if: steps.avd-cache.outputs.cache-hit != 'true'
68+
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # pin@v2
69+
with:
70+
api-level: 30
71+
force-avd-creation: false
72+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
73+
disable-animations: false
74+
script: echo "Generated AVD snapshot for caching."
75+
5776
# Clean, build and release a test apk
5877
- name: Make assembleUiTests
5978
run: make assembleUiTests
@@ -62,7 +81,7 @@ jobs:
6281
- name: Run instrumentation tests
6382
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # pin@v2
6483
with:
65-
api-level: 30
84+
api-level: 30
6685
force-avd-creation: false
6786
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
6887
disable-animations: true

0 commit comments

Comments
 (0)