99jobs :
1010 build :
1111 runs-on : ubuntu-latest
12+ strategy :
13+ matrix :
14+ api-level : [ 34 ]
1215
1316 steps :
1417 - uses : actions/checkout@v4
@@ -34,22 +37,47 @@ jobs:
3437 - name : Run Unit Tests
3538 run : ./gradlew test
3639
37- # This is not working on GitHub yet
38- # - name: Enable KVM group perms
39- # run: |
40- # echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
41- # | sudo tee /etc/udev/rules.d/99-kvm4all.rules
42- # sudo udevadm control --reload-rules
43- # sudo udevadm trigger --name-match=kvm
44- #
45- # - name: Run instrumentation tests
46- # uses: reactivecircus/android-emulator-runner@v2
47- # with:
48- # api-level: 34
49- # target: google_apis
50- # arch: x86_64
51- # profile: pixel_5
52- # emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
53- # disable-animations: true
54- # emulator-boot-timeout: 600
55- # script: ./gradlew connectedCheck
40+ - name : Enable KVM
41+ run : |
42+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
43+ sudo udevadm control --reload-rules
44+ sudo udevadm trigger --name-match=kvm
45+
46+ - name : AVD cache
47+ uses : actions/cache@v4
48+ id : avd-cache
49+ with :
50+ path : |
51+ ~/.android/avd/*
52+ ~/.android/adb*
53+ key : avd-${{ matrix.api-level }}
54+
55+
56+ - name : create AVD and generate snapshot for caching
57+ if : steps.avd-cache.outputs.cache-hit != 'true'
58+ uses : reactivecircus/android-emulator-runner@v2
59+ with :
60+ api-level : ${{ matrix.api-level }}
61+ force-avd-creation : false
62+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front emulated -camera-back emulated
63+ disable-animations : false
64+ script : echo "Generated AVD snapshot for caching."
65+
66+ - name : Run Instrumentation Tests
67+ uses : reactivecircus/android-emulator-runner@v2
68+ with :
69+ api-level : ${{ matrix.api-level }}
70+ force-avd-creation : false
71+ emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front emulated -camera-back emulated
72+ disable-animations : true
73+ script : |
74+ adb wait-for-device
75+ adb shell input keyevent 82
76+ ./gradlew connectedAndroidTest --continue
77+
78+ - name : Upload Test Reports
79+ if : failure()
80+ uses : actions/upload-artifact@v4
81+ with :
82+ name : android-test-report
83+ path : ' **/build/reports/androidTests/connected/'
0 commit comments