From ece23564cb262d32c55fd880b9e98eb807c02f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alc=C3=A9rreca?= Date: Mon, 27 May 2024 15:28:59 +0000 Subject: [PATCH] CI experiment Change-Id: I5f11e19f53c66d3dd546f935c9ba74014e0cb2f3 --- .github/workflows/Build.yaml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yaml index 8d148eff5..b6f427d3f 100644 --- a/.github/workflows/Build.yaml +++ b/.github/workflows/Build.yaml @@ -324,11 +324,18 @@ jobs: # Run tests, if they fail, record screenshots and exit with a failure script: > set +e ; - ./gradlew connectedDemoDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.google.samples.apps.nowinandroid.ui.InstrumentedScreenshotTests --daemon - || echo "Recording new screenshots" - ; ./gradlew connectedDemoDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.google.samples.apps.nowinandroid.ui.InstrumentedScreenshotTests -Pdropshots.record --daemon --stacktrace - ; echo "Done recording new screenshots, exiting with failure" - ; echo "newgoldens=true" >> $GITHUB_OUTPUT ; exit 5 + if ./gradlew connectedDemoDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.google.samples.apps.nowinandroid.ui.InstrumentedScreenshotTests --daemon ; then + echo "All screenshot tests passed" + else + echo "Verification failed. Recording new reference images" + if ./gradlew connectedDemoDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.google.samples.apps.nowinandroid.ui.InstrumentedScreenshotTests -Pdropshots.record --daemon --stacktrace ; then + echo "New goldens recorded, no issues" + ; echo "newgoldens=true" >> $GITHUB_OUTPUT + else + echo "Error while recording new goldens" + ; exit 5 + fi + fi - name: Prevent pushing new screenshots if this is a fork id: checkfork_screenshots_instrumented