Problems running emulators twice

Change-Id: Ib4437cdd3fe34b8fadf57b545eb31c6fd1f82612
ben/dropshots
Jose Alcérreca 7 months ago
parent 3979fc7097
commit 7521fffdb8

@ -201,31 +201,8 @@ jobs:
heap-size: 600M
profile: pixel_5
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: ./gradlew connectedDemoDebugAndroidTest --daemon
# Workaround for https://github.com/ReactiveCircus/android-emulator-runner/issues/391
# From https://github.com/TWiStErRob/github-workflows/blob/main/.github/workflows/instrumentation.yml
- name: "Workaround for emulator bug."
id: script
env:
SCRIPT: |
# Workaround for https://github.com/ReactiveCircus/android-emulator-runner/issues/373
pre_terminate_crashpad() {
# For some reason pgrep/pkill sees only crashpad_handle, not crashpad_handler,
# but it's definitely called ${ANDROID_HOME}/emulator/crashpad_handler.
# Best-effort gracefully terminate all crashpad_handler processes.
pkill --exact --echo --signal SIGTERM crashpad_handle || return
sleep 10
pkill --exact --echo --signal SIGKILL crashpad_handle || return
}
trap pre_terminate_crashpad EXIT
${{ inputs.script }}
run: |
script_file="${RUNNER_TEMP}/reactivecircus-android-emulator-runner-prepared-script.sh"
echo "${SCRIPT}" > "${script_file}"
echo "file=${script_file}" >> "${GITHUB_OUTPUT}"
# Run tests, if they fail, record screenshots and exit with a failure
script: ./gradlew connectedDemoDebugAndroidTest --daemon || echo "Recording new screenshots" ; ./gradlew connectedDemoDebugAndroidTest -Pdropshots.record --stacktrace
- name: Prevent pushing new screenshots if this is a fork (instrumented)
id: checkfork_screenshots_instrumented
@ -234,27 +211,27 @@ jobs:
run: |
echo "::error::Instrumented screenshot tests failed, please create a PR in your fork first." && exit 1
- name: Record new instrumented screenshots
id: screenshotsrecordinstrumented
if: steps.dropshotsverify.outcome == 'failure' && github.event_name == 'pull_request'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
disable-animations: true
disk-size: 6000M
heap-size: 600M
profile: pixel_5
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: adb shell rm -rf /storage/emulated/0/Download/screenshots && ./gradlew connectedDemoDebugAndroidTest -Pdropshots.record --stacktrace
#
# - name: Record new instrumented screenshots
# id: screenshotsrecordinstrumented
# if: steps.dropshotsverify.outcome == 'failure' && github.event_name == 'pull_request'
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: ${{ matrix.api-level }}
# arch: x86_64
# disable-animations: true
# disk-size: 6000M
# heap-size: 600M
# profile: pixel_5
# force-avd-creation: false
# emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# script: adb shell rm -rf /storage/emulated/0/Download/screenshots && ./gradlew connectedDemoDebugAndroidTest -Pdropshots.record --stacktrace
- name: Push new device screenshots if available
uses: stefanzweifel/git-auto-commit-action@4b8a201e31cadd9829df349894b28c54e6c19fe6
if: steps.screenshotsrecordinstrumented.outcome == 'success'
if: steps.dropshotsverify.outcome == 'failure'
with:
file_pattern: '*/*.png'
file_pattern: 'app/src/androidTest/screenshots/*.png'
disable_globbing: true
commit_message: "🤖 Updates instrumented screenshots"

Loading…
Cancel
Save