-
Notifications
You must be signed in to change notification settings - Fork 11
/
.travis.yml
172 lines (149 loc) · 9.97 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
##############################################################################
#
# 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: true
env:
global:
- IDE_VERSION=1.8.12
matrix:
- TARGET=samd
- TARGET=stm32l0
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 THISLIB="$HOME/$ARDUINO_IDE/libraries/Catena-Arduino-Platform"
- ln -sf $PWD $THISLIB
#
# 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 '--board' mcci:samd:${1:-mcci_catena_4450}:lorawan_region=${2:-us915} ; }"
- export MCCI_STM32_OPTS="--pref recipe.hooks.objcopy.postobjcopy.1.pattern=true"
- "function _stm32l0opts { echo '--board' mcci:stm32:${1:-mcci_catena_4551}:lorawan_region=${2:-us915},opt=${3:-osstd},xserial=${4:-generic},upload_method=${6:-STLink},sysclk=${7:-pll32m} $MCCI_STM32_OPTS ; }"
#
# Select based on target
#
- function _notsamd { test "$TARGET" != "samd"; }
- function _notstm32l0 { test "$TARGET" != "stm32l0"; }
- function _notany { for i in "$@" ; do if [ "$TARGET" = "$i" ]; then return 1 ; fi ; done; return 0; }
#
# Put one or more arguments into lmic_project_config.h as `#define $i 1\n` or `#define $i $arg`
- function _splitdef { if [ "$1" = "${1/=/}" ]; then echo "$1" 1 ; else echo "${1/=/ }" ; fi ; }
- function _projcfg { for i in "$@" ; do printf '#define %s %s\n' $(_splitdef "$i") ; done > "$ARDUINO_LIBS"/arduino-lmic/project_config/lmic_project_config.h ; }
#
# 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 ; }'
#
# function to clone a git repo for test: $1 == host, $2 == name
# get rid of any cached values.
- 'function _clonelib { R="https://$1/${2}.git" ; L=$(basename "$2") ; D="$ARDUINO_LIBS/$L" ; rm -rf "$HOME/ARDUINO_IDE/libraries/$L" ; echo git clone "$R" "$D" ; git clone --depth=1 "$R" "$D" ; ls -R "$D" ; }'
#
# 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" --save-prefs
install:
- _clonelib github.com mcci-catena/MCCI_FRAM_I2C
- _clonelib github.com mcci-catena/arduino-lmic
- _clonelib github.com mcci-catena/arduino-lorawan
- _clonelib github.com mcci-catena/Catena-mcciadk
- _clonelib github.com mcci-catena/RTCZero
- _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"
# fix for broken BSPs
- 'if [ "$TARGET" = stm32l0 -a -d $HOME/.arduino15/packages/mcci/hardware/stm32/1.1.0 ]; then echo "Work around broken BSP version 1.1.0" ; export MCCI_STM32_OPTS="$MCCI_STM32_OPTS --pref build.board=CATENA_4551" ; fi'
#
# show the output of the config commands for reference.
- "echo $(_stm32l0opts) $(_stm32l0opts '' projcfg)"
- "echo $(_samdopts) $(_samdopts '' projcfg)"
script:
#
# *** TESTS FOR SAMD21 / Feather M0, Catena 44xx boards ***
# test each of the SAMD boards
- _notsamd || arduino --verify $(_samdopts mcci_catena_4410) $THISLIB/examples/catena_hello/catena_hello.ino
- _notsamd || arduino --verify $(_samdopts mcci_catena_4420) $THISLIB/examples/catena_hello/catena_hello.ino
- _notsamd || arduino --verify $(_samdopts mcci_catena_4450) $THISLIB/examples/catena_hello/catena_hello.ino
- _notsamd || arduino --verify $(_samdopts mcci_catena_4460) $THISLIB/examples/catena_hello/catena_hello.ino
- _notsamd || arduino --verify $(_samdopts mcci_catena_4470) $THISLIB/examples/catena_hello/catena_hello.ino
#
# test the user-command example & the fsm example on the 4470
- _notsamd || arduino --verify $(_samdopts mcci_catena_4470) $THISLIB/examples/catena_usercommand/catena_usercommand.ino
- _notsamd || arduino --verify $(_samdopts mcci_catena_4470) $THISLIB/examples/catena_fsm/catena_fsm.ino
#
# test each of the regions on the 4450.
- _notsamd || arduino --verify $(_samdopts '' us915) $THISLIB/examples/catena_hello_lora/catena_hello_lora.ino
- _notsamd || arduino --verify $(_samdopts '' eu868) $THISLIB/examples/catena_hello_lora/catena_hello_lora.ino
- _notsamd || arduino --verify $(_samdopts '' au915) $THISLIB/examples/catena_hello_lora/catena_hello_lora.ino
- _notsamd || arduino --verify $(_samdopts '' as923) $THISLIB/examples/catena_hello_lora/catena_hello_lora.ino
- _notsamd || arduino --verify $(_samdopts '' as923jp) $THISLIB/examples/catena_hello_lora/catena_hello_lora.ino
- _notsamd || arduino --verify $(_samdopts '' in866) $THISLIB/examples/catena_hello_lora/catena_hello_lora.ino
#
# *** TESTS FOR STM32L0 / Catena 4551, 46xx, 480x boards ****
# test each of the STM32L0 boards
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4551) $THISLIB/examples/catena_hello/catena_hello.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4551) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4610) $THISLIB/examples/catena_hello/catena_hello.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4610) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4611) $THISLIB/examples/catena_hello/catena_hello.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4611) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4612) $THISLIB/examples/catena_hello/catena_hello.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4612) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4617) $THISLIB/examples/catena_hello/catena_hello.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4617) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4618) $THISLIB/examples/catena_hello/catena_hello.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4618) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4630) $THISLIB/examples/catena_hello/catena_hello.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4630) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4801) $THISLIB/examples/catena_hello/catena_hello.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4801) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4802) $THISLIB/examples/catena_hello/catena_hello.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4802) $THISLIB/examples/catena_hello/catena_hello_lora.ino
#
# test the user-command and fsm examples on the 4610
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4610) $THISLIB/examples/catena_usercommand/catena_usercommand.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4610) $THISLIB/examples/catena_fsm/catena_fsm.ino
# test each of the regions for 4610 (using it as an example). us915 already tested
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4610 eu868 ) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4610 au915 ) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4610 as923 ) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4610 as923jp) $THISLIB/examples/catena_hello/catena_hello_lora.ino
- _notstm32l0 || arduino --verify $(_stm32l0opts mcci_catena_4610 in866 ) $THISLIB/examples/catena_hello/catena_hello_lora.ino
### end of file ###