From 8a77a927f2b695140f747ed5c1782db28fcb578f Mon Sep 17 00:00:00 2001 From: Doc Walker <4-20ma@wvfans.net> Date: Sat, 10 Sep 2016 21:41:37 -0500 Subject: [PATCH 1/4] Add missing travis support files --- travis/common.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 travis/common.sh diff --git a/travis/common.sh b/travis/common.sh new file mode 100755 index 0000000..d115085 --- /dev/null +++ b/travis/common.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +function build_examples() +{ + # track the exit code for this platform + local exit_code=0 + # loop through results and add them to the array + examples=($(find $PWD/examples/ -name "*.pde" -o -name "*.ino")) + + # get the last example in the array + local last="${examples[@]:(-1)}" + + # loop through example sketches + for example in "${examples[@]}"; do + + # store the full path to the example's sketch directory + local example_dir=$(dirname $example) + + # store the filename for the example without the path + local example_file=$(basename $example) + + echo "$example_file: " + local sketch="$example_dir/$example_file" + echo "$sketch" + #arduino -v --verbose-build --verify $sketch + + # verify the example, and save stdout & stderr to a variable + # we have to avoid reading the exit code of local: + # "when declaring a local variable in a function, the local acts as a command in its own right" + local build_stdout + build_stdout=$(arduino --verify $sketch 2>&1) + + # echo output if the build failed + if [ $? -ne 0 ]; then + # heavy X + echo -e "\xe2\x9c\x96" + echo -e "----------------------------- DEBUG OUTPUT -----------------------------\n" + echo "$build_stdout" + echo -e "\n------------------------------------------------------------------------\n" + + # mark as fail + exit_code=1 + + else + # heavy checkmark + echo -e "\xe2\x9c\x93" + fi + done + + return $exit_code +} From aa39b7d0d077779653251b37d84df6b6eaa22912 Mon Sep 17 00:00:00 2001 From: Doc Walker <4-20ma@wvfans.net> Date: Sat, 10 Sep 2016 21:46:01 -0500 Subject: [PATCH 2/4] Clean up use of env vars --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6c4888e..59fc746 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,11 +8,11 @@ before_install: - sudo mv arduino-1.6.5 /usr/local/share/arduino - sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino install: - - ln -s $PWD /usr/local/share/arduino/libraries/ModbusMaster + - ln -s ${PWD} /usr/local/share/arduino/libraries/ModbusMaster - arduino --pref "compiler.warning_level=all" --save-prefs script: - - "echo $PWD" - - "echo $HOME" - - "ls $PWD" - - source $TRAVIS_BUILD_DIR/travis/common.sh + - echo $PWD + - echo $HOME + - ls -al $PWD + - source ${TRAVIS_BUILD_DIR}/travis/common.sh - build_examples From ccda3da07b51d189ff3725e4cbab5d794dd265ac Mon Sep 17 00:00:00 2001 From: Doc Walker <4-20ma@wvfans.net> Date: Sat, 10 Sep 2016 21:51:30 -0500 Subject: [PATCH 3/4] Refactor Arduino version to env var --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 59fc746..4903f98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,12 @@ language: c before_install: + - export ARDUINO_VERSION=1.6.5 - "/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 - - wget http://downloads.arduino.cc/arduino-1.6.5-linux64.tar.xz - - tar xf arduino-1.6.5-linux64.tar.xz - - sudo mv arduino-1.6.5 /usr/local/share/arduino + - wget http://downloads.arduino.cc/arduino-${ARDUINO_VERSION}-linux64.tar.xz + - tar xf arduino-${ARDUINO_VERSION}-linux64.tar.xz + - sudo mv arduino-${ARDUINO_VERSION} /usr/local/share/arduino - sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino install: - ln -s ${PWD} /usr/local/share/arduino/libraries/ModbusMaster From 9a07a91ecdcd467c219461a8734f7a8f8f7a05a6 Mon Sep 17 00:00:00 2001 From: Doc Walker <4-20ma@wvfans.net> Date: Sat, 10 Sep 2016 21:51:51 -0500 Subject: [PATCH 4/4] Add travis badge to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 15d81d5..b83310c 100755 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ ModbusMaster ============ [![Tag](https://img.shields.io/github/tag/4-20ma/ModbusMaster.svg)][Tag] +[![Travis](https://img.shields.io/travis/4-20ma/ModbusMaster.svg)][Travis] [![License](https://img.shields.io/github/license/4-20ma/ModbusMaster.svg)][License] [![Code of conduct](https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-blue.svg)][Code of conduct] [Tag]: https://github.com/4-20ma/ModbusMaster +[Travis]: https://travis-ci.org/4-20ma/ModbusMaster [License]: COPYING [Code of conduct]: https://github.com/4-20ma/ModbusMaster/blob/master/CODE_OF_CONDUCT.md