Many of you might know it, but I finally found the motivation to try continuous integration. Maybe you have seen the icons lately on projects on GitHub:
This icon is generated by Travis CI, a hosted solution for continuous integration for open source projects on GitHub. What is continous integration? It is basically a way of checking out the software, running the test suite and seeing whether it passes or not and if it doesn’t where it fails. So basically what you would do on your PC anyway. The advantage is that the CI system can set up your project in different configurations, so think multiple Python versions, multiple Node.js versions and in theory multiple operating systems. The latter is not quite true for Travis-CI because it only runs Linux but oh well.
Getting started is actually surprisingly easy, since all you need is a GitHub account. I clicked the Log-in link on the Travis-CI site and after a few moments GitHub asked me whether I want to let Travis CI access a few things on my profile and that is it, a new user was created in Travis CI without me typing any passwords or whatnot. Fancy. After that I set up a hook in GitHub to notify Travis of new commits in my GitHub repo.
Next step was adding a .travis.yml
to my repo, because Travis assumes you are
a Ruby project when building. Travis supports a number of environments, so I
just chose Node.js (I deny calling Node.js a language). Next push into my repo,
and Travis CI checked it out, ran npm test
and decided by the return code
whether the build succeeded or failed.
The result looks like this. When someone (aka me) breaks the build, Travis sends an email that the build is broken, and when someone fixes the build I get a mail that it got fixed (prevents spamming me with mails that nothing changed). Overall, a quite elegant solution and completely free for FOSS projects.
Drawbacks: sometimes Travis-CI chockes for no reason, like the Git clone hangs forever and nothing is happening. In my limited experience the build got restarted after a time, but I could imagine, sometimes you get broken builds because of the failure of the CI system. Also, due to being language agnostic, Travis does not really provide a way to show how many tests succeeded or failed in one look. You can look at the console output, but if you have even one failing test, the build status will be “broken”, without any more helpful messages.
Maybe we’ll get a better solution in the future, but for now I am quite impressed.