-
Notifications
You must be signed in to change notification settings - Fork 55
/
.travis.yml
208 lines (185 loc) · 13.5 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
##############################################################################
#
# File: .travis.yml
#
# Function:
# Travis script for test-building this library.
#
# Copyright Notice:
# See LICENSE file accompanying this project.
#
# Author:
# Terry Moore, MCCI Corporation July 2018
#
##############################################################################
dist: trusty
sudo: true
env:
global:
- IDE_VERSION=1.8.10
# Thanks, https://stackoverflow.com/questions/27644586/how-to-set-up-travis-ci-with-multiple-languages !
matrix:
include:
# C language tests
- language: c
cache:
directories:
- $HOME/.arduino15
- $HOME/arduino_ide
before_install:
# sudo apt-get install libc6-i386
- "/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, 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/arduino-lorawan"
- ln -sf $PWD $THISLIB
#
# 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" ; }'
#
# 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} ; }"
#
# 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 ; }'
#
# modify the board manager preferences to point to our BSPs.
- arduino --pref "boardsmanager.additional.urls=https://github.com/mcci-catena/arduino-boards/raw/master/BoardManagerFiles/package_mcci_index.json" --save-prefs
- export MCCI_STM32_OPTS="--pref recipe.hooks.objcopy.postobjcopy.1.pattern=true"
install:
- _clonelib github.com mcci-catena/Catena-mcciadk
- _clonelib github.com mcci-catena/arduino-lmic
- arduino --install-boards mcci:samd || echo "assume mcci:samd already installed, continue"
- arduino --install-boards mcci:stm32 || echo "assume mcci:stm32 already installed, continue"
script:
#
# show the output of the config commands for reference.
- "echo $(_stm32l0opts) $(_stm32l0opts '' projcfg)"
- "echo $(_samdopts) $(_samdopts '' projcfg)"
#
# test each of the regions for SAMD.
- arduino --verify --board $(_samdopts '' us915) $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_samdopts '' eu868) $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_samdopts '' au915) $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_samdopts '' as923) $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_samdopts '' as923jp) $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_samdopts '' kr920) $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_samdopts '' in866) $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_samdopts '' us915) $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_samdopts '' eu868) $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_samdopts '' au915) $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_samdopts '' as923) $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_samdopts '' as923jp) $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_samdopts '' kr920) $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_samdopts '' in866) $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_samdopts '' us915) $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_samdopts '' eu868) $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_samdopts '' au915) $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_samdopts '' as923) $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_samdopts '' as923jp) $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_samdopts '' kr920) $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_samdopts '' in866) $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_samdopts '' us915) $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_samdopts '' eu868) $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_samdopts '' au915) $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_samdopts '' as923) $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_samdopts '' as923jp) $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_samdopts '' kr920) $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_samdopts '' in866) $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_samdopts '' us915) $THISLIB/examples/simple_feather/simple_feather.ino
- arduino --verify --board $(_samdopts '' eu868) $THISLIB/examples/simple_feather/simple_feather.ino
- arduino --verify --board $(_samdopts '' au915) $THISLIB/examples/simple_feather/simple_feather.ino
- arduino --verify --board $(_samdopts '' as923) $THISLIB/examples/simple_feather/simple_feather.ino
- arduino --verify --board $(_samdopts '' as923jp) $THISLIB/examples/simple_feather/simple_feather.ino
- arduino --verify --board $(_samdopts '' kr920) $THISLIB/examples/simple_feather/simple_feather.ino
- arduino --verify --board $(_samdopts '' in866) $THISLIB/examples/simple_feather/simple_feather.ino
#
# *** TESTS FOR STM32L0 / Catena 4551 ****
- arduino --verify --board $(_stm32l0opts '' us915 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_stm32l0opts '' eu868 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_stm32l0opts '' au915 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_stm32l0opts '' as923 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_stm32l0opts '' as923jp) $MCCI_STM32_OPTS $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_stm32l0opts '' kr920 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_stm32l0opts '' in866 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test/header_test.ino
- arduino --verify --board $(_stm32l0opts '' us915 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_stm32l0opts '' eu868 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_stm32l0opts '' au915 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_stm32l0opts '' as923 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_stm32l0opts '' as923jp) $MCCI_STM32_OPTS $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_stm32l0opts '' kr920 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_stm32l0opts '' in866 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_lmic/header_test_lmic.ino
- arduino --verify --board $(_stm32l0opts '' us915 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_stm32l0opts '' eu868 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_stm32l0opts '' au915 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_stm32l0opts '' as923 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_stm32l0opts '' as923jp) $MCCI_STM32_OPTS $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_stm32l0opts '' kr920 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_stm32l0opts '' in866 ) $MCCI_STM32_OPTS $THISLIB/examples/header_test_ttn/header_test_ttn.ino
- arduino --verify --board $(_stm32l0opts '' us915 ) $MCCI_STM32_OPTS $THISLIB/examples/simple/simple.ino
# test simple config on a variety of boards.
- arduino --verify --board $(_stm32l0opts 'mcci_catena_4610' us915 ) $MCCI_STM32_OPTS $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_stm32l0opts 'mcci_catena_4611' us915 ) $MCCI_STM32_OPTS $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_stm32l0opts 'mcci_catena_4612' us915 ) $MCCI_STM32_OPTS $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_stm32l0opts 'mcci_catena_4617' us915 ) $MCCI_STM32_OPTS $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_stm32l0opts 'mcci_catena_4618' us915 ) $MCCI_STM32_OPTS $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_stm32l0opts 'mcci_catena_4630' us915 ) $MCCI_STM32_OPTS $THISLIB/examples/simple/simple.ino
- arduino --verify --board $(_stm32l0opts 'mcci_catena_4801' us915 ) $MCCI_STM32_OPTS $THISLIB/examples/simple/simple.ino
# PlatformIO dependency test
- language: python
python: 2.7
#env:
# - PLATFORMIO_CI_SRC=path/to/test/file.c
# - PLATFORMIO_CI_SRC=examples/file.ino
# - PLATFORMIO_CI_SRC=path/to/test/directory
install:
- pip install -U platformio
script:
- mkdir test_platformio_deps
- cd test_platformio_deps
- echo "[env:adafruit_feather_m0]" > platformio.ini
- echo "platform = atmelsam" >> platformio.ini
- echo "board = adafruit_feather_m0" >> platformio.ini
- echo "framework = arduino" >> platformio.ini
- echo "lib_deps =" >> platformio.ini
- echo " SPI" >> platformio.ini
- echo " Adafruit Zero DMA Library" >> platformio.ini
- if [ "${TRAVIS_PULL_REQUEST_SLUG}" != "" ]; then echo " https://github.com/${TRAVIS_PULL_REQUEST_SLUG}#${TRAVIS_PULL_REQUEST_BRANCH}" ; elif [ "${TRAVIS_BRANCH}" != "" ]; then echo " https://github.com/${TRAVIS_REPO_SLUG}#${TRAVIS_BRANCH}"; else echo " https://github.com/${TRAVIS_REPO_SLUG}" ; fi >> platformio.ini
- echo "build_flags =" >> platformio.ini
- echo " -DCFG_us915" >> platformio.ini
- cat platformio.ini
- mkdir src
- echo "int main() {}" > src/main.cpp
- platformio run
# - platformio ci --lib="." --board=adafruit_feather_m0
cache:
directories:
- "~/.platformio"
### end of file ###