Skip to content

Commit d4ee7ab

Browse files
committed
wip
1 parent 5a55b11 commit d4ee7ab

File tree

6 files changed

+145
-49
lines changed

6 files changed

+145
-49
lines changed

.github/workflows/package_core.yml

Lines changed: 15 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -204,31 +204,31 @@ jobs:
204204
tar xf ${CORE_ARTIFACT}.tar.bz2 # will create ArduinoCore-zephyr/
205205
echo "REPORT_FILE=$(echo ${FQBN} | tr ':' '-').json" >> $GITHUB_ENV
206206
207-
- name: Create Blink sketch
207+
- name: Get Blink sketch
208208
run: |
209209
mkdir Blink/
210210
wget -nv https://raw.githubusercontent.com/arduino/arduino-examples/refs/heads/main/examples/01.Basics/Blink/Blink.ino -P Blink/
211211
212-
- name: Compile Blink for ${{ matrix.board }}
213-
uses: pillo79/compile-sketches@main
212+
- name: Compile tests for ${{ matrix.board }}
213+
uses: pillo79/compile-sketches@next
214214
with:
215215
fqbn: ${{ env.FQBN }}
216216
platforms: |
217-
# Use Board Manager to install the latest release of Arduino Zephyr Boards to get the toolchain
218-
- name: "arduino:zephyr"
219-
source-url: "https://downloads.arduino.cc/packages/package_zephyr_index.json"
217+
# Use Board Manager version first, to install the toolchain
218+
- name: ${{ env.PLAT }}
220219
- name: ${{ env.PLAT }}
221220
source-path: "ArduinoCore-zephyr"
222-
sketch-paths: Blink
221+
sketch-paths: |
222+
- Blink
223+
- ArduinoCore-zephyr/libraries
223224
cli-compile-flags: |
224225
- '--build-property'
225226
- 'compiler.c.extra_flags=-Wno-type-limits -Wno-missing-field-initializers'
226227
- '--build-property'
227228
- 'compiler.cpp.extra_flags=-Wno-type-limits -Wno-missing-field-initializers'
228229
verbose: 'false'
229230
enable-deltas-report: 'false'
230-
enable-warnings-report: 'true'
231-
enable-warnings-log: 'true'
231+
enable-issues-report: 'true'
232232

233233
- name: Get job ID
234234
id: job_id
@@ -267,49 +267,18 @@ jobs:
267267
env:
268268
ALL_BOARD_DATA: ${{ needs.build-env.outputs.ALL_BOARD_DATA }}
269269
steps:
270+
- uses: actions/checkout@v4
271+
with:
272+
fetch-depth: 0
273+
persist-credentials: false
274+
270275
- uses: actions/download-artifact@v4
271276
with:
272277
path: .
273278
pattern: test-report-*
274279
merge-multiple: true
275280

276-
- run: |
277-
ARTIFACTS=$(jq -cr 'map(.artifact) | unique | .[]' <<< ${ALL_BOARD_DATA}) # this avoids the 'zephyr' artifact
278-
for artifact in $ARTIFACTS ; do
279-
echo "### \`$artifact\` test results:" >> "$GITHUB_STEP_SUMMARY"
280-
jq -c "map(select(.artifact == \"$artifact\")) | .[]" <<< ${ALL_BOARD_DATA} | while read -r BOARD_DATA; do
281-
BOARD=$(echo $BOARD_DATA | jq -cr '.board')
282-
VARIANT=$(echo $BOARD_DATA | jq -cr '.variant')
283-
SUBARCH=$(echo $BOARD_DATA | jq -cr '.subarch')
284-
FQBN="arduino:$SUBARCH:$BOARD"
285-
REPORT_FILE="$(echo $FQBN | tr ':' '-').json"
286-
if [ ! -f $REPORT_FILE ]; then
287-
echo "* :x: $BOARD (\`$VARIANT\`) - No report found?" >> "$GITHUB_STEP_SUMMARY"
288-
else
289-
REPORT=$(jq -cr '.boards[0].sketches[0]' $REPORT_FILE)
290-
JOB_ID=$(echo $REPORT | jq -cr '.job_id')
291-
JOB_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${JOB_ID}#step:5:2"
292-
if ! $(echo $REPORT | jq -cr '.compilation_success') ; then
293-
echo "* :x: [$BOARD]($JOB_URL) (\`$VARIANT\`) - Build failed" >> "$GITHUB_STEP_SUMMARY"
294-
else
295-
WARNINGS=$(echo $REPORT | jq -cr '.warnings.current.absolute // 0')
296-
if [ $WARNINGS -eq 0 ]; then
297-
echo "* :white_check_mark: $BOARD (\`$VARIANT\`) - Build successful" >> "$GITHUB_STEP_SUMMARY"
298-
else
299-
echo >> "$GITHUB_STEP_SUMMARY"
300-
echo "<details><summary>&nbsp;&nbsp; :warning: <a href=\"$JOB_URL\">$BOARD</a> (<tt>$VARIANT</tt>) - $WARNINGS warnings:</summary>" >> "$GITHUB_STEP_SUMMARY"
301-
echo >> "$GITHUB_STEP_SUMMARY"
302-
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
303-
echo $REPORT | jq -cr '.warnings_log[]' >> "$GITHUB_STEP_SUMMARY"
304-
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
305-
echo >> "$GITHUB_STEP_SUMMARY"
306-
echo "</details>" >> "$GITHUB_STEP_SUMMARY"
307-
echo >> "$GITHUB_STEP_SUMMARY"
308-
fi
309-
fi
310-
fi
311-
done
312-
done
281+
- run: extra/ci_collect_logs.sh > $GITHUB_STEP_SUMMARY
313282

314283
- name: Clean up intermediate artifacts
315284
uses: geekyeggo/[email protected]

extra/artifacts/zephyr_unoq.exc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
libraries/Ethernet/
2+
libraries/Storage/
3+
libraries/WiFi/
4+
libraries/Zephyr_SDRAM/

extra/artifacts/zephyr_unoq.only

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
libraries/Arduino_LED_Matrix/
2+
libraries/Arduino_RouterBridge/
3+
libraries/Arduino_RPClite/

extra/ci_collect_logs.sh

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Expectations:
6+
# - ALL_BOARD_DATA is set to a JSON array of objects with 'board', 'variant', 'subarch', and 'artifact' fields
7+
# - GITHUB_REPOSITORY and GITHUB_RUN_ID are set to identify the current GitHub Actions run
8+
# - Each report file is in the current directory, named as 'arduino-<subarch>-<board>.json', with ':' replaced by '-'
9+
10+
if [ -z "$ALL_BOARD_DATA" ] || [ -z "$GITHUB_REPOSITORY" ] || [ -z "$GITHUB_RUN_ID" ] ; then
11+
echo "Not in a Github CI run, cannot proceed."
12+
exit 0
13+
fi
14+
15+
artifact_count() {
16+
COUNT=$1
17+
ICON=$2
18+
if [ $COUNT -eq 0 ] ; then
19+
printf "<code> </code>:new_moon:"
20+
else:
21+
printf "<code>%3i</code>%s" $COUNT $ICON
22+
fi
23+
}
24+
25+
artifact_entry() {
26+
TEXT="$1"
27+
LINK="$2"
28+
29+
COUNTS="$(artifact_count $((SKETCH_COUNT - SKETCH_ERRORS)) ":green_circle:") $(artifact_count $SKETCH_WARNINGS ":yellow_circle:") <b>$(artifact_count $SKETCH_ERRORS ":red_circle:")</b>"
30+
SUMMARY="$COUNTS $TEXT $BOARD (<code>$VARIANT</code>)"
31+
if [ ! -z "$LINK" ] ; then
32+
SUMMARY="$SUMMARY - <a href=\"$LINK\">full build log</a>"
33+
fi
34+
echo -e "<li><details><summary>$SUMMARY</summary><table>$DETAILS</table></details></li>"
35+
}
36+
37+
details_line() {
38+
ICON="$1"
39+
TEXT="$2"
40+
if echo "$SKETCH_NAME" | grep -qE 'libraries/' ; then
41+
LIB=$(echo "$SKETCH_NAME" | sed -e 's/.*libraries\///' -e 's/\/.*//')
42+
SKETCH=$(echo "$SKETCH_NAME" | sed -e 's/.*libraries\/[^/]*\///')
43+
SUMMARY="<code>$LIB</code> <code>$SKETCH</code>"
44+
else
45+
SUMMARY="<code>$SKETCH_NAME</code>"
46+
fi
47+
if [ $SKETCH_ISSUES_COUNT -ne 0 ] ; then
48+
SUMMARY="$SUMMARY :small_red_triangle_down:"
49+
ICON="$SKETCH_ISSUES_COUNT $ICON"
50+
BODY="\n\n\`\`\`\n${SKETCH_ISSUES}\n\`\`\`\n"
51+
else
52+
SUMMARY="$SUMMARY :white_check_mark:"
53+
BODY=""
54+
fi
55+
echo -e "<tr><td align=right>$ICON</td><td><details><summary>$SUMMARY</summary>$BODY</details></td></tr>"
56+
}
57+
58+
ARTIFACTS=$(jq -cr 'map(.artifact) | unique | .[]' <<< ${ALL_BOARD_DATA}) # this avoids the 'zephyr' artifact
59+
for artifact in $ARTIFACTS ; do
60+
echo -e "### \`$artifact\` test results:\n"
61+
jq -c "map(select(.artifact == \"$artifact\")) | .[]" <<< ${ALL_BOARD_DATA} | while read -r BOARD_DATA; do
62+
BOARD=$(echo $BOARD_DATA | jq -cr '.board')
63+
VARIANT=$(echo $BOARD_DATA | jq -cr '.variant')
64+
SUBARCH=$(echo $BOARD_DATA | jq -cr '.subarch')
65+
FQBN="arduino:$SUBARCH:$BOARD"
66+
REPORT_FILE="$(echo $FQBN | tr ':' '-').json"
67+
68+
DETAILS=""
69+
ARTIFACT_LINK=""
70+
if [ ! -f $REPORT_FILE ]; then
71+
ARTIFACT_STATUS="fire"
72+
else
73+
REPORTS=$(jq -cr '.boards[0].sketches' $REPORT_FILE)
74+
JOB_ID=$(echo $REPORTS | jq -cr '.[0].job_id')
75+
ARTIFACT_LINK="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/job/${JOB_ID}#step:5"
76+
77+
SKETCH_COUNT=$(echo $REPORTS | jq -cr 'length')
78+
SKETCH_ERRORS=0
79+
SKETCH_WARNINGS=0
80+
ARTIFACT_STATUS=success
81+
for i in $(seq 0 $((SKETCH_COUNT - 1))) ; do
82+
REPORT=$(echo $REPORTS | jq -cr ".[$i]")
83+
SKETCH_NAME=$(echo $REPORT | jq -cr '.name')
84+
SKETCH_ISSUES=$(echo $REPORT | jq -cr '.issues.[]' | sed -e 's/.*\(\(\/[^/]\+\)\{3\}\):/...\1:/')
85+
SKETCH_ISSUES_COUNT=$(echo $REPORT | jq -cr '.issues | length')
86+
if ! $(echo $REPORT | jq -cr '.compilation_success') ; then
87+
SKETCH_ERRORS=$((SKETCH_ERRORS + 1))
88+
ARTIFACT_STATUS=error
89+
DETAILS="${DETAILS}$(details_line ":red_circle:" "Compilation failed")\n"
90+
elif [ $SKETCH_ISSUES_COUNT -eq 0 ]; then
91+
[ $ARTIFACT_STATUS == "success" ] && ARTIFACT_STATUS="warning"
92+
DETAILS="${DETAILS}$(details_line ":green_circle:" "Build successful")\n"
93+
else
94+
SKETCH_WARNINGS=$((SKETCH_WARNINGS + 1))
95+
DETAILS="${DETAILS}$(details_line ":yellow_circle:" "Build successful")\n"
96+
fi
97+
done
98+
fi
99+
100+
case $ARTIFACT_STATUS in
101+
success)
102+
artifact_entry "PASS :white_check_mark:"
103+
;;
104+
warning)
105+
artifact_entry "<b>WARN</> :exclamation:" "$ARTIFACT_LINK"
106+
;;
107+
error)
108+
artifact_entry "<b>FAIL</b> :x:" "$ARTIFACT_LINK"
109+
;;
110+
*)
111+
artifact_entry "<b>CI ISSUE</b> :fire:"
112+
;;
113+
esac
114+
done
115+
echo -e "</ul>\n"
116+
done

extra/package_core.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ cat platform.txt > ${TEMP_PLATFORM}
5959
sed -ie "s/^version=.*/version=$(extra/get_core_version.sh)/" ${TEMP_PLATFORM}
6060

6161
declutter_file() {
62-
# remove comments and empty lines
62+
# remove comments, whitespace at EOL, '/' dir terminators and empty lines
6363
[ -f "$1" ] || return 0
64-
cat "$1" | sed -e 's/\s*#.*//' | grep -v '^\s*$'
64+
cat "$1" | sed -e 's/\s*#.*//' -e 's/\s*$//' -e 's/\/$//' | grep -v '^\s*$'
6565
}
6666

6767
# create the list of files and directories to include
@@ -70,6 +70,7 @@ echo ${TEMP_BOARDS} >> ${TEMP_INC}
7070
echo ${TEMP_PLATFORM} >> ${TEMP_INC}
7171
declutter_file extra/artifacts/_common.inc >> ${TEMP_INC}
7272
declutter_file extra/artifacts/$ARTIFACT.inc >> ${TEMP_INC}
73+
declutter_file extra/artifacts/$ARTIFACT.only >> ${TEMP_INC}
7374
for variant in $INCLUDED_VARIANTS ; do
7475
echo "- ${variant}"
7576
echo "variants/${variant}/" >> ${TEMP_INC}
@@ -84,6 +85,9 @@ done
8485
TEMP_EXC=$(mktemp -p . | sed 's/\.\///')
8586
declutter_file extra/artifacts/_common.exc >> ${TEMP_EXC}
8687
declutter_file extra/artifacts/$ARTIFACT.exc >> ${TEMP_EXC}
88+
for f in $(ls extra/artifacts/*.only | grep -v "$ARTIFACT.only") ; do
89+
declutter_file $f >> ${TEMP_EXC}
90+
done
8791

8892
mkdir -p $(dirname ${OUTPUT_FILE})
8993
tar -cjhf ${OUTPUT_FILE} -X ${TEMP_EXC} -T ${TEMP_INC} \

libraries/Arduino_LED_Matrix/library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ paragraph=This library provides a simple interface for controlling the LED matri
77
category=Communication
88
url=https://www.arduino.cc/
99
architectures=*
10-
depends=
10+
depends=ArduinoGraphics

0 commit comments

Comments
 (0)