-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from 4-20ma/55-add-ci-testing-with-travis
55 add ci testing with travis
- Loading branch information
Showing
3 changed files
with
62 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
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 | ||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |