Skip to content

Instantly share code, notes, and snippets.

@jacobrosenthal
Created April 1, 2015 07:04
Show Gist options
  • Save jacobrosenthal/ffeadc44ebcc03b9b09b to your computer and use it in GitHub Desktop.
Save jacobrosenthal/ffeadc44ebcc03b9b09b to your computer and use it in GitHub Desktop.
Arduino command line travis testing
# Test build your arduino libraries with travis and the official arduino tool chain
# assumes directory structure
# /NullStream
# NullStream.h
# NullStream.cpp
# examples
# NullStreamExample
# NullStreamExample.ino
language: cpp
env:
# We'll test against only a single library example, and only for uno, but you could add more combinations
# https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc
- BOARD=arduino:avr:uno NAME=NullStreamExample
# - BOARD=attiny:avr:attiny85 NAME=$NullStreamExample
compiler:
- gcc
before_install:
- sudo apt-get update -qq && sudo apt-get install -qq openjdk-6-jre avr-libc gcc-avr xvfb
install:
# arduino
- wget http://downloads-02.arduino.cc/arduino-1.6.1-linux64.tar.xz
- tar -xvf arduino-1.6.1-linux64.tar.xz
- sudo mv arduino-1.6.1/ /usr/local/share/arduino
# you could add attiny the extra attiny board package
# - wget https://github.com/damellis/attiny/archive/ide-1.6.x.zip
# - unzip ide-1.6.x.zip
# - sudo mv attiny-ide-1.6.x/attiny /usr/local/share/arduino/hardware/
before_script:
# arduino requires an X server even with command line
# https://github.com/arduino/Arduino/issues/1981
- Xvfb :1 -screen 0 1024x768x16 &> xvfb.log &
# put your source files in a folder under a new libraries folder
- sudo mkdir /usr/src/arduino
- sudo mkdir /usr/src/arduino/libraries
- sudo ln -s $TRAVIS_BUILD_DIR /usr/src/arduino/libraries/something
script:
- sudo DISPLAY=:1.0 /usr/local/share/arduino/arduino --board $BOARD --pref sketchbook.path=/usr/src/arduino --verify /usr/src/arduino/libraries/something/examples/$NAME/$NAME.ino
@awong1900
Copy link

Nice work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment