@@ -79,17 +79,36 @@ jobs:
79
79
- name : Checkout code
80
80
uses : actions/checkout@v4
81
81
82
- - name : Setup KVM
83
- shell : bash
82
+ - name : Enable KVM
84
83
run : |
85
- # check if virtualization is supported...
86
- sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
87
- # allow access to KVM to run the emulator
88
- echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
89
- | sudo tee /etc/udev/rules.d/99-kvm4all.rules
84
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
90
85
sudo udevadm control --reload-rules
91
86
sudo udevadm trigger --name-match=kvm
92
87
88
+ - name : AVD cache
89
+ uses : actions/cache@v4
90
+ id : avd-cache
91
+ with :
92
+ path : |
93
+ ~/.android/avd/*
94
+ ~/.android/adb*
95
+ key : avd-api-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }}
96
+
97
+ - name : Create AVD and generate snapshot for caching
98
+ if : steps.avd-cache.outputs.cache-hit != 'true'
99
+ uses : reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # pin@v2
100
+ with :
101
+ api-level : ${{ matrix.api-level }}
102
+ target : ${{ matrix.target }}
103
+ channel : ${{ matrix.channel }}
104
+ arch : ${{ matrix.arch }}
105
+ force-avd-creation : false
106
+ disable-animations : true
107
+ disable-spellchecker : true
108
+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
109
+ disk-size : 4096M
110
+ script : echo "Generated AVD snapshot for caching."
111
+
93
112
- name : Download APK artifact
94
113
uses : actions/download-artifact@v5
95
114
with :
@@ -104,21 +123,13 @@ jobs:
104
123
uses :
reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # [email protected]
105
124
with :
106
125
api-level : ${{ matrix.api-level }}
107
- force-avd-creation : false
108
- disable-animations : true
109
- disable-spellchecker : true
110
126
target : ${{ matrix.target }}
111
127
channel : ${{ matrix.channel }}
112
128
arch : ${{ matrix.arch }}
113
- emulator-options : >
114
- -no-window
115
- -no-snapshot-save
116
- -gpu swiftshader_indirect
117
- -noaudio
118
- -no-boot-anim
119
- -camera-back none
120
- -camera-front none
121
- -timezone US/Pacific
129
+ force-avd-creation : false
130
+ disable-animations : true
131
+ disable-spellchecker : true
132
+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-save
122
133
script : |
123
134
adb install -r -d "${{env.APK_NAME}}"
124
135
maestro test "${{env.BASE_PATH}}/maestro" --debug-output "${{env.BASE_PATH}}/maestro-logs"
0 commit comments