|
|
@ -309,7 +309,7 @@ jobs:
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build projects and run instrumented screenshot tests
|
|
|
|
- name: Build projects and run instrumented screenshot tests
|
|
|
|
id: dropshotsverify
|
|
|
|
id: dropshotsverify
|
|
|
|
continue-on-error: false
|
|
|
|
continue-on-error: true
|
|
|
|
uses: reactivecircus/android-emulator-runner@v2
|
|
|
|
uses: reactivecircus/android-emulator-runner@v2
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
api-level: ${{ matrix.api-level }}
|
|
|
|
api-level: ${{ matrix.api-level }}
|
|
|
@ -324,7 +324,7 @@ jobs:
|
|
|
|
# Run tests, if they fail, record screenshots and exit with a failure
|
|
|
|
# Run tests, if they fail, record screenshots and exit with a failure
|
|
|
|
#TODO: Split the script in multiple lines (note that the action does some parsing that breaks multiline)
|
|
|
|
#TODO: Split the script in multiple lines (note that the action does some parsing that breaks multiline)
|
|
|
|
script:
|
|
|
|
script:
|
|
|
|
set +e ; if ./gradlew :app:connectedDemoDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.google.samples.apps.nowinandroid.ui.InstrumentedScreenshotTests -i --daemon ; then echo "All screenshot tests passed" ; else echo "Recording new goldens" ; ./gradlew :app:connectedDemoDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.google.samples.apps.nowinandroid.ui.InstrumentedScreenshotTests -Pdropshots.record --daemon -i --stacktrace && echo "newgoldens=true" >> $GITHUB_OUTPUT ; fi
|
|
|
|
./gradlew :app:connectedDemoDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.google.samples.apps.nowinandroid.ui.InstrumentedScreenshotTests -i --daemon
|
|
|
|
|
|
|
|
|
|
|
|
- name: Prevent pushing new screenshots if this is a fork
|
|
|
|
- name: Prevent pushing new screenshots if this is a fork
|
|
|
|
id: checkfork_screenshots_instrumented
|
|
|
|
id: checkfork_screenshots_instrumented
|
|
|
@ -333,15 +333,35 @@ jobs:
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
echo "::error::Instrumented screenshot tests failed, please create a PR in your fork first." && exit 1
|
|
|
|
echo "::error::Instrumented screenshot tests failed, please create a PR in your fork first." && exit 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Record new screenshots if verification failed
|
|
|
|
|
|
|
|
id: dropshotsverify
|
|
|
|
|
|
|
|
continue-on-error: false
|
|
|
|
|
|
|
|
if: steps.dropshotsverify.outcome == 'failure'
|
|
|
|
|
|
|
|
uses: reactivecircus/android-emulator-runner@v2
|
|
|
|
|
|
|
|
with:
|
|
|
|
|
|
|
|
api-level: ${{ matrix.api-level }}
|
|
|
|
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
|
|
|
|
arch: x86_64
|
|
|
|
|
|
|
|
disable-animations: true
|
|
|
|
|
|
|
|
disk-size: 6000M
|
|
|
|
|
|
|
|
emulator-build: 11834374 # 34.2.14
|
|
|
|
|
|
|
|
heap-size: 600M
|
|
|
|
|
|
|
|
profile: ${{ matrix.profile }}
|
|
|
|
|
|
|
|
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
|
|
|
|
|
|
|
# Run tests, if they fail, record screenshots and exit with a failure
|
|
|
|
|
|
|
|
#TODO: Split the script in multiple lines (note that the action does some parsing that breaks multiline)
|
|
|
|
|
|
|
|
script:
|
|
|
|
|
|
|
|
./gradlew :app:connectedDemoDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.google.samples.apps.nowinandroid.ui.InstrumentedScreenshotTests -Pdropshots.record --daemon -i --stacktrace
|
|
|
|
|
|
|
|
|
|
|
|
- name: Checkout new changes (in case another job already uploaded screenshots)
|
|
|
|
- name: Checkout new changes (in case another job already uploaded screenshots)
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
if: steps.dropshotsverify.outputs.newgoldens == 'true'
|
|
|
|
# if: steps.dropshotsverify.outputs.newgoldens == 'true'
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
clean: false
|
|
|
|
clean: false
|
|
|
|
|
|
|
|
|
|
|
|
- name: Push new device screenshots if available
|
|
|
|
- name: Push new device screenshots if available
|
|
|
|
uses: stefanzweifel/git-auto-commit-action@4b8a201e31cadd9829df349894b28c54e6c19fe6
|
|
|
|
uses: stefanzweifel/git-auto-commit-action@4b8a201e31cadd9829df349894b28c54e6c19fe6
|
|
|
|
if: steps.dropshotsverify.outputs.newgoldens == 'true'
|
|
|
|
# if: steps.dropshotsverify.outputs.newgoldens == 'true'
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
file_pattern: 'app/src/androidTest/screenshots/*.png'
|
|
|
|
file_pattern: 'app/src/androidTest/screenshots/*.png'
|
|
|
|
disable_globbing: true
|
|
|
|
disable_globbing: true
|
|
|
|