Skip to content

Commit ade55b9

Browse files
committed
github: collect test warnings
Collect all warning messages from the build run and add them to the CI run summary.
1 parent ae37540 commit ade55b9

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

Diff for: .github/workflows/package_core.yml

+56-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
wget -nv https://raw.githubusercontent.com/arduino/arduino-examples/refs/heads/main/examples/01.Basics/Blink/Blink.ino -P Blink/
8282
8383
- name: Compile Blink for ${{ env.FQBN }}
84-
uses: arduino/compile-sketches@main
84+
uses: pillo79/compile-sketches@main
8585
with:
8686
fqbn: ${{ env.FQBN }}
8787
platforms: |
@@ -93,3 +93,58 @@ jobs:
9393
sketch-paths: Blink
9494
verbose: 'false'
9595
enable-deltas-report: 'false'
96+
enable-warnings-report: 'true'
97+
enable-warnings-log: 'true'
98+
99+
- name: Clean up log
100+
run: |
101+
sed -i -e 's!/home/runner/.arduino15/packages/arduino/hardware/zephyr/[^/]*/!!g' sketches-reports/*
102+
103+
- uses: actions/upload-artifact@v4
104+
with:
105+
name: test-report-${{ needs.package-core.outputs.CORE_TAG }}-${{ matrix.board }}
106+
path: sketches-reports/*
107+
108+
collect-logs:
109+
name: Test summary
110+
runs-on: ubuntu-latest
111+
needs:
112+
- package-core
113+
- test-core
114+
if: ${{ !cancelled() && needs.package-core.result == 'success' }}
115+
env:
116+
BOARD_NAMES: ${{ needs.package-core.outputs.BOARD_NAMES }}
117+
steps:
118+
- uses: actions/download-artifact@v4
119+
with:
120+
path: .
121+
pattern: test-report-*
122+
merge-multiple: true
123+
124+
- run: |
125+
echo "### Core test results" >> "$GITHUB_STEP_SUMMARY"
126+
for BOARD in $(echo $BOARD_NAMES | jq -cr '.[]'); do
127+
FQBN="arduino:zephyr:$BOARD"
128+
REPORT_FILE="arduino-zephyr-$BOARD.json"
129+
if [ ! -f $REPORT_FILE ]; then
130+
echo ":x: $BOARD - No report found?" >> "$GITHUB_STEP_SUMMARY"
131+
else
132+
REPORT=$(jq -cr '.boards[0].sketches[0]' $REPORT_FILE)
133+
if ! $(echo $REPORT | jq -cr '.compilation_success') ; then
134+
echo ":x: $BOARD - **Build failed**" >> "$GITHUB_STEP_SUMMARY"
135+
else
136+
WARNINGS=$(echo $REPORT | jq -cr '.warnings.current.absolute // 0')
137+
if [ $WARNINGS -eq 0 ]; then
138+
echo ":white_check_mark: $BOARD - Build successful" >> "$GITHUB_STEP_SUMMARY"
139+
else
140+
echo "<details><summary>:warning: $BOARD - $WARNINGS Warnings:</summary>" >> "$GITHUB_STEP_SUMMARY"
141+
echo >> "$GITHUB_STEP_SUMMARY"
142+
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
143+
echo $REPORT | jq -cr '.warnings_log[]' >> "$GITHUB_STEP_SUMMARY"
144+
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
145+
echo >> "$GITHUB_STEP_SUMMARY"
146+
echo "</details>" >> "$GITHUB_STEP_SUMMARY"
147+
fi
148+
fi
149+
fi
150+
done

0 commit comments

Comments
 (0)