Skip to content

Commit 18f027a

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 c10e060 commit 18f027a

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

.github/workflows/package_core.yml

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

0 commit comments

Comments
 (0)