18 December 2013

This is just a quickie. While working on freezr I decided to take a look at Travis CI, which is a “hosted continuous integration service for the open source community” (as they say).

And wow, is it easy. It is.

In just a few lines of

 1  .travis.yml
and some clickety-clackety of enabling github hooks to travis made all of new code to be automatically tested in travis. Being free of charge for open source projects just makes it doubly good!

(Which reminds me, I’ll have to attach the OSI-approved license to freezr. It is open source, but I haven’t just gotten around to writing the boring licensing stuff…)

There was … well. Why am I always getting a gotcha moment? Am I just somehow abnormally suspectible to finding corner cases?

Anyway, here’s the

 1  .travis.yml
file:

1
2
3
4
5
6
7
8
9
10
11
12
13
language: python
python:
- "2.7"
env:
global:
- PATH=$PATH:$TRAVIS_BUILD_DIR/node_modules/.bin
install:
- npm install less coffee-script
- pip install .
services:
- rabbitmq
script:
- make actual-test


The gotcha is getting node’s local install bin directory into

 1  PATH
environmental variable. Travis by default does have 1 ./node_modules/.bin in 1 PATH so unless you change the current working directory you have no problems in running npm-installed programs.

(Of course I did change the working directory during tests.)

So if you do

 1  npm install
in Travis, keep in mind that by default the non-global NPM install bin directory is not necessarily found via 1 PATH. That it works by default is a happy coincidence, not a guarantee.

(I could do

 1  sudo npm install -g
, but I try to avoid changing global system state unless absolutely necessary.)