Skip to content

Commit 8183c5e

Browse files
committed
github: create matrix build to test Blink on all variants
Convert the single test "Blink on giga" to a matrix build so that every variant of the core is tested with Blink.
1 parent 5b68378 commit 8183c5e

File tree

2 files changed

+53
-14
lines changed

2 files changed

+53
-14
lines changed

.github/workflows/package_core.yml

+30-9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ jobs:
1414
env:
1515
ZEPHYR_SDK_INSTALL_DIR: /opt/zephyr-sdk-0.16.8
1616
CCACHE_IGNOREOPTIONS: -specs=*
17+
outputs:
18+
CORE_TAG: ${{ env.CORE_TAG }}
19+
CORE_ARTIFACT: ${{ env.CORE_ARTIFACT }}
20+
BOARD_NAMES: ${{ env.BOARD_NAMES }}
1721
steps:
1822
- name: Install toolchain
1923
working-directory: /opt
@@ -52,23 +56,40 @@ jobs:
5256
name: ${{ env.CORE_ARTIFACT }}
5357
path: ${{ env.CORE_ARTIFACT }}.tar.bz2
5458

59+
test-core:
60+
name: Test arduino:zephyr:${{ matrix.board }}
61+
runs-on: ubuntu-latest
62+
needs: package-core
63+
strategy:
64+
matrix:
65+
board: ${{ fromJSON( needs.package-core.outputs.BOARD_NAMES ) }}
66+
fail-fast: false
67+
env:
68+
FQBN: arduino:zephyr:${{ matrix.board }}
69+
steps:
70+
- uses: actions/download-artifact@v4
71+
with:
72+
name: ${{ needs.package-core.outputs.CORE_ARTIFACT }}
73+
74+
- name: Set up core
75+
run: |
76+
tar xf ${{ needs.package-core.outputs.CORE_ARTIFACT }}.tar.bz2
77+
5578
- name: Create Blink sketch
5679
run: |
57-
mkdir extra/Blink/
58-
wget https://raw.githubusercontent.com/arduino/arduino-examples/refs/heads/main/examples/01.Basics/Blink/Blink.ino
59-
mv Blink.ino extra/Blink/
80+
mkdir Blink/
81+
wget -nv https://raw.githubusercontent.com/arduino/arduino-examples/refs/heads/main/examples/01.Basics/Blink/Blink.ino -P Blink/
6082
61-
- name: Compile Blink
83+
- name: Compile Blink for ${{ env.FQBN }}
6284
uses: arduino/compile-sketches@main
6385
with:
64-
fqbn: arduino:zephyr:giga
86+
fqbn: ${{ env.FQBN }}
6587
platforms: |
6688
# Use Board Manager to install the latest release of Arduino Zephyr Boards to get the toolchain
6789
- name: "arduino:zephyr"
6890
source-url: "https://downloads.arduino.cc/packages/package_zephyr_index.json"
69-
- source-path: "./"
70-
name: "arduino:zephyr"
71-
sketch-paths: |
72-
extra/Blink
91+
- name: "arduino:zephyr"
92+
source-path: "ArduinoCore-zephyr"
93+
sketch-paths: Blink
7394
verbose: 'false'
7495
enable-deltas-report: 'false'

extra/build_all.sh

+23-5
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,38 @@ while getopts "hfl" opt; do
2020
esac
2121
done
2222

23+
if [ ! -z "$GITHUB_STEP_SUMMARY" ] ; then
24+
echo "### Variant build results:" >> "$GITHUB_STEP_SUMMARY"
25+
fi
26+
2327
jq -cr '.[]' < ./extra/targets.json | while read -r item; do
2428
board=$(jq -cr '.board // ""' <<< "$item")
2529
args=$(jq -cr '.args // ""' <<< "$item")
2630

2731
variant=$(extra/get_variant_name.sh "$board" || echo "$board")
28-
echo && echo
29-
echo ${variant}
30-
echo ${variant} | sed -e 's/./=/g'
32+
if [ -z "$GITHUB_STEP_SUMMARY" ] ; then
33+
echo && echo
34+
echo ${variant}
35+
echo ${variant} | sed -e 's/./=/g'
36+
else
37+
echo "::group::=== ${variant} ==="
38+
fi
3139

3240
./extra/build.sh "$board" $args
3341
result=$?
3442

35-
echo
36-
echo "${variant} result: $result"
43+
if [ -z "$GITHUB_STEP_SUMMARY" ] ; then
44+
echo
45+
echo "${variant} result: $result"
46+
else
47+
echo "::endgroup::"
48+
if [ $result -eq 0 ] ; then
49+
echo "- :white_check_mark: \`${variant}\`" >> "$GITHUB_STEP_SUMMARY"
50+
else
51+
echo "^^^$(echo ${variant} | sed -e 's/./^/g')^^ FAILED with $result!"
52+
echo "- :x: \`${variant}\`" >> "$GITHUB_STEP_SUMMARY"
53+
fi
54+
fi
3755
[ $result -ne 0 ] && ! $FORCE && exit $result
3856
done
3957

0 commit comments

Comments
 (0)