-
Notifications
You must be signed in to change notification settings - Fork 5
/
.travis.yml
134 lines (116 loc) · 6.16 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
##############################################################################
#
# File: .travis.yml
#
# Function:
# Travis script for test-building this library.
#
# Copyright Notice:
# See LICENSE file accompanying this project.
#
# Author:
# Terry Moore, MCCI Corporation June 2018
#
##############################################################################
language: c
dist: trusty
sudo: false
env:
global:
- IDE_VERSION=1.8.10
matrix:
- TARGET=samd
- TARGET=stm32l0
- TARGET=esp32
cache:
directories:
- $HOME/.arduino15
- $HOME/arduino_ide
before_install:
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16"
- sleep 3
- export DISPLAY=:1.0
- 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 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
- 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
#
# arduino_lorawan looks for project_config things, so we must put
# things in the canonical place
#
- export LIBPATH="$HOME/$ARDUINO_IDE/libraries"
- export THISLIB="$LIBPATH/Catena-mcciadk"
- export REQLIBS=
- mkdir -p "$LIBPATH"
- ln -s $PWD $THISLIB
- export NONCEDIR="$PWD/tmp"
#
# 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.
#
# Changes to the BSP may break this build, sorry!
#
- "function _samdopts { echo mcci:samd:${1:-mcci_catena_4450}:lorawan_region=${2:-us915} ; }"
- "function _stm32l0opts { echo mcci:stm32:${1:-mcci_catena_4551}:lorawan_region=${2:-us915},opt=${3:-osstd},xserial=${4:-generic},upload_method=${6:-STLink},sysclk=${7:-pll32m} ; }"
- "function _esp32opts { echo esp32:esp32:${1:-heltec_wifi_lora_32}:FlashFreq=80 ; }"
- export MCCI_STM32_OPTS="--pref recipe.hooks.objcopy.postobjcopy.1.pattern=true"
#
# Select based on target
#
- function _notsamd { test "$TARGET" != "samd"; }
- function _notstm32l0 { test "$TARGET" != "stm32l0"; }
- function _notavr { test "$TARGET" != "avr"; }
- function _notesp32 { test "$TARGET" != "esp32"; }
- function _notany { for i in "$@" ; do if [ "$TARGET" = "$i" ]; then return 1 ; fi ; done; return 0; }
#
# Put one or more arguments into nonce header file; $1 is the name of the sketch, and $1 is the header file to test
- function _maketestheader { UNIT="$1" ; shift ; UNITDIR="$NONCEDIR/$(basename $UNIT .ino)" ; rm -rf $UNITDIR ; mkdir -p $UNITDIR ; { for i in "$@" ; do printf '#include <%s>\n' "$i" ; done ; printf 'void setup() {}\nvoid loop() {}\n' ; } > $UNITDIR/$UNIT ; echo $UNITDIR/$UNIT ; }
#
# Handy macro to deal with expected failures.
- 'function _expect_failure { if [ $? -eq 0 ]; then echo "Suceeded, but should have failed!" ; echo project_config/lmic_project_config.h ; cat $HOME/arduino_ide/libraries/arduino-lmic/project_config/lmic_project_config.h ; return 1 ; else echo "Failed, as expected"; return 0 ; fi ; }'
#
# modify the board manager preferences to point to our BSPs.
- BSPMCCI=https://github.com/mcci-catena/arduino-boards/raw/master/BoardManagerFiles/package_mcci_index.json
- BSPADAFRUIT=https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
- BSPESP32=https://dl.espressif.com/dl/package_esp32_index.json
- arduino --pref "boardsmanager.additional.urls=$BSPMCCI,$BSPADAFRUIT,$BSPESP32" --save-prefs
# get more warnings
- arduino --pref "compiler.warning_level=more" --save-prefs
install:
- for i in $REQLIBS ; do echo $i ; git clone --depth=1 https://github.com/mcci-catena/${i}.git $LIBPATH/$i || break ; done
- 'export UNIT_HDR_BASE=$(_maketestheader headertest_base.ino mcciadk_baselib.h ) ; echo "UNIT_HDR_BASE: " "$UNIT_HDR_BASE" ; cat "$UNIT_HDR_BASE"'
- 'export UNIT_HDR_ENV=$(_maketestheader headertest_env.ino mcciadk_env.h ) ; echo "UNIT_HDR_ENV: " "$UNIT_HDR_ENV" ; cat "$UNIT_HDR_ENV"'
- 'export UNIT_HDR_GUID=$(_maketestheader headertest_guid.ino mcciadk_guid.h ) ; echo "UNIT_HDR_GUID: " "$UNIT_HDR_GUID" ; cat "$UNIT_HDR_GUID"'
- _notsamd || arduino --install-boards mcci:samd || echo "assume mcci:samd already installed, continue"
- _notstm32l0 || arduino --install-boards mcci:stm32 || echo "assume mcci:stm32 already installed, continue"
- _notesp32 || arduino --install-boards esp32:esp32 || echo "assume esp32:esp32 already installed, continue"
script:
#
# show the output of the config commands for reference.
- "echo $(_stm32l0opts) $(_stm32l0opts '' projcfg)"
- "echo $(_samdopts) $(_samdopts '' projcfg)"
#
# test the examples
- _notsamd || arduino --verify --board $(_samdopts) $UNIT_HDR_BASE
- _notsamd || arduino --verify --board $(_samdopts) $UNIT_HDR_ENV
- _notsamd || arduino --verify --board $(_samdopts) $UNIT_HDR_GUID
#
# *** TESTS FOR STM32L0 / Catena 4551 ****
- _notstm32l0 || arduino --verify --board $(_stm32l0opts) $MCCI_STM32_OPTS $UNIT_HDR_BASE
- _notstm32l0 || arduino --verify --board $(_stm32l0opts) $MCCI_STM32_OPTS $UNIT_HDR_ENV
- _notstm32l0 || arduino --verify --board $(_stm32l0opts) $MCCI_STM32_OPTS $UNIT_HDR_GUID
#
# *** TESTS FOR ESP32 / Heltec ****
- _notesp32 || arduino --verify --board $(_esp32opts) $UNIT_HDR_BASE
- _notesp32 || arduino --verify --board $(_esp32opts) $UNIT_HDR_ENV
- _notesp32 || arduino --verify --board $(_esp32opts) $UNIT_HDR_GUID
### end of file ###