Teensy and Continuous Integration

Status
Not open for further replies.

chipaudette

Well-known member
Hi,

I'm thinking about attaching some continuous integration testing to my GitHub so that when I update my Teensy-oriented libraries, all of the example sketches are checked.

I found a good adafruit example for testing standard Arduino code via Travis (https://learn.adafruit.com/continuous-integration-arduino-and-you/testing-your-project) but I assume that it will fail for lack of the Teensyduino add-on to the Arduino compiler (though I don't really undersand how the Arduino-Teensy things relate to each other at the compiler level)

Has anyone used continuous integration with Teensy? I'd love some pointers!

Chip
 
Has anyone used continuous integration with Teensy?

https://travis-ci.org/newdigate/teensy-blink

I've been meaning to get travis working with my teensy codes for a while. I basically copied the latest arduino travis yaml and fudged the rest of the details along the way. - I haven't tested it very well yet, but it seems I've managed to get blink to compile under teensy cores on travis. After many hours of Arduino learning curves, I might have got too excited when it went green...
 
Chip - are/can you (be) on Windows?

The Tset mod I did to FrankB's Compile.cmd creates and leaves a the Compile.cmd file in the Sketch directory - that could be run in Verify mode for the sketch where the output goes to a cmd console window.

How many sketches are involved? If more than one it would just need an outer file to run each and gather the output. It ties to the installed IDE with TeensyDuino and runs the standard Arduino builder process.
 
Here is the link to Windows tool that works from inside an editor - or CMDLINE or double click in Explorer: github.com/Defragster/Tset

The readme there should have notes as needed for use on Windows. There must be way it could be translated to Linux/mAc? If anyone has the skillz let me know.

If the same Teeny board and build options are used for all sketches the Compile.cmd can just be created once and placed in each directory - it scans the dir for an INO to start the builder with - which may be the tricky part - so that could be hardcoded if it helped.

Then running :: C:> Compile.cmd 0
Will do a verify build when then proper default directories to Arduino are given
 
Last edited:
There must be way it could be translated to Linux/mAc? If anyone has the skillz let me know.

I've managed to get an automated build using travis for teensy 3.x projects;

https://github.com/newdigate/teensy-blink

https://travis-ci.org/newdigate/teensy-blink

builds are triggered when changes are pushed to any branches of this repo, and when pull-requests are received.

It gives a good indication when changes break the code, without having to pro-actively validate the changes manually.

I've written some guidelines for other people to follow. I'd be interested if anybody else is interested in checking if they can apply this approach to their github teensy 3.x projects

There are many potential improvements to this script.
 
Here's a repo that uses github and Travis CI with the Teensy:

https://github.com/Tympan/Tympan_Library

We had some trouble with Audio and SD libraries; it appears the Travis build was looking to the default Arduino Audio and SD instead of those for the Teensy. We solved this by specifically calling out these libraries in the platformio.ini file (https://github.com/Tympan/Tympan_Library/blob/master/platformio.ini):

Code:
[env:teensy_device]
platform = teensy
framework = arduino
board = teensy36
build_flags = -D USB_EVERYTHING
lib_deps =
    /home/travis/build/Tympan/Tympan_Library
    https://github.com/PaulStoffregen/Audio.git
    https://github.com/PaulStoffregen/SD.git

We had to use the -D USB_EVERYTHING flag to get the USB audio and USB serial to work.
 
I use https://github.com/xxxajk/Arduino_Make to be able to compile teensy sketches from the commandline. You could very easily integrate this with any sort of CI system. Here's my custom makefile that also calls out to tycmd in order to upload to a teensy from one command `make upload` but obviously that wont work running in some cloud build server

Code:
BOARD=teensy:avr:teensy36:usb=serialhid,speed=180,opt=o1std,keys=en-us
HEX=$(build_aDjOkT_path)/$(build_aDjOkT_project_name).hex
MCU=mk66fx1m0
OBJ_PATH_BASE=build
include Arduino_Make/_Makefile.master

upload: build
	tycmd upload $(HEX)

It uses the 'arduino-builder' tool so it knows how to automatically find the correct Arduino libraries and things and compile them in too.

Re: integrating teensy & arduino, the one gotcha is there is no commandline installer for teensyduino, so what I do is manually install arduino & teensyduino on my laptop, then package it up into a tar file or whatever to install on the build server.
One other gotcha is that it will try to run the GUI teensy uploader tool, to stop that from happening I replaced the file `arduino/hardware/tools/teensy_post_compile` with an empty shell script that does nothing (set it executable)
 
Travis / Platformio / Teensy sync

We've had some trouble with travis-ci platformio builds failing recently; I've found that the platformio teensy platform is not always up to date with the latest teensyduino version. This can be fixed by 1) Rolling back the libraries to match an old teensyduino version, or 2) calling out a newer teensy platform than the default (if one exists). It was a comment from @PaulStoffregen in response to someone else's issue that helped me figure this out.

I'm keeping some notes on Travis / PlatformIO / Teensy continuous integration issues in the Tympan Library wiki:

https://github.com/Tympan/Tympan_Library/wiki
 
Status
Not open for further replies.
Back
Top