Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI updates #339

Merged
merged 5 commits into from
Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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.
Expand Down
25 changes: 20 additions & 5 deletions ci/platformio.sh
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand Down