-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.travis.yml
122 lines (101 loc) · 5.77 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
##############################################################################
#
# File: .travis.yml
#
# Function:
# Travis script for test-building this library.
#
# Copyright Notice:
# See LICENSE file accompanying this project.
#
# Author:
# Prabhu Srinivasan, MCCI Corporation February 2020
#
##############################################################################
language: c
dist: trusty
sudo: true
env:
global:
- IDE_VERSION=1.8.12
matrix:
- 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 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!
#
- 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 _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".ino ]; then echo "No sketch:" "$S".ino ; false; elif [ "$BDTARGET" = "$TARGET" ]; then echo arduino --verify $(_opts "$B" "$@") "$S".ino; arduino --verify $(_opts "$B" "$@") "$S".ino ; else echo "skip" "$@"; fi ; }'
install:
- _clonelib github.com mcci-catena/Adafruit_BME280_Library
- _clonelib github.com mcci-catena/Adafruit_FRAM_I2C
- _clonelib github.com mcci-catena/Adafruit_Sensor
- _clonelib github.com mcci-catena/arduino-lmic
- _clonelib github.com mcci-catena/arduino-lorawan
- _clonelib github.com mcci-catena/Catena-Arduino-Platform
- _clonelib github.com mcci-catena/Catena-mcciadk
- _clonelib github.com mcci-catena/MCCI-Catena-SHT3x
- _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)"
script:
#
# *** TESTS FOR STM32 Catena boards ***
# test each of the STM32 boards
- _testsketch stm32l0_pwrtest mcci_catena_4610 "$REGION"
- _testsketch stm32l0_pwrtest mcci_catena_4612 "$REGION"
- _testsketch stm32l0_pwrtest mcci_catena_4618 "$REGION"
- _testsketch stm32l0_pwrtest mcci_catena_4801 "$REGION"
### end of file ###