forked from jgromes/LoRaLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
105 lines (98 loc) · 3.55 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
dist: bionic
sudo: true
cache:
directories:
- downloads
env:
global:
- ARDUINO_IDE_VERSION="1.8.12"
matrix:
- BOARD="NONE:LINUX"
- BOARD="arduino:avr:uno"
- BOARD="arduino:avr:leonardo"
- BOARD="arduino:avr:mega:cpu=atmega2560"
- BOARD="esp8266:esp8266:generic:xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K"
- BOARD="esp32:esp32:esp32"
before_install:
# install Arduino IDE
- if [ $BOARD != "NONE:LINUX" ]; then
mkdir -p downloads ;
cd downloads ;
if [ ! -f "arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz" ]; then
wget http://downloads.arduino.cc/arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz ;
fi;
tar xf arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz ;
mv arduino-$ARDUINO_IDE_VERSION $HOME/arduino-ide ;
cd ..;
export PATH=$PATH:$HOME/arduino-ide ;
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 --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json,https://dl.espressif.com/dl/package_esp32_index.json" --save-prefs 2>&1 ;
if [[ "$BOARD" =~ "esp8266:esp8266:" ]]; then
arduino --install-boards esp8266:esp8266;
elif [[ "$BOARD" =~ "esp32:esp32:" ]]; then
arduino --install-boards esp32:esp32;
fi;
fi
# create directory to save the library and create symbolic link
install:
- mkdir -p $HOME/Arduino/libraries
- ln -s $PWD $HOME/Arduino/libraries/lib
# only build the master branch
branches:
only:
- master
script:
# build all example sketches
- cd examples
- for d in */ ; do
if [ $BOARD = "NONE:LINUX" ]; then
echo -e "\033[1;36m${d%/} build SKIPPED\033[0m\n";
continue;
fi;
echo -e "\n\033[1;33mBuilding ${d%/} ... \033[0m";
arduino --verify --board $BOARD $PWD/${d%/}/${d%/}.ino;
if [ $? -ne 0 ]; then
echo -e "\033[1;31m${d%/} build FAILED\033[0m\n";
exit 1;
else
echo -e "\033[1;32m${d%/} build PASSED\033[0m\n";
fi
done
# generate Doxygen documentation (only for Arduino UNO)
- if [ $BOARD = "arduino:avr:uno" ]; then
sudo apt-get update;
sudo apt-get install -y doxygen;
cd ..;
doxygen Doxyfile;
fi
# test compulation under Linux
- >
if [ $BOARD = "NONE:LINUX" ]; then
cd ..;
echo -e '#include <LoRaLib.h>' >output.cpp ;
echo -e "static SX1278 *lora;\nint main(int argc, char **argv) { return 0; }" >>output.cpp ;
echo -e "CC = g++\n" >Makefile ;
echo -e "CFLAGS = -std=c++14 -Wall -DLINUX -DNOWIRINGIPI -Isrc/ -Isrc/modules/ -Isrc/linux-workarounds/SPI/" >>Makefile ;
echo -ne 'SRC = $(wildcard src/linux-workarounds/SPI/*.cpp) $(wildcard src/linux-workarounds/*.cpp) ' >>Makefile ;
echo -ne '$(wildcard src/protocols/*.cpp) $(wildcard src/modules/*.cpp) ' >>Makefile ;
echo -ne '$(wildcard src/*.cpp) output.cpp' >>Makefile ;
echo -e "\n\t" >>Makefile ;
echo -e 'all: $(SRC)' >>Makefile ;
echo -ne "\t" >>Makefile ;
echo -ne '$(CC) -o output $^ $(CFLAGS)' >>Makefile ;
make;
fi
# deploy Doxygen docs on master branch and only when building for Arduino UNO
deploy:
provider: pages
skip_cleanup: true
local_dir: docs/html
github_token: $GH_REPO_TOKEN
on:
branch: master
condition: $BOARD = "arduino:avr:uno"