diff --git a/.travis.yml b/.travis.yml index b4d6d7df..e63f305e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,21 @@ -# Travis script for test-building this library. +############################################################################## +# +# File: .travis.yml +# +# Function: +# Travis script for test-building this library. +# +# Copyright Notice: +# See LICENSE file accompanying this project. +# +# Author: +# Terry Moore, MCCI Corporation April 2018 +# +############################################################################## + language: c dist: trusty +sudo: true env: global: @@ -34,9 +49,19 @@ before_install: - export ARDUINO_IDE=arduino_ide/${IDE_VERSION} - export ARDUINO_LIBS="$HOME/Arduino/libraries" - if [ ! -d "$HOME/arduino_ide" ] ; then mkdir "$HOME/arduino_ide" ; fi - - if [ ! -d "$HOME/$ARDUINO_IDE" ] ; then { echo "fetch" && wget http://downloads.arduino.cc/arduino-${IDE_VERSION}-linux64.tar.xz && echo "untar" && tar xf arduino-${IDE_VERSION}-linux64.tar.xz && echo "move" && mv -f arduino-${IDE_VERSION} $HOME/${ARDUINO_IDE} ; } || { echo "IDE install failed"; exit 1; } ; else echo "IDE already installed" ; fi + - if [ ! -d "$HOME/$ARDUINO_IDE" ] ; then { echo "fetch" && wget https://downloads.arduino.cc/arduino-${IDE_VERSION}-linux64.tar.xz && echo "untar" && tar xf arduino-${IDE_VERSION}-linux64.tar.xz && echo "move" && mv -f arduino-${IDE_VERSION} $HOME/${ARDUINO_IDE} ; } || { echo "IDE install failed"; exit 1; } ; else echo "IDE already installed" ; fi - ln -sf $PWD $HOME/${ARDUINO_IDE}/libraries/Test_Library - export PATH="$HOME/${ARDUINO_IDE}:$PATH" + + # Arduino IDE adds a lot of noise caused by network traffic, trying to firewall it off + # (see https://github.com/per1234/arduino-ci-script/issues/1#issuecomment-504158113) + - sudo iptables -P INPUT DROP + - sudo iptables -P FORWARD DROP + - sudo iptables -P OUTPUT ACCEPT + - sudo iptables -A INPUT -i lo -j ACCEPT + - sudo iptables -A OUTPUT -o lo -j ACCEPT + - sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT + # # functions to generate the board settings for SAMD, STM32L0, ... # keep args for these aligned for any common options. $1 is always board name, $2 is region. diff --git a/ci/platformio.sh b/ci/platformio.sh index e0cdfcd9..ce1718aa 100755 --- a/ci/platformio.sh +++ b/ci/platformio.sh @@ -1,5 +1,20 @@ #!/bin/bash +############################################################################## +# +# File: .travis.yml +# +# Function: +# Travis script for test-building this library. +# +# Copyright Notice: +# See LICENSE file accompanying this project. +# +# Author: +# Francesco Zardi March 2019 +# +############################################################################## + # Treat unset variables and parameters as an error set -o nounset @@ -14,11 +29,11 @@ set -o pipefail if [[ ! -v TARGET ]] then echo "ERROR: variable TARGET is not defined. Please run this scripts as shown next:" - echo " TARGET='foo' $BASH_SOURCE" -elif [ "$TARGET" == "avr" ] + echo " TARGET='foo' ${BASH_SOURCE[*]}" +elif [ "$TARGET" == "esp32" ] then ################################################################################ - # TEST FOR TARGET "avr", i.e. BOARD heltec_wifi_lora_32 + # TEST FOR TARGET "esp32", i.e. BOARD heltec_wifi_lora_32 # Compile "ttn-otaa" example in all regions PLATFORMIO_BUILD_FLAGS='-D CFG_us915 -D CFG_sx1276_radio -D COMPILE_REGRESSION_TEST -D ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS' platformio ci --lib . --board heltec_wifi_lora_32 'examples/ttn-otaa/ttn-otaa.ino' @@ -97,11 +112,11 @@ then # Expect failure when compiling for more than one radio if [ "$(PLATFORMIO_BUILD_FLAGS='-D CFG_sx1272_radio -D CFG_sx1276_radio' platformio ci --lib . --board heltec_wifi_lora_32 'examples/ttn-otaa/ttn-otaa.ino' 1>&2; echo $?)" -eq 0 ]; then echo "ERROR: Compilation did not fail!"; exit 1; fi -elif [ "$TARGET" == "esp32" ] +elif [ "$TARGET" == "avr" ] then ################################################################################ - # TESTS FOR TARGET "esp32", i.e. BOARD feather32u4 + # TESTS FOR TARGET "avr", i.e. BOARD feather32u4 PLATFORMIO_BUILD_FLAGS='-D COMPILE_REGRESSION_TEST' platformio ci --lib . --board feather32u4 'examples/ttn-otaa-feather-us915/ttn-otaa-feather-us915.ino' PLATFORMIO_BUILD_FLAGS='-D COMPILE_REGRESSION_TEST -D ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS -D CFG_au921 -D CFG_sx1276_radio' platformio ci --lib . --board feather32u4 'examples/ttn-otaa-feather-us915/ttn-otaa-feather-us915.ino'