1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-19 12:51:47 +02:00

Modify build script for use with Travis CI

- Exit 255 if interrupted
- Exit non-zero if any errors occur (returns the number of failures)
- Fix: second machine name not passed
This commit is contained in:
odaki
2020-03-22 21:10:52 +09:00
parent 330ea2ad7e
commit eb2f514f69

View File

@@ -4,7 +4,7 @@
# for every machine configuration in the Machines/ directory. # for every machine configuration in the Machines/ directory.
# It is useful for automated testing. # It is useful for automated testing.
trap "echo; exit" SIGINT trap "echo; exit 255" SIGINT
# With -v, show all output. Otherwise, show just the result # With -v, show all output. Otherwise, show just the result
if [ "$1" = "-v" ]; then if [ "$1" = "-v" ]; then
@@ -12,18 +12,29 @@ if [ "$1" = "-v" ]; then
else else
FILTER="grep error\|Took" FILTER="grep error\|Took"
fi fi
set -o pipefail
NUM_ERRORS=0
BuildMachine () { BuildMachine () {
basename=$1 basename=$1
addname=$2 addname=$2
BF="-DMACHINE_FILENAME=$basename" BF="\"-DMACHINE_FILENAME=$basename\""
displayname=$basename displayname=$basename
if [ "$addname" != "" ] if [ "$addname" != "" ]
then then
BF="$BF -DMACHINE_FILENAME2=$addname" BF="$BF \"-DMACHINE_FILENAME2=$addname\""
displayname="$basename + $addname" displayname="$basename + $addname"
fi fi
echo "Building machine $displayname" echo "Building machine $displayname"
PLATFORMIO_BUILD_FLAGS=\'$BF\' platformio run 2>&1 | $FILTER PLATFORMIO_BUILD_FLAGS=$BF platformio run 2>&1 | $FILTER
local re=$?
# check result
if [ $re -ne 0 ]; then
echo "Failed to build machine $displayname"
echo
NUM_ERRORS=$(( NUM_ERRORS + 1 ))
return $re
fi
echo echo
} }
@@ -40,3 +51,5 @@ do
adder=`basename $file` adder=`basename $file`
BuildMachine $base $adder BuildMachine $base $adder
done done
exit $NUM_ERRORS