-
Notifications
You must be signed in to change notification settings - Fork 21
/
.travis.yml
176 lines (153 loc) · 8.64 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
##############################################################################
#
# File: .travis.yml
#
# Function:
# Travis script for test-building this library.
#
# Copyright Notice:
# See LICENSE file accompanying this project.
#
# Author:
# Terry Moore, MCCI Corporation February 2019
#
##############################################################################
language: c
dist: trusty
sudo: true
env:
global:
- IDE_VERSION=1.8.10
matrix:
- TARGET=samd REGION=us915
- TARGET=samd REGION=eu868
- TARGET=samd REGION=au915
- TARGET=samd REGION=as923
- TARGET=samd REGION=as923jp
- TARGET=samd REGION=in866
- TARGET=stm32l0 REGION=us915
- TARGET=stm32l0 REGION=eu868
- TARGET=stm32l0 REGION=au915
- TARGET=stm32l0 REGION=as923
- TARGET=stm32l0 REGION=as923jp
- TARGET=stm32l0 REGION=in866
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
#
# 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_4612}: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
# return platform for board
- 'function _getplatform { case "$1" in mcci_catena_44*) echo samd;; mcci_catena_45*) echo stm32l0;; mcci_catena_461*) echo stm32l0;; mcci_catena_48*) echo stm32l0;; *) echo unknown;; esac; }'
- 'function _opts { if [ "$TARGET" = "samd" ]; then _samdopts "$@" ; elif [ "$TARGET" = "stm32l0" ]; then _stm32l0opts "$@" ; fi ; }'
# compile sketch if reasonable for this platform
- 'function _testsketch { echo "_testsketch" "$@"; local S="$1"; shift; local B="$1" ; shift ; local BDTARGET="$(_getplatform "$B")"; if [ ! -f "$S"/"$S".ino ]; then echo "No sketch:" "$S/$S".ino ; false; elif [ "$BDTARGET" = "$TARGET" ]; then echo arduino --verify $(_opts "$B" "$@") "$S"/"$S".ino; arduino --verify $(_opts "$B" "$@") "$S"/"$S".ino ; else echo "skip" "$@"; fi ; }'
install:
- _clonelib github.com mcci-catena/Adafruit_BME280_Library
- _clonelib github.com mcci-catena/Adafruit_BME680
- _clonelib github.com mcci-catena/MCCI_FRAM_I2C
- _clonelib github.com mcci-catena/Adafruit_Sensor
- _clonelib github.com mcci-catena/Adafruit_TSL2561
- _clonelib github.com mcci-catena/Arduino-Temperature-Control-Library
- _clonelib github.com mcci-catena/arduinounit
- _clonelib github.com mcci-catena/arduino-lmic
- _clonelib github.com mcci-catena/arduino-lorawan
- _clonelib github.com mcci-catena/BH1750
- _clonelib github.com mcci-catena/Catena-Arduino-Platform
- _clonelib github.com mcci-catena/Catena-mcciadk
- _clonelib github.com mcci-catena/OneWire
- _clonelib github.com mcci-catena/RTCZero
- _clonelib github.com mcci-catena/SHT1x
- _clonelib github.com mcci-catena/MCCI-Catena-HS300x
- _clonelib github.com mcci-catena/MCCI-Catena-SHT3x
- _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"
#
# show the output of the config commands for reference.
- "echo $(_stm32l0opts) $(_stm32l0opts '' projcfg)"
- "echo $(_samdopts) $(_samdopts '' projcfg)"
script:
- _testsketch catena461x_hwtest mcci_catena_4610 "$REGION"
- _testsketch catena461x_hwtest mcci_catena_4611 "$REGION"
- _testsketch catena461x_hwtest mcci_catena_4612 "$REGION"
- _testsketch catena461x_test01 mcci_catena_4610 "$REGION"
- _testsketch catena461x_test01 mcci_catena_4612 "$REGION"
- _testsketch catena4612_simple mcci_catena_4610 "$REGION"
- _testsketch catena4612_simple mcci_catena_4612 "$REGION"
- _testsketch catena4617_simple mcci_catena_4617 "$REGION"
- _testsketch catena4618_simple mcci_catena_4618 "$REGION"
- _testsketch catena4410_sensor1 mcci_catena_4410 "$REGION"
- _testsketch catena4410_test01 mcci_catena_4410 "$REGION"
- _testsketch catena4410_test02 mcci_catena_4410 "$REGION"
- _testsketch catena4410_test03 mcci_catena_4410 "$REGION"
- _testsketch catena4420_test01 mcci_catena_4420 "$REGION"
- _testsketch catena4450_test01 mcci_catena_4450 "$REGION"
- _testsketch catena4551_test01 mcci_catena_4551 "$REGION"
- _testsketch catena4551_test02 mcci_catena_4551 "$REGION"
- _testsketch catena4450m101_sensor mcci_catena_4450 "$REGION"
- _testsketch catena4450m101_sensor mcci_catena_4460 "$REGION"
- _testsketch catena4450m101_sensor mcci_catena_4470 "$REGION"
- _testsketch catena4450m101_sensor mcci_catena_4610 "$REGION"
- _testsketch catena4450m101_sensor mcci_catena_4611 "$REGION"
- _testsketch catena4450m101_sensor mcci_catena_4612 "$REGION"
- _testsketch catena4450m102_pond mcci_catena_4450 "$REGION"
- _testsketch catena4450m102_pond mcci_catena_4460 "$REGION"
- _testsketch catena4450m102_pond mcci_catena_4470 "$REGION"
- _testsketch catena4450m102_pond mcci_catena_4610 "$REGION"
- _testsketch catena4450m102_pond mcci_catena_4611 "$REGION"
- _testsketch catena4450m102_pond mcci_catena_4612 "$REGION"
- _testsketch catena4450m102_waterlevel mcci_catena_4450 "$REGION"
- _testsketch catena4450m102_waterlevel mcci_catena_4460 "$REGION"
- _testsketch catena4450m102_waterlevel mcci_catena_4470 "$REGION"
- _testsketch catena4450m102_waterlevel mcci_catena_4610 "$REGION"
- _testsketch catena4450m102_waterlevel mcci_catena_4611 "$REGION"
- _testsketch catena4450m102_waterlevel mcci_catena_4612 "$REGION"
- _testsketch catena4460_aqi mcci_catena_4460 "$REGION"
### end of file ###