Skip to content

Commit fa2d2f6

Browse files
committed
build_all: exit with an error code if any build fails
When run in a GitHub Actions workflow, this script was called with '-f' and would report no error even if some of the builds failed. Change it to exit with a non-zero error code in case any of the builds fail, so the CI pipeline will stop.
1 parent 9bfd899 commit fa2d2f6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

extra/build_all.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ if [ ! -z "$GITHUB_STEP_SUMMARY" ] ; then
2424
echo "### Variant build results:" >> "$GITHUB_STEP_SUMMARY"
2525
fi
2626

27-
extra/get_board_details.sh | jq -cr 'sort_by(.variant) | .[]' | while read -r item; do
27+
final_result=0
28+
while read -r item; do
2829
board=$(jq -cr '.board' <<< "$item")
2930
variant=$(jq -cr '.variant' <<< "$item")
3031
target=$(jq -cr '.target' <<< "$item")
@@ -40,6 +41,7 @@ extra/get_board_details.sh | jq -cr 'sort_by(.variant) | .[]' | while read -r it
4041

4142
./extra/build.sh "$target" $args
4243
result=$?
44+
final_result=$((final_result | result))
4345

4446
if [ -z "$GITHUB_STEP_SUMMARY" ] ; then
4547
echo
@@ -49,11 +51,11 @@ extra/get_board_details.sh | jq -cr 'sort_by(.variant) | .[]' | while read -r it
4951
if [ $result -eq 0 ] ; then
5052
echo "- :white_check_mark: \`${variant}\`" >> "$GITHUB_STEP_SUMMARY"
5153
else
52-
echo "^^^^$(echo ${variant} | sed -e 's/./^/g')^^^^^ FAILED with $result!"
54+
echo "^^$(echo "=== ${board} (${variant}) ===" | sed -e 's/./^/g') FAILED with $result!"
5355
echo "- :x: \`${variant}\`" >> "$GITHUB_STEP_SUMMARY"
5456
fi
5557
fi
5658
[ $result -ne 0 ] && ! $FORCE && exit $result
57-
done
59+
done < <(extra/get_board_details.sh | jq -cr 'sort_by(.variant) | .[]')
5860

59-
exit 0
61+
exit $final_result

0 commit comments

Comments
 (0)