Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 3dca680

Browse files
committed
Upload logs for NavigationAdvancedSample
1 parent e7acb2a commit 3dca680

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/NavigationAdvancedSample.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,19 @@ jobs:
5050

5151
- name: Run instrumentation tests
5252
uses: reactivecircus/android-emulator-runner@v2
53+
continue-on-error: true # IMPORTANT: allow pipeline to continue to Android Test Report step
5354
with:
5455
api-level: 26
5556
arch: x86
5657
profile: Nexus 6
5758
disable-animations: true
58-
script: ./gradlew connectedCheck --stacktrace
5959
working-directory: ${{ env.SAMPLE_PATH }}
60+
script: |
61+
adb logcat -c # clear logs
62+
touch app/emulator.log # create log file
63+
chmod 777 app/emulator.log # allow writing to log file
64+
adb logcat >> app/emulator.log & # pipe all logcat messages into log file as a background process
65+
./gradlew connectedCheck # here run your tests
6066
6167
- name: Upload build outputs (APKs)
6268
uses: actions/upload-artifact@v3
@@ -70,3 +76,14 @@ jobs:
7076
with:
7177
name: build-reports-NavigationAdvancedSample
7278
path: ${{ env.SAMPLE_PATH }}/app/build/reports
79+
80+
- name: Upload Failing Test Report Log
81+
if: steps.testing.outcome != 'success' # upload the generated log on failure of the tests job
82+
uses: actions/upload-artifact@v2
83+
with:
84+
name: logs
85+
path: app/emulator.log # path to where the log is
86+
87+
- name: Raise error on test fail # set a red tick on the workflow run if the tests failed
88+
if: steps.testing.outcome != 'success'
89+
run: exit 1

0 commit comments

Comments
 (0)