2018-09-18 22:21:29 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2017-10-25 02:06:02 -04:00
|
|
|
rm -rf ports/atmel-samd/build*
|
|
|
|
rm -rf ports/esp8266/build*
|
2017-12-27 07:54:16 -05:00
|
|
|
rm -rf ports/nrf/build*
|
2016-11-21 17:40:28 -05:00
|
|
|
|
2018-09-18 15:38:12 -04:00
|
|
|
# Alphabetical.
|
2018-08-29 15:38:33 -04:00
|
|
|
HW_BOARDS="\
|
2018-08-21 18:45:37 -04:00
|
|
|
arduino_zero \
|
|
|
|
circuitplayground_express \
|
|
|
|
circuitplayground_express_crickit \
|
|
|
|
feather_huzzah \
|
|
|
|
feather_m0_adalogger \
|
|
|
|
feather_m0_basic \
|
|
|
|
feather_m0_express \
|
|
|
|
feather_m0_express_crickit \
|
|
|
|
feather_m0_rfm69 \
|
|
|
|
feather_m0_rfm9x \
|
|
|
|
feather_m4_express \
|
|
|
|
feather_nrf52832 \
|
2018-08-29 15:38:33 -04:00
|
|
|
feather_nrf52840_express \
|
2018-08-21 18:45:37 -04:00
|
|
|
feather_radiofruit_zigbee \
|
|
|
|
gemma_m0 \
|
2018-09-18 15:38:12 -04:00
|
|
|
grandcentral_m4_express \
|
2018-08-21 18:45:37 -04:00
|
|
|
hallowing_m0_express \
|
|
|
|
itsybitsy_m0_express \
|
|
|
|
itsybitsy_m4_express \
|
|
|
|
metro_m0_express \
|
|
|
|
metro_m4_express \
|
2018-10-16 14:51:37 -04:00
|
|
|
meowmeow \
|
2018-09-18 15:38:12 -04:00
|
|
|
pca10056 \
|
|
|
|
pca10059 \
|
2018-08-21 18:45:37 -04:00
|
|
|
pirkey_m0 \
|
2018-09-14 10:38:06 -04:00
|
|
|
trellis_m4_express \
|
2018-09-18 15:38:12 -04:00
|
|
|
trinket_m0 \
|
2018-08-21 18:45:37 -04:00
|
|
|
"
|
2017-08-15 18:45:27 -04:00
|
|
|
ROSIE_SETUPS="rosie-ci"
|
2016-11-29 13:47:11 -05:00
|
|
|
|
2017-10-25 02:06:02 -04:00
|
|
|
PARALLEL="-j 5"
|
2018-09-18 22:21:29 -04:00
|
|
|
if [[ "$TRAVIS" == "true" ]]; then
|
2017-10-25 02:06:02 -04:00
|
|
|
PARALLEL="-j 2"
|
|
|
|
fi
|
|
|
|
|
2018-09-18 22:21:29 -04:00
|
|
|
if [[ -z "$TRAVIS_BOARD" ]]; then
|
2018-08-29 15:38:33 -04:00
|
|
|
boards=$HW_BOARDS
|
2017-11-15 18:05:34 -05:00
|
|
|
else
|
|
|
|
boards=$TRAVIS_BOARD
|
|
|
|
fi
|
|
|
|
|
2016-11-21 17:40:28 -05:00
|
|
|
version=`git describe --tags --exact-match`
|
2018-09-18 22:21:29 -04:00
|
|
|
if [[ $? -ne 0 ]]; then
|
2017-04-20 17:04:06 -04:00
|
|
|
version=`date +%Y%m%d`-`git rev-parse --short HEAD`
|
2016-11-21 17:40:28 -05:00
|
|
|
fi
|
|
|
|
|
2017-08-23 15:22:08 -04:00
|
|
|
|
2018-09-18 22:21:29 -04:00
|
|
|
if [[ "$TRAVIS" == "true" ]]; then
|
2017-08-23 15:22:08 -04:00
|
|
|
sha=$TRAVIS_COMMIT
|
2018-09-18 22:21:29 -04:00
|
|
|
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
|
2017-08-23 15:22:08 -04:00
|
|
|
version=`date +%Y%m%d`-`echo $TRAVIS_PULL_REQUEST_SHA | cut -c1-7`
|
|
|
|
sha=$TRAVIS_PULL_REQUEST_SHA
|
|
|
|
fi
|
2017-08-15 18:45:27 -04:00
|
|
|
fi
|
|
|
|
|
2017-11-15 18:05:34 -05:00
|
|
|
for board in $boards; do
|
2017-04-20 17:04:06 -04:00
|
|
|
mkdir -p bin/$board/
|
2018-06-10 15:20:10 -04:00
|
|
|
extension=uf2
|
2018-07-31 19:53:54 -04:00
|
|
|
for language_file in $(ls locale/*.po); do
|
|
|
|
language=$(basename -s .po $language_file)
|
|
|
|
echo "Building $board for $language"
|
2018-09-18 22:21:29 -04:00
|
|
|
if [[ $board == "feather_huzzah" ]]; then
|
|
|
|
make $PARALLEL -C ports/esp8266 TRANSLATION=$language BOARD=$board
|
2018-07-31 19:53:54 -04:00
|
|
|
(( exit_status = exit_status || $? ))
|
|
|
|
temp_filename=ports/esp8266/build/firmware-combined.bin
|
|
|
|
extension=bin
|
2018-09-18 22:21:29 -04:00
|
|
|
elif [[ $board == "feather_nrf52832" ]]; then
|
|
|
|
make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=$board
|
2018-07-31 19:53:54 -04:00
|
|
|
(( exit_status = exit_status || $? ))
|
|
|
|
temp_filename=ports/nrf/build-$board-s132/firmware.bin
|
|
|
|
extension=bin
|
2018-09-18 22:21:29 -04:00
|
|
|
elif [[ $board == "feather_nrf52840_express" || $board == "pca10056" || $board == "pca10059" ]]; then
|
|
|
|
make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=$board SD=s140
|
2018-07-31 19:53:54 -04:00
|
|
|
(( exit_status = exit_status || $? ))
|
2018-08-29 15:38:33 -04:00
|
|
|
temp_filename=ports/nrf/build-$board-s140/firmware.uf2
|
|
|
|
extension=uf2
|
2018-07-31 19:53:54 -04:00
|
|
|
else
|
|
|
|
time make $PARALLEL -C ports/atmel-samd TRANSLATION=$language BOARD=$board
|
|
|
|
(( exit_status = exit_status || $? ))
|
|
|
|
cp ports/atmel-samd/build-$board/firmware.bin bin/$board/adafruit-circuitpython-$board-$language-$version.bin
|
|
|
|
(( exit_status = exit_status || $? ))
|
|
|
|
temp_filename=ports/atmel-samd/build-$board/firmware.uf2
|
|
|
|
extension=uf2
|
|
|
|
fi
|
|
|
|
final_filename=bin/$board/adafruit-circuitpython-$board-$language-$version.$extension
|
|
|
|
cp $temp_filename $final_filename
|
2017-12-28 16:35:03 -05:00
|
|
|
(( exit_status = exit_status || $? ))
|
2018-07-31 19:53:54 -04:00
|
|
|
# Only upload to Rosie if its a pull request.
|
2018-09-18 22:21:29 -04:00
|
|
|
if [[ "$TRAVIS" == "true" ]]; then
|
2018-07-31 19:53:54 -04:00
|
|
|
for rosie in $ROSIE_SETUPS; do
|
|
|
|
echo "Uploading to https://$rosie.ngrok.io/upload/$sha"
|
|
|
|
curl -F "file=@$final_filename" https://$rosie.ngrok.io/upload/$sha
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
echo
|
|
|
|
done
|
2016-11-29 13:47:11 -05:00
|
|
|
done
|
2017-04-20 18:14:37 -04:00
|
|
|
|
2017-04-20 17:04:06 -04:00
|
|
|
exit $exit_status
|