Skip to content

Commit aa64a8f

Browse files
authored
Merge pull request espressif#26 from adafruit/travis-cache
Travis cache
2 parents 1f99208 + 518f038 commit aa64a8f

File tree

4 files changed

+77
-26
lines changed

4 files changed

+77
-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: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,26 @@ 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+
mkdir $HOME/arduino_ide
48+
tar xf arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz -C $HOME/arduino_ide/ --strip-components=1
49+
touch $HOME/arduino_ide/$ARDUINO_IDE_VERSION
50+
fi
3551

3652
# move this library to the arduino libraries folder
3753
ln -s $PWD $HOME/arduino_ide/libraries/Adafruit_Test_Library
@@ -47,48 +63,59 @@ echo "########################################################################";
4763
# install the due, esp8266, and adafruit board packages
4864
echo -n "ADD PACKAGE INDEX: "
4965
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
66+
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
5167

5268
echo -n "ESP32: "
69+
70+
if [ ! -d $HOME/Arduino/hardware/espressif ]; then
5371
DEPENDENCY_OUTPUT=$(mkdir -p $HOME/Arduino/hardware/espressif &&
5472
cd $HOME/Arduino/hardware/espressif &&
5573
git clone https://github.com/espressif/arduino-esp32.git esp32 &&
5674
cd esp32/tools/ &&
5775
python get.py &&
5876
cd $TRAVIS_BUILD_DIR
5977
)
60-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
78+
else
79+
DEPENDENCY_OUTPUT=$(cd $HOME/Arduino/hardware/espressif &&
80+
git pull origin master &&
81+
cd esp32/tools/ &&
82+
python get.py &&
83+
cd $TRAVIS_BUILD_DIR
84+
)
85+
fi
86+
87+
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
6188

6289
echo -n "DUE: "
6390
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
91+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
6592

6693
echo -n "ZERO: "
6794
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
95+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
6996

7097
echo -n "ESP8266: "
7198
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
99+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
73100

74101
echo -n "ADAFRUIT AVR: "
75102
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
103+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
77104

78105
echo -n "ADAFRUIT SAMD: "
79106
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
107+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
81108

82109
# install random lib so the arduino IDE grabs a new library index
83110
# see: https://github.com/arduino/Arduino/issues/3535
84111
echo -n "UPDATE LIBRARY INDEX: "
85112
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
113+
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
87114

88115
# set the maximal compiler warning level
89116
echo -n "SET BUILD PREFERENCES: "
90117
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
118+
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
92119

93120
# init the json temp var for the current platform
94121
export PLATFORM_JSON=""
@@ -163,12 +190,12 @@ function build_platform()
163190
# notify if the platform switch failed
164191
if [ $platform_switch -ne 0 ]; then
165192
# heavy X
166-
echo -e "\xe2\x9c\x96"
193+
echo -e "\033[0;31m\xe2\x9c\x96"
167194
echo $platform_stdout
168195
exit_code=1
169196
else
170197
# heavy checkmark
171-
echo -e "\xe2\x9c\x93"
198+
echo -e "\033[0;32m\xe2\x9c\x93"
172199
fi
173200

174201
echo "########################################################################";
@@ -193,7 +220,7 @@ function build_platform()
193220
# continue to next example if platform switch failed
194221
if [ $platform_switch -ne 0 ]; then
195222
# heavy X
196-
echo -e "\xe2\x9c\x96"
223+
echo -e "\033[0;31m\xe2\x9c\x96"
197224

198225
# add json
199226
PLATFORM_JSON="${PLATFORM_JSON}$(json_sketch 0 $example_file $last_example)"
@@ -243,7 +270,7 @@ function build_platform()
243270
if [[ $example =~ \.pde$ ]]; then
244271

245272
# heavy X
246-
echo -e "\xe2\x9c\x96"
273+
echo -e "\033[0;31m\xe2\x9c\x96"
247274

248275
echo -e "-------------------------- DEBUG OUTPUT --------------------------\n"
249276
echo "PDE EXTENSION. PLEASE UPDATE TO INO"
@@ -272,7 +299,7 @@ function build_platform()
272299
if [ $? -ne 0 ]; then
273300

274301
# heavy X
275-
echo -e "\xe2\x9c\x96"
302+
echo -e "\033[0;31m\xe2\x9c\x96"
276303

277304
echo -e "----------------------------- DEBUG OUTPUT -----------------------------\n"
278305
echo "$build_stdout"
@@ -290,7 +317,7 @@ function build_platform()
290317
else
291318

292319
# heavy checkmark
293-
echo -e "\xe2\x9c\x93"
320+
echo -e "\033[0;32m\xe2\x9c\x93"
294321

295322
# add json
296323
PLATFORM_JSON="${PLATFORM_JSON}$(json_sketch 1 "$example_file" $last_example)"

0 commit comments

Comments
 (0)