Skip to content

Commit 8f575c8

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 8f575c8

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

.github/workflows/package_core.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,23 @@ 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 "\`\`\`" > $GITHUB_STEP_SUMMARY
95+
cat error.log >> $GITHUB_STEP_SUMMARY
96+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
97+
exit 1
98+
fi
9499
95100
- name: Package board binaries
101+
if: ${{ !cancelled() }}
96102
run: |
97-
tar chf - firmwares/*${{ matrix.variant }}* variants/${{ matrix.variant }}/ | zstd > ${OUTPUT_ARTIFACT}.tar.zstd
103+
tar chf - build/${{ matrix.variant }} firmwares/*${{ matrix.variant }}* variants/${{ matrix.variant }}/ | zstd > ${OUTPUT_ARTIFACT}.tar.zstd
98104
99105
- name: Archive board binaries
106+
if: ${{ !cancelled() }}
100107
uses: actions/upload-artifact@v4
101108
with:
102-
name: ${{ env.OUTPUT_ARTIFACT }}
109+
name: ${{ format('{0}{1}', (job.status == 'failure') && 'failed-' || '', env.OUTPUT_ARTIFACT) }}
103110
path: ${{ env.OUTPUT_ARTIFACT }}.tar.zstd
104111

105112
package-core:
@@ -114,6 +121,8 @@ jobs:
114121
strategy:
115122
matrix:
116123
artifact: ${{ fromJSON( needs.build-env.outputs.ARTIFACTS ) }}
124+
fail-fast: false
125+
if: ${{ !cancelled() && needs.build-env.result == 'success' }}
117126
steps:
118127
- uses: actions/checkout@v4
119128
with:
@@ -143,6 +152,7 @@ jobs:
143152
./extra/package_core.sh ${{ matrix.artifact }} ${CORE_TAG} distrib/${CORE_ARTIFACT}.tar.bz2
144153
145154
- uses: actions/upload-artifact@v4
155+
if: ${{ success() || failure() }}
146156
with:
147157
name: ${{ env.CORE_ARTIFACT }}
148158
path: distrib/${{ env.CORE_ARTIFACT }}.tar.bz2
@@ -176,6 +186,7 @@ jobs:
176186
PLAT: arduino:${{ matrix.subarch }}
177187
FQBN: arduino:${{ matrix.subarch }}:${{ matrix.board }}
178188
CORE_ARTIFACT: ArduinoCore-${{ matrix.artifact }}-${{ needs.build-env.outputs.CORE_HASH }}
189+
if: ${{ !cancelled() && needs.build-env.result == 'success' }}
179190
steps:
180191
- uses: actions/download-artifact@v4
181192
with:
@@ -245,7 +256,7 @@ jobs:
245256
- build-env
246257
- package-core
247258
- test-core
248-
if: ${{ !cancelled() && needs.package-core.result == 'success' }}
259+
if: ${{ !cancelled() && needs.build-env.result == 'success' }}
249260
env:
250261
ALL_BOARD_DATA: ${{ needs.build-env.outputs.ALL_BOARD_DATA }}
251262
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)