@@ -282,16 +282,9 @@ runs:
282282 PRE_RUN_HOOK : ${{ inputs.preRunHook }}
283283 AFTER_RUN_HOOK : ${{ inputs.afterRunHook }}
284284 HARNESS_RUNNER : ${{ inputs.runner }}
285- with :
286- working-directory : ${{ steps.load-config.outputs.projectRoot }}
287- api-level : ${{ fromJson(steps.load-config.outputs.config).config.device.avd.apiLevel }}
288- arch : ${{ steps.arch.outputs.arch }}
289- force-avd-creation : false
290- avd-name : ${{ fromJson(steps.load-config.outputs.config).config.device.name }}
291- disable-animations : true
292- emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
293- script : >-
294- bash -lc '
285+ # android-emulator-runner executes each script line via `sh -c`, so multi-line
286+ # shell control flow must live in a separate bash script instead of `with.script`.
287+ HARNESS_ANDROID_SESSION_SCRIPT : |-
295288 export HARNESS_PROJECT_ROOT="$PWD"
296289
297290 adb install -r "${{ inputs.app }}"
@@ -330,7 +323,18 @@ runs:
330323 if [ "$after_run_exit_code" -ne 0 ]; then
331324 exit "$after_run_exit_code"
332325 fi
333- '
326+ with :
327+ working-directory : ${{ steps.load-config.outputs.projectRoot }}
328+ api-level : ${{ fromJson(steps.load-config.outputs.config).config.device.avd.apiLevel }}
329+ arch : ${{ steps.arch.outputs.arch }}
330+ force-avd-creation : false
331+ avd-name : ${{ fromJson(steps.load-config.outputs.config).config.device.name }}
332+ disable-animations : true
333+ emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
334+ # Keep `script` to a single line so the emulator action does not split our bash
335+ # session apart before the hooks and Harness command run.
336+ script : >-
337+ harness_script_file="$(mktemp "${RUNNER_TEMP:-/tmp}/harness-android-run.XXXXXX.sh")"; printf '%s\n' "$HARNESS_ANDROID_SESSION_SCRIPT" > "$harness_script_file"; chmod +x "$harness_script_file"; bash "$harness_script_file"; status=$?; rm -f "$harness_script_file"; exit "$status"
334338 - name : Upload visual test artifacts
335339 if : always() && inputs.uploadVisualTestArtifacts == 'true'
336340 uses : actions/upload-artifact@v4
0 commit comments