1717 - name : Checkout code
1818 uses : actions/checkout@v4
1919
20- - name : Set up JDK 21
21- uses : actions/setup-java@v4
22- with :
23- java-version : " 21"
24- distribution : " temurin"
25- cache : " gradle"
20+ - name : Setup Gradle
21+ uses : gradle/actions/setup-gradle@v3
2622
2723 - name : Grant execute permission for gradlew
2824 run : chmod +x gradlew
@@ -33,18 +29,37 @@ jobs:
3329 sudo udevadm control --reload-rules
3430 sudo udevadm trigger
3531
36- - name : Run unit tests and lint check
37- run : ./gradlew --no-daemon --stacktrace --continue test lintDebug
32+ - name : AVD cache
33+ uses : actions/cache@v4
34+ id : avd-cache # Specify a unique GitHub Actions ID for the cache
35+ with :
36+ path : |
37+ ~/.android/avd/*
38+ ~/.android/adb*
39+ key : avd-33
40+
41+ - name : Create AVD and generate snapshot for caching
42+ if : steps.avd-cache.outputs.cache-hit != 'true'
43+ uses : reactivecircus/android-emulator-runner@v2
44+ with :
45+ api-level : 33
46+ arch : x86_64
47+ force-avd-creation : false
48+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
49+ disable-animations : false
50+ script : echo "Generated AVD snapshot for caching."
3851
39- - name : Run instrumented tests on emulator
52+ - name : Run instrumented tests from snapshot
4053 uses : reactivecircus/android-emulator-runner@v2
4154 with :
4255 api-level : 33
4356 arch : x86_64
57+ force-avd-creation : false
58+ emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
4459 script : ./gradlew --no-daemon --stacktrace --continue connectedAndroidTest
4560
46- - name : Assemble debug build
47- run : ./gradlew --no-daemon --stacktrace assembleDebug
61+ - name : Run unit tests, lint check and build
62+ run : ./gradlew --no-daemon --stacktrace --continue test lintDebug assembleDebug
4863
4964 - name : Upload lint report artifact
5065 if : always()
0 commit comments