Skip to content

Commit 5a55b11

Browse files
committed
ci/package_core: proceed with testing as much as possible
These changes allow the packaging and testing jobs to start even if some of the build jobs have resulted in errors, thus maximizing the amount of testing that can be performed in parallel CI workflows even if one board is causing issues. The build step artifacts will be saved with a "failed-" prefix in case of errors and can be inspected for further information. Signed-off-by: Luca Burelli <[email protected]>
1 parent 0ccd765 commit 5a55b11

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

.github/workflows/package_core.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,29 @@ jobs:
9090
- name: Build loader
9191
shell: bash
9292
run: |
93-
./extra/build.sh ${{ matrix.board }}
93+
if ! ./extra/build.sh ${{ matrix.board }} 2> >(tee error.log) ; then
94+
echo "### :x: ${{ matrix.board }} (\`${{ matrix.variant }}\`) build errors" > $GITHUB_STEP_SUMMARY
95+
echo >> $GITHUB_STEP_SUMMARY
96+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
97+
cat error.log >> $GITHUB_STEP_SUMMARY
98+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
99+
exit 1
100+
fi
94101
95102
- name: Package board binaries
103+
if: ${{ !cancelled() }}
96104
run: |
97-
tar chf - firmwares/*${{ matrix.variant }}* variants/${{ matrix.variant }}/ | zstd > ${OUTPUT_ARTIFACT}.tar.zstd
105+
tar chf - \
106+
firmwares/*${{ matrix.variant }}* \
107+
variants/${{ matrix.variant }}/ \
108+
${{ (job.status == 'failure') && format('build/{0}/', matrix.variant) }} \
109+
| zstd > ${OUTPUT_ARTIFACT}.tar.zstd
98110
99111
- name: Archive board binaries
112+
if: ${{ !cancelled() }}
100113
uses: actions/upload-artifact@v4
101114
with:
102-
name: ${{ env.OUTPUT_ARTIFACT }}
115+
name: ${{ format('{0}{1}', (job.status == 'failure') && 'failed-' || '', env.OUTPUT_ARTIFACT) }}
103116
path: ${{ env.OUTPUT_ARTIFACT }}.tar.zstd
104117

105118
package-core:
@@ -114,6 +127,8 @@ jobs:
114127
strategy:
115128
matrix:
116129
artifact: ${{ fromJSON( needs.build-env.outputs.ARTIFACTS ) }}
130+
fail-fast: false
131+
if: ${{ !cancelled() && needs.build-env.result == 'success' }}
117132
steps:
118133
- uses: actions/checkout@v4
119134
with:
@@ -143,6 +158,7 @@ jobs:
143158
./extra/package_core.sh ${{ matrix.artifact }} ${CORE_TAG} distrib/${CORE_ARTIFACT}.tar.bz2
144159
145160
- uses: actions/upload-artifact@v4
161+
if: ${{ success() || failure() }}
146162
with:
147163
name: ${{ env.CORE_ARTIFACT }}
148164
path: distrib/${{ env.CORE_ARTIFACT }}.tar.bz2
@@ -152,6 +168,7 @@ jobs:
152168
runs-on: ubuntu-latest
153169
needs:
154170
- package-core
171+
if: always()
155172
steps:
156173
- uses: geekyeggo/[email protected]
157174
with:
@@ -176,6 +193,7 @@ jobs:
176193
PLAT: arduino:${{ matrix.subarch }}
177194
FQBN: arduino:${{ matrix.subarch }}:${{ matrix.board }}
178195
CORE_ARTIFACT: ArduinoCore-${{ matrix.artifact }}-${{ needs.build-env.outputs.CORE_HASH }}
196+
if: ${{ !cancelled() && needs.build-env.result == 'success' }}
179197
steps:
180198
- uses: actions/download-artifact@v4
181199
with:
@@ -245,7 +263,7 @@ jobs:
245263
- build-env
246264
- package-core
247265
- test-core
248-
if: ${{ !cancelled() && needs.package-core.result == 'success' }}
266+
if: ${{ !cancelled() && needs.build-env.result == 'success' }}
249267
env:
250268
ALL_BOARD_DATA: ${{ needs.build-env.outputs.ALL_BOARD_DATA }}
251269
steps:

extra/package_core.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
set -e
4+
RET=0
45

56
if [ -z "$1" ]; then
67
echo "Usage: $0 ARTIFACT VERSION [OUTPUT_FILE]"
@@ -72,7 +73,11 @@ declutter_file extra/artifacts/$ARTIFACT.inc >> ${TEMP_INC}
7273
for variant in $INCLUDED_VARIANTS ; do
7374
echo "- ${variant}"
7475
echo "variants/${variant}/" >> ${TEMP_INC}
75-
ls firmwares/zephyr-${variant}.* >> ${TEMP_INC}
76+
# add the firmwares, if some are missing notify at end
77+
if ! ls firmwares/zephyr-${variant}.* >> ${TEMP_INC} ; then
78+
log_msg error "No firmware for '${variant}' found."
79+
RET=3
80+
fi
7681
done
7782

7883
# create the list of files and directories to exclude
@@ -88,3 +93,5 @@ tar -cjhf ${OUTPUT_FILE} -X ${TEMP_EXC} -T ${TEMP_INC} \
8893
rm -f ${TEMP_INC} ${TEMP_EXC} ${TEMP_BOARDS} ${TEMP_PLATFORM}
8994

9095
log_msg endgroup
96+
97+
exit $RET

0 commit comments

Comments
 (0)