Skip to content

Commit a9e6003

Browse files
committed
chore: print Device Farm test spec logs
1 parent a4efe21 commit a9e6003

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

.github/actions/collect-devicefarm-results/action.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ outputs:
2525
customer-artifacts-log-file:
2626
description: Copied Device Farm customer artifacts log file path
2727
value: ${{ steps.find-customer-artifacts-log.outputs.log_file }}
28+
test-spec-output-file:
29+
description: Copied Device Farm test spec output log file path
30+
value: ${{ steps.find-test-spec-output.outputs.log_file }}
31+
test-spec-timestamped-output-file:
32+
description: Copied Device Farm timestamped test spec output log file path
33+
value: ${{ steps.find-test-spec-timestamped-output.outputs.log_file }}
2834

2935
runs:
3036
using: composite
@@ -91,6 +97,40 @@ runs:
9197
echo "log_file=" >> "$GITHUB_OUTPUT"
9298
fi
9399
100+
- name: Find Device Farm test spec output
101+
id: find-test-spec-output
102+
shell: bash
103+
run: |
104+
set -euo pipefail
105+
ARTIFACT_DIR="${{ inputs.artifact-folder }}"
106+
PLATFORM="${{ inputs.platform }}"
107+
WORKSPACE_LOG=".github/test-results/devicefarm-test-spec-output-${PLATFORM}.log"
108+
if bash "$GITHUB_ACTION_PATH/../../scripts/find-devicefarm-artifact.sh" \
109+
"$ARTIFACT_DIR" \
110+
'*-Test spec output.txt' \
111+
"$WORKSPACE_LOG"; then
112+
echo "log_file=$WORKSPACE_LOG" >> "$GITHUB_OUTPUT"
113+
else
114+
echo "log_file=" >> "$GITHUB_OUTPUT"
115+
fi
116+
117+
- name: Find Device Farm timestamped test spec output
118+
id: find-test-spec-timestamped-output
119+
shell: bash
120+
run: |
121+
set -euo pipefail
122+
ARTIFACT_DIR="${{ inputs.artifact-folder }}"
123+
PLATFORM="${{ inputs.platform }}"
124+
WORKSPACE_LOG=".github/test-results/devicefarm-test-spec-timestamped-output-${PLATFORM}.log"
125+
if bash "$GITHUB_ACTION_PATH/../../scripts/find-devicefarm-artifact.sh" \
126+
"$ARTIFACT_DIR" \
127+
'*-Test spec timestamped output.txt' \
128+
"$WORKSPACE_LOG"; then
129+
echo "log_file=$WORKSPACE_LOG" >> "$GITHUB_OUTPUT"
130+
else
131+
echo "log_file=" >> "$GITHUB_OUTPUT"
132+
fi
133+
94134
- name: Publish Harness test results
95135
id: publish-harness-results
96136
if: steps.find-harness-junit.outputs.junit_file != ''
@@ -131,6 +171,20 @@ runs:
131171
echo "===== End Device Farm ${PLATFORM} customer artifacts log ====="
132172
fi
133173
174+
TEST_SPEC_OUTPUT="${{ steps.find-test-spec-output.outputs.log_file }}"
175+
if [[ -n "$TEST_SPEC_OUTPUT" && "$TEST_STEP_OUTCOME" == "failure" ]]; then
176+
echo "===== Device Farm ${PLATFORM} test spec output ====="
177+
cat "$TEST_SPEC_OUTPUT"
178+
echo "===== End Device Farm ${PLATFORM} test spec output ====="
179+
fi
180+
181+
TEST_SPEC_TIMESTAMPED_OUTPUT="${{ steps.find-test-spec-timestamped-output.outputs.log_file }}"
182+
if [[ -n "$TEST_SPEC_TIMESTAMPED_OUTPUT" && "$TEST_STEP_OUTCOME" == "failure" ]]; then
183+
echo "===== Device Farm ${PLATFORM} timestamped test spec output ====="
184+
cat "$TEST_SPEC_TIMESTAMPED_OUTPUT"
185+
echo "===== End Device Farm ${PLATFORM} timestamped test spec output ====="
186+
fi
187+
134188
if [[ "$PUBLISH_OUTCOME" == "failure" ]]; then
135189
echo "Harness test result publication reported failures." >&2
136190
exit 1

.github/workflows/harness-aws-device.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ on:
3535
- main
3636
paths:
3737
- ".github/workflows/harness-aws-device.yml"
38+
- ".github/actions/collect-devicefarm-results/**"
3839
- ".github/actions/upload-devicefarm-artifact/**"
40+
- ".github/scripts/find-devicefarm-artifact.sh"
3941
- "apps/simple-camera/**"
4042
- "packages/react-native-vision-camera/**"
4143
- "packages/react-native-vision-camera-barcode-scanner/**"
@@ -48,7 +50,9 @@ on:
4850
pull_request:
4951
paths:
5052
- ".github/workflows/harness-aws-device.yml"
53+
- ".github/actions/collect-devicefarm-results/**"
5154
- ".github/actions/upload-devicefarm-artifact/**"
55+
- ".github/scripts/find-devicefarm-artifact.sh"
5256
- "apps/simple-camera/**"
5357
- "packages/react-native-vision-camera/**"
5458
- "packages/react-native-vision-camera-barcode-scanner/**"
@@ -118,7 +122,9 @@ jobs:
118122
- '!packages/**/*.@(swift|mm)'
119123
- 'patches/**'
120124
- '.github/workflows/harness-aws-device.yml'
125+
- '.github/actions/collect-devicefarm-results/**'
121126
- '.github/actions/upload-devicefarm-artifact/**'
127+
- '.github/scripts/find-devicefarm-artifact.sh'
122128
- 'bun.lock'
123129
- 'package.json'
124130

0 commit comments

Comments
 (0)