From db4d53ad3c8bbddcfff17f601d25463068c6b441 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Tue, 9 Jun 2020 10:34:47 +0100 Subject: [PATCH 1/2] #2131 PR instrumentation tests can fail silently - return error codes -update nightly to have latest emulator runner and screenshots on failure --- .github/workflows/nightly.yml | 11 +++++++++-- contrib/instrumentation.sh | 4 ++-- contrib/instrumentation_nightly.sh | 7 +++++++ 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 contrib/instrumentation_nightly.sh diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 329ed0246..567e35c5a 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -21,11 +21,18 @@ jobs: fetch-depth: 1 - name: run instrumentation tests - uses: reactivecircus/android-emulator-runner@v2.0.0 + uses: ReactiveCircus/android-emulator-runner@v2.8.0 with: api-level: ${{ matrix.api-level }} arch: x86_64 - script: ./gradlew connectedDebugAndroidTest + script: bash contrib/instrumentation_nightly.sh + + - name: Upload screenshot result + uses: actions/upload-artifact@v1 + if: failure() + with: + name: ${{ matrix.api-level }} + path: screencap.png unit_test_and_release: runs-on: ubuntu-latest diff --git a/contrib/instrumentation.sh b/contrib/instrumentation.sh index fc69c536f..03db54ff3 100644 --- a/contrib/instrumentation.sh +++ b/contrib/instrumentation.sh @@ -2,6 +2,6 @@ adb logcat -c adb logcat *:E -v color & -./gradlew jacocoInstrumentationTestReport +./gradlew jacocoInstrumentationTestReport; gradlew_return_code=$? adb exec-out screencap -p > screencap.png -find screencap.png +gradlew_return_code diff --git a/contrib/instrumentation_nightly.sh b/contrib/instrumentation_nightly.sh new file mode 100644 index 000000000..66c4cbbc6 --- /dev/null +++ b/contrib/instrumentation_nightly.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +adb logcat -c +adb logcat *:E -v color & +./gradlew connectedDebugAndroidTest; gradlew_return_code=$? +adb exec-out screencap -p >screencap.png +gradlew_return_code From 0fbb94272d77d69b15bbdfbf70459bda398960b8 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Tue, 9 Jun 2020 11:24:41 +0100 Subject: [PATCH 2/2] #2131 PR instrumentation tests can fail silently - bash was returning error even on success --- contrib/instrumentation.sh | 9 ++++++--- contrib/instrumentation_nightly.sh | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/contrib/instrumentation.sh b/contrib/instrumentation.sh index 03db54ff3..3812b7612 100644 --- a/contrib/instrumentation.sh +++ b/contrib/instrumentation.sh @@ -2,6 +2,9 @@ adb logcat -c adb logcat *:E -v color & -./gradlew jacocoInstrumentationTestReport; gradlew_return_code=$? -adb exec-out screencap -p > screencap.png -gradlew_return_code +if ./gradlew jacocoInstrumentationTestReport; then + echo "jacocoInstrumentationTestReport succeeded" >&2 +else + adb exec-out screencap -p >screencap.png + echo "jacocoInstrumentationTestReport failed" >&2 +fi diff --git a/contrib/instrumentation_nightly.sh b/contrib/instrumentation_nightly.sh index 66c4cbbc6..8b2552f00 100644 --- a/contrib/instrumentation_nightly.sh +++ b/contrib/instrumentation_nightly.sh @@ -2,6 +2,9 @@ adb logcat -c adb logcat *:E -v color & -./gradlew connectedDebugAndroidTest; gradlew_return_code=$? -adb exec-out screencap -p >screencap.png -gradlew_return_code +if ./gradlew connectedDebugAndroidTest; then + echo "connectedDebugAndroidTest succeeded" >&2 +else + adb exec-out screencap -p >screencap.png + echo "connectedDebugAndroidTest failed" >&2 +fi