|

Travis CI and Multi-Language Projects

Travis CI is an awesome free-of-charge continuous integration service. Go and check it, if you haven’t tried it yet. What I appreciate in particular is a broad range of supported programming languages. Should you happen to have a project based on more than a single language though, then you might wonder if and how the builds would work.

When checking the docs you soon find out  that each of the supported languages is described in isolation. Indeed, when it comes to the build configuration, one of the very first steps is an explicit choice of a single language:

[bash]
language: java
[/bash]


The project I was looking to integrate with Travis CI was a hybrid powered by gradle and gulp and comprising Java, Scala and JavaScript. How could I possibly overcome that single-language limitation? Surprisingly enough, a request for multiple simultaneous languages has been around for a long time. I couldn’t understand why it was never added. Luckily, this conversation on github pointed me to the right direction. Turns out the only thing to worry about are project dependencies (obvious, huh?). It didn’t take long before I was thrilled to see my first successful build.

After only a few failed build attempts I had the final version of my build script ready:

[code]
language: java
before_install:
– npm install gulp gulp-mocha gulp-util chai
– sudo apt-get update
– sudo apt-get install scala
script: “gradle build”
[/code]

As you can see I simply made sure all of the dependencies were fetched ahead of the actual build. 

The actual build output – it’s easy to see how closely it matches the config
 


It might take a while for all the downloads to complete, but the overall build time was still impressive.

The project (a demo of basic algorithms and data structures) is available on github. And so is a link to the build page.



Similar Posts