Merge pull request #26 from adafruit/travis-cache

Travis cache
This commit is contained in:
deanm1278 2018-07-09 17:45:30 -04:00 committed by GitHub
commit aa64a8fc4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 26 deletions

View file

@ -1,5 +1,17 @@
language: c
sudo: false
cache:
directories:
- ~/arduino_ide
# Caches Arduino IDE + ESP32 platform
- ~/.arduino15/packages/
# Caches Arduino platforms
git:
depth: false
quiet: true
env:
global:
- ARDUINO_IDE_VERSION="1.8.5"
before_install:
- source <(curl -SLs https://raw.githubusercontent.com/${TRAVIS_REPO_SLUG}/${TRAVIS_BRANCH}/install.sh)
script:
@ -11,4 +23,4 @@ script:
notifications:
email:
on_success: change
on_failure: change
on_failure: change

View file

@ -20,6 +20,16 @@ source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/
```
language: c
sudo: false
cache:
directories:
- ~/arduino_ide
- ~/.arduino15/packages/
git:
depth: false
quiet: true
env:
global:
- ARDUINO_IDE_VERSION="1.8.5"
before_install:
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
install:

View file

@ -1,13 +1,15 @@
language: c
sudo: false
# Blacklist
branches:
except:
- gh-pages
cache:
directories:
- ~/arduino_ide
- ~/.arduino15/packages/
git:
depth: false
quiet: true
env:
global:
- ARDUINO_IDE_VERSION="1.8.5"
- PRETTYNAME="Adafruit FT6206 Arduino Library"
# Optional, will default to "$TRAVIS_BUILD_DIR/Doxyfile"
# - DOXYFILE: $TRAVIS_BUILD_DIR/Doxyfile

View file

@ -28,10 +28,26 @@ export IO_PLATFORMS='declare -A io_platforms=( [zero]="arduino:samd:arduino_zero
sleep 3
export DISPLAY=:1.0
# download and install arduino 1.8.5
wget --quiet https://downloads.arduino.cc/arduino-1.8.5-linux64.tar.xz
tar xf arduino-1.8.5-linux64.tar.xz
mv arduino-1.8.5 $HOME/arduino_ide
# if .travis.yml does not set version
if [ -z $ARDUINO_IDE_VERSION ]; then export ARDUINO_IDE_VERSION="1.8.5"; fi
# if newer version is requested
if [ ! -f $HOME/arduino_ide/$ARDUINO_IDE_VERSION ] && [ -f $HOME/arduino_ide/arduino ]; then
shopt -s extglob
rm -r -f !(esp32)
cd $OLDPWD
echo "DIFFERENT VERSION OF ARDUINO IDE REQUESTED!"
fi
# if not already cached, download and install arduino 1.8.5
if [ ! -f $HOME/arduino_ide/arduino ]; then
echo "DOWNLOADING ARDUINO IDE..."
wget --quiet https://downloads.arduino.cc/arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz
echo "UNPACKING ARDUINO IDE..."
mkdir $HOME/arduino_ide
tar xf arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz -C $HOME/arduino_ide/ --strip-components=1
touch $HOME/arduino_ide/$ARDUINO_IDE_VERSION
fi
# move this library to the arduino libraries folder
ln -s $PWD $HOME/arduino_ide/libraries/Adafruit_Test_Library
@ -47,9 +63,11 @@ echo "########################################################################";
# install the due, esp8266, and adafruit board packages
echo -n "ADD PACKAGE INDEX: "
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)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
echo -n "ESP32: "
if [ ! -d $HOME/Arduino/hardware/espressif ]; then
DEPENDENCY_OUTPUT=$(mkdir -p $HOME/Arduino/hardware/espressif &&
cd $HOME/Arduino/hardware/espressif &&
git clone https://github.com/espressif/arduino-esp32.git esp32 &&
@ -57,38 +75,47 @@ DEPENDENCY_OUTPUT=$(mkdir -p $HOME/Arduino/hardware/espressif &&
python get.py &&
cd $TRAVIS_BUILD_DIR
)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
else
DEPENDENCY_OUTPUT=$(cd $HOME/Arduino/hardware/espressif &&
git pull origin master &&
cd esp32/tools/ &&
python get.py &&
cd $TRAVIS_BUILD_DIR
)
fi
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
echo -n "DUE: "
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:sam 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
echo -n "ZERO: "
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:samd 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
echo -n "ESP8266: "
DEPENDENCY_OUTPUT=$(arduino --install-boards esp8266:esp8266 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
echo -n "ADAFRUIT AVR: "
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:avr 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
echo -n "ADAFRUIT SAMD: "
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:samd 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
# install random lib so the arduino IDE grabs a new library index
# see: https://github.com/arduino/Arduino/issues/3535
echo -n "UPDATE LIBRARY INDEX: "
DEPENDENCY_OUTPUT=$(arduino --install-library USBHost > /dev/null 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
# set the maximal compiler warning level
echo -n "SET BUILD PREFERENCES: "
DEPENDENCY_OUTPUT=$(arduino --pref "compiler.warning_level=all" --save-prefs 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
# init the json temp var for the current platform
export PLATFORM_JSON=""
@ -163,12 +190,12 @@ function build_platform()
# notify if the platform switch failed
if [ $platform_switch -ne 0 ]; then
# heavy X
echo -e "\xe2\x9c\x96"
echo -e "\033[0;31m\xe2\x9c\x96"
echo $platform_stdout
exit_code=1
else
# heavy checkmark
echo -e "\xe2\x9c\x93"
echo -e "\033[0;32m\xe2\x9c\x93"
fi
echo "########################################################################";
@ -193,7 +220,7 @@ function build_platform()
# continue to next example if platform switch failed
if [ $platform_switch -ne 0 ]; then
# heavy X
echo -e "\xe2\x9c\x96"
echo -e "\033[0;31m\xe2\x9c\x96"
# add json
PLATFORM_JSON="${PLATFORM_JSON}$(json_sketch 0 $example_file $last_example)"
@ -243,7 +270,7 @@ function build_platform()
if [[ $example =~ \.pde$ ]]; then
# heavy X
echo -e "\xe2\x9c\x96"
echo -e "\033[0;31m\xe2\x9c\x96"
echo -e "-------------------------- DEBUG OUTPUT --------------------------\n"
echo "PDE EXTENSION. PLEASE UPDATE TO INO"
@ -272,7 +299,7 @@ function build_platform()
if [ $? -ne 0 ]; then
# heavy X
echo -e "\xe2\x9c\x96"
echo -e "\033[0;31m\xe2\x9c\x96"
echo -e "----------------------------- DEBUG OUTPUT -----------------------------\n"
echo "$build_stdout"
@ -290,7 +317,7 @@ function build_platform()
else
# heavy checkmark
echo -e "\xe2\x9c\x93"
echo -e "\033[0;32m\xe2\x9c\x93"
# add json
PLATFORM_JSON="${PLATFORM_JSON}$(json_sketch 1 "$example_file" $last_example)"