91
91
~/.android/adb*
92
92
key : avd-${{ matrix.api-level }}
93
93
94
+ - name : Prepare script to run
95
+ id : script
96
+ env :
97
+ SCRIPT : |
98
+ # Workaround for https://github.com/ReactiveCircus/android-emulator-runner/issues/373
99
+ pre_terminate_crashpad() {
100
+ # For some reason pgrep/pkill sees only crashpad_handle, not crashpad_handler,
101
+ # but it's definitely called ${ANDROID_HOME}/emulator/crashpad_handler.
102
+
103
+ # Best-effort gracefully terminate all crashpad_handler processes.
104
+ pkill --exact --echo --signal SIGTERM crashpad_handle || return
105
+ sleep 10
106
+ pkill --exact --echo --signal SIGKILL crashpad_handle || return
107
+ }
108
+ trap pre_terminate_crashpad EXIT
109
+
110
+ ${{ inputs.script }}
111
+ run : |
112
+ script_file="${RUNNER_TEMP}/reactivecircus-android-emulator-runner-prepared-script.sh"
113
+ echo "${SCRIPT}" > "${script_file}"
114
+ echo "file=${script_file}" >> "${GITHUB_OUTPUT}"
115
+
94
116
- name : Create AVD and generate snapshot for caching
95
117
if : steps.avd-cache.outputs.cache-hit != 'true'
96
118
uses : reactivecircus/android-emulator-runner@v2
@@ -108,7 +130,11 @@ jobs:
108
130
force-avd-creation : false
109
131
emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
110
132
disable-animations : true
111
- script : ./gradlew connectedCheck --no-daemon --stacktrace
133
+ script : |
134
+ adb devices -l
135
+ bash --noprofile --norc -eo pipefail "${{ steps.script.outputs.file }}"
136
+ ./gradlew connectedCheck --no-daemon --stacktrace
137
+
112
138
113
139
- name : Start emulator and run UI Tests w/ KSP
114
140
uses : reactivecircus/android-emulator-runner@v2
@@ -117,7 +143,10 @@ jobs:
117
143
force-avd-creation : false
118
144
emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
119
145
disable-animations : true
120
- script : ./gradlew connectedCheck --no-daemon --stacktrace -PuseKsp=true
146
+ script : |
147
+ adb devices -l
148
+ bash --noprofile --norc -eo pipefail "${{ steps.script.outputs.file }}"
149
+ ./gradlew connectedCheck --no-daemon --stacktrace -PuseKsp=true
121
150
122
151
- name : Run Screenshot Tests
123
152
uses : reactivecircus/android-emulator-runner@v2
0 commit comments