Skip to content

Commit c10e060

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 d7191d9 commit c10e060

File tree

2 files changed

+53
-14
lines changed

2 files changed

+53
-14
lines changed

Diff for: .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
@@ -55,23 +59,40 @@ jobs:
5559
name: ${{ env.CORE_ARTIFACT }}
5660
path: ${{ env.CORE_ARTIFACT }}.tar.bz2
5761

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

Diff for: 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)