@@ -143,6 +143,10 @@ jobs:
143143 runs-on : ubuntu-latest
144144 timeout-minutes : 60
145145
146+ strategy :
147+ matrix :
148+ api-level : [ 29, 35 ]
149+
146150 steps :
147151 - uses : actions/checkout@v6
148152
@@ -163,26 +167,36 @@ jobs:
163167 sudo udevadm control --reload-rules
164168 sudo udevadm trigger --name-match=kvm
165169
166- - name : Delete unnecessary tools
167- uses : jlumbroso/free-disk-space@v1.3.1
170+ - name : Gradle cache
171+ uses : gradle/actions/setup-gradle@v5
172+
173+ - name : AVD cache
174+ uses : actions/cache@v5
175+ id : avd-cache
168176 with :
169- android : false # Don't remove Android tools
170- tool-cache : true # Remove image tool cache - rm -rf "$AGENT_TOOLSDIRECTORY"
171- dotnet : true # rm -rf /usr/share/dotnet
172- haskell : true # rm -rf /opt/ghc...
173- swap-storage : true # rm -f /mnt/swapfile (4GiB)
174- docker-images : false # Takes 16s, enable if needed in the future
175- large-packages : false # includes google-cloud-sdk and it's slow
177+ path : |
178+ ~/.android/avd/*
179+ ~/.android/adb*
180+ key : avd-${{ matrix.api-level }}
181+
182+ - name : Create AVD and generate snapshot for caching
183+ if : steps.avd-cache.outputs.cache-hit != 'true'
184+ uses : reactivecircus/android-emulator-runner@v2
185+ with :
186+ api-level : ${{ matrix.api-level }}
187+ force-avd-creation : false
188+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
189+ disable-animations : false
190+ script : echo "Generated AVD snapshot for caching."
176191
177192 - name : Run Android Device Tests
178193 uses : reactivecircus/android-emulator-runner@v2
179194 with :
180- api-level : 35
195+ api-level : ${{ matrix.api-level }}
181196 target : google_apis
182- arch : x86_64
183197 profile : pixel_5
184198 force-avd-creation : false
185- emulator-options : -no-snapshot-load -no-snapshot- save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none
199+ emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none
186200 disable-animations : true
187201 script : ./gradlew connectedAndroidDeviceTest -Pandroidx.baselineprofile.skipgeneration
188202
0 commit comments