Skip to content

Commit 2e4b76d

Browse files
committed
Add caching support
1 parent 1f99208 commit 2e4b76d

File tree

4 files changed

+76
-26
lines changed

4 files changed

+76
-26
lines changed

.travis.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
language: c
22
sudo: false
3+
cache:
4+
directories:
5+
- ~/arduino_ide
6+
# Caches Arduino IDE + ESP32 platform
7+
- ~/.arduino15/packages/
8+
# Caches Arduino platforms
9+
git:
10+
depth: false
11+
quiet: true
12+
env:
13+
global:
14+
- ARDUINO_IDE_VERSION="1.8.5"
315
before_install:
416
- source <(curl -SLs https://raw.githubusercontent.com/${TRAVIS_REPO_SLUG}/${TRAVIS_BRANCH}/install.sh)
517
script:
@@ -11,4 +23,4 @@ script:
1123
notifications:
1224
email:
1325
on_success: change
14-
on_failure: change
26+
on_failure: change

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/
2020
```
2121
language: c
2222
sudo: false
23+
cache:
24+
directories:
25+
- ~/arduino_ide
26+
- ~/.arduino15/packages/
27+
git:
28+
depth: false
29+
quiet: true
30+
env:
31+
global:
32+
- ARDUINO_IDE_VERSION="1.8.5"
2333
before_install:
2434
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
2535
install:

example_travis.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
language: c
22
sudo: false
3-
4-
# Blacklist
5-
branches:
6-
except:
7-
- gh-pages
8-
3+
cache:
4+
directories:
5+
- ~/arduino_ide
6+
- ~/.arduino15/packages/
7+
git:
8+
depth: false
9+
quiet: true
910
env:
1011
global:
12+
- ARDUINO_IDE_VERSION="1.8.5"
1113
- PRETTYNAME="Adafruit FT6206 Arduino Library"
1214
# Optional, will default to "$TRAVIS_BUILD_DIR/Doxyfile"
1315
# - DOXYFILE: $TRAVIS_BUILD_DIR/Doxyfile

install.sh

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,25 @@ export IO_PLATFORMS='declare -A io_platforms=( [zero]="arduino:samd:arduino_zero
2828
sleep 3
2929
export DISPLAY=:1.0
3030

31-
# download and install arduino 1.8.5
32-
wget --quiet https://downloads.arduino.cc/arduino-1.8.5-linux64.tar.xz
33-
tar xf arduino-1.8.5-linux64.tar.xz
34-
mv arduino-1.8.5 $HOME/arduino_ide
31+
# if .travis.yml does not set version
32+
if [ -z $ARDUINO_IDE_VERSION ]; then export ARDUINO_IDE_VERSION="1.8.5"; fi
33+
34+
# if newer version is requested
35+
if [ ! -f $HOME/arduino_ide/$ARDUINO_IDE_VERSION ] && [ -f $HOME/arduino_ide/arduino ]; then
36+
shopt -s extglob
37+
rm -r -f !(esp32)
38+
cd $OLDPWD
39+
echo "DIFFERENT VERSION OF ARDUINO IDE REQUESTED!"
40+
fi
41+
42+
# if not already cached, download and install arduino 1.8.5
43+
if [ ! -f $HOME/arduino_ide/arduino ]; then
44+
echo "DOWNLOADING ARDUINO IDE..."
45+
wget --quiet https://downloads.arduino.cc/arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz
46+
echo "UNPACKING ARDUINO IDE..."
47+
tar xf arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz -C $HOME/arduino_ide/ --strip-components=1
48+
touch $HOME/arduino_ide/$ARDUINO_IDE_VERSION
49+
fi
3550

3651
# move this library to the arduino libraries folder
3752
ln -s $PWD $HOME/arduino_ide/libraries/Adafruit_Test_Library
@@ -47,48 +62,59 @@ echo "########################################################################";
4762
# install the due, esp8266, and adafruit board packages
4863
echo -n "ADD PACKAGE INDEX: "
4964
DEPENDENCY_OUTPUT=$(arduino --pref "boardsmanager.additional.urls=https://adafruit.github.io/arduino-board-index/package_adafruit_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json" --save-prefs 2>&1)
50-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
65+
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
5166

5267
echo -n "ESP32: "
68+
69+
if [ ! -d $HOME/Arduino/hardware/espressif ]; then
5370
DEPENDENCY_OUTPUT=$(mkdir -p $HOME/Arduino/hardware/espressif &&
5471
cd $HOME/Arduino/hardware/espressif &&
5572
git clone https://github.com/espressif/arduino-esp32.git esp32 &&
5673
cd esp32/tools/ &&
5774
python get.py &&
5875
cd $TRAVIS_BUILD_DIR
5976
)
60-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
77+
else
78+
DEPENDENCY_OUTPUT=$(cd $HOME/Arduino/hardware/espressif &&
79+
git pull origin master &&
80+
cd esp32/tools/ &&
81+
python get.py &&
82+
cd $TRAVIS_BUILD_DIR
83+
)
84+
fi
85+
86+
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
6187

6288
echo -n "DUE: "
6389
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:sam 2>&1)
64-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
90+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
6591

6692
echo -n "ZERO: "
6793
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:samd 2>&1)
68-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
94+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
6995

7096
echo -n "ESP8266: "
7197
DEPENDENCY_OUTPUT=$(arduino --install-boards esp8266:esp8266 2>&1)
72-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
98+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
7399

74100
echo -n "ADAFRUIT AVR: "
75101
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:avr 2>&1)
76-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
102+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
77103

78104
echo -n "ADAFRUIT SAMD: "
79105
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:samd 2>&1)
80-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
106+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
81107

82108
# install random lib so the arduino IDE grabs a new library index
83109
# see: https://github.com/arduino/Arduino/issues/3535
84110
echo -n "UPDATE LIBRARY INDEX: "
85111
DEPENDENCY_OUTPUT=$(arduino --install-library USBHost > /dev/null 2>&1)
86-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
112+
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
87113

88114
# set the maximal compiler warning level
89115
echo -n "SET BUILD PREFERENCES: "
90116
DEPENDENCY_OUTPUT=$(arduino --pref "compiler.warning_level=all" --save-prefs 2>&1)
91-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
117+
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
92118

93119
# init the json temp var for the current platform
94120
export PLATFORM_JSON=""
@@ -163,12 +189,12 @@ function build_platform()
163189
# notify if the platform switch failed
164190
if [ $platform_switch -ne 0 ]; then
165191
# heavy X
166-
echo -e "\xe2\x9c\x96"
192+
echo -e "\033[0;31m\xe2\x9c\x96"
167193
echo $platform_stdout
168194
exit_code=1
169195
else
170196
# heavy checkmark
171-
echo -e "\xe2\x9c\x93"
197+
echo -e "\033[0;32m\xe2\x9c\x93"
172198
fi
173199

174200
echo "########################################################################";
@@ -193,7 +219,7 @@ function build_platform()
193219
# continue to next example if platform switch failed
194220
if [ $platform_switch -ne 0 ]; then
195221
# heavy X
196-
echo -e "\xe2\x9c\x96"
222+
echo -e "\033[0;31m\xe2\x9c\x96"
197223

198224
# add json
199225
PLATFORM_JSON="${PLATFORM_JSON}$(json_sketch 0 $example_file $last_example)"
@@ -243,7 +269,7 @@ function build_platform()
243269
if [[ $example =~ \.pde$ ]]; then
244270

245271
# heavy X
246-
echo -e "\xe2\x9c\x96"
272+
echo -e "\033[0;31m\xe2\x9c\x96"
247273

248274
echo -e "-------------------------- DEBUG OUTPUT --------------------------\n"
249275
echo "PDE EXTENSION. PLEASE UPDATE TO INO"
@@ -272,7 +298,7 @@ function build_platform()
272298
if [ $? -ne 0 ]; then
273299

274300
# heavy X
275-
echo -e "\xe2\x9c\x96"
301+
echo -e "\033[0;31m\xe2\x9c\x96"
276302

277303
echo -e "----------------------------- DEBUG OUTPUT -----------------------------\n"
278304
echo "$build_stdout"
@@ -290,7 +316,7 @@ function build_platform()
290316
else
291317

292318
# heavy checkmark
293-
echo -e "\xe2\x9c\x93"
319+
echo -e "\033[0;32m\xe2\x9c\x93"
294320

295321
# add json
296322
PLATFORM_JSON="${PLATFORM_JSON}$(json_sketch 1 "$example_file" $last_example)"

0 commit comments

Comments
 (0)