99jobs :
1010 test :
1111 runs-on : ubuntu-latest
12+ timeout-minutes : 30
1213 strategy :
1314 fail-fast : false
1415 matrix :
15- api-level : [ 23, 29 ]
16- target : [ default, google_apis ]
16+ api-level : [ 23, 26, 31, 36 ]
1717 steps :
1818 - name : checkout
19- uses : actions/checkout@v6
19+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2020
2121 - name : Enable KVM
2222 run : |
@@ -25,38 +25,62 @@ jobs:
2525 sudo udevadm trigger --name-match=kvm
2626
2727 - name : set up JDK
28- uses : actions/setup-java@v5
28+ uses : actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
2929 with :
3030 java-version : ' 17'
31- distribution : ' adopt '
31+ distribution : ' temurin '
3232
3333 - name : Gradle cache
34- uses : gradle/actions/setup-gradle@v5
34+ uses : gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
3535
3636 - name : AVD cache
37- uses : actions/cache@v4
37+ uses : actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
3838 id : avd-cache
3939 with :
4040 path : |
4141 ~/.android/avd/*
4242 ~/.android/adb*
43- key : avd-${{ matrix.api-level }}
43+ key : avd-${{ matrix.api-level }}-default-v6
4444
4545 - name : create AVD and generate snapshot for caching
4646 if : steps.avd-cache.outputs.cache-hit != 'true'
47- uses : reactivecircus/android-emulator-runner@v2
47+ uses : reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0
4848 with :
4949 api-level : ${{ matrix.api-level }}
50+ target : default
51+ arch : x86_64
5052 force-avd-creation : false
5153 emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
5254 disable-animations : false
53- script : echo "Generated AVD snapshot for caching."
55+ script : |
56+ n=0; until adb root || [ "$n" -ge 15 ]; do sleep 2; n=$((n+1)); done
57+ adb wait-for-device
58+ adb shell setprop dalvik.vm.heapgrowthlimit 256m
59+ adb shell setprop dalvik.vm.heapsize 512m
60+ adb shell stop
61+ n=0; until [ "$(adb shell getprop init.svc.zygote | tr -d '\r')" != "running" ]; do sleep 1; n=$((n+1)); [ "$n" -ge 30 ] && break; done
62+ adb shell start || true
63+ n=0; until [ "$(adb shell getprop init.svc.zygote | tr -d '\r')" = "running" ] && [ "$(adb shell getprop sys.boot_completed | tr -d '\r')" = "1" ] && [ -n "$(adb shell pm path android | tr -d '\r')" ] || [ "$n" -ge 60 ]; do sleep 5; n=$((n+1)); done
64+ [ "$(adb shell getprop init.svc.zygote | tr -d '\r')" = "running" ] && [ "$(adb shell getprop sys.boot_completed | tr -d '\r')" = "1" ]
65+ echo "Generated AVD snapshot for caching with raised dalvik heap."
66+ adb -s emulator-5554 emu kill
67+ n=0; until [ -z "$(pgrep -f '[q]emu-system')" ] || [ "$n" -ge 60 ]; do sleep 2; n=$((n+1)); done
68+ pkill -9 -f '[c]rashpad_handler' || true
5469
5570 - name : run tests
56- uses : reactivecircus/android-emulator-runner@v2
71+ uses : reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0
5772 with :
5873 api-level : ${{ matrix.api-level }}
74+ target : default
75+ arch : x86_64
5976 force-avd-creation : false
6077 emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
6178 disable-animations : true
62- script : ./gradlew connectedCheck
79+ script : |
80+ adb shell getprop dalvik.vm.heapgrowthlimit
81+ adb shell getprop dalvik.vm.heapsize
82+ if [ "$(adb shell getprop dalvik.vm.heapgrowthlimit | tr -d '\r')" != "256m" ]; then echo "heap props missing (snapshot load fallback) - re-raising dalvik heap"; n=0; until adb root || [ "$n" -ge 15 ]; do sleep 2; n=$((n+1)); done; adb wait-for-device; adb shell setprop dalvik.vm.heapgrowthlimit 256m; adb shell setprop dalvik.vm.heapsize 512m; adb shell stop; n=0; until [ "$(adb shell getprop init.svc.zygote | tr -d '\r')" != "running" ]; do sleep 1; n=$((n+1)); [ "$n" -ge 30 ] && break; done; adb shell start || true; n=0; until [ "$(adb shell getprop init.svc.zygote | tr -d '\r')" = "running" ] && [ "$(adb shell getprop sys.boot_completed | tr -d '\r')" = "1" ] && [ -n "$(adb shell pm path android | tr -d '\r')" ] || [ "$n" -ge 60 ]; do sleep 5; n=$((n+1)); done; [ "$(adb shell getprop init.svc.zygote | tr -d '\r')" = "running" ] && [ "$(adb shell getprop sys.boot_completed | tr -d '\r')" = "1" ]; fi
83+ ./gradlew connectedCheck
84+ adb -s emulator-5554 emu kill
85+ n=0; until [ -z "$(pgrep -f '[q]emu-system')" ] || [ "$n" -ge 60 ]; do sleep 2; n=$((n+1)); done
86+ pkill -9 -f '[c]rashpad_handler' || true
0 commit comments