Sunday, 22 January 2012

Travis CI

So previously I wrote about Heroku which is a cloud based PaaS service. On the same theme I want to try out another cloud service for development: Travis CI. This tool was suggested to me today by a community committer at my work.

Travis CI is a cloud based continuous integration tool that has deep integration with Github so fits perfectly with the recommended stack outlined in the Rails tutorial I mentioned in my last post.

So I wanted to try this tool out with some sample code, I decided to just try it on the tutorial code I had written last time: Jakovo.

So I followed the Getting Started instructions on the Travis website:

  • Logged into the website using Github
  • Authorised Travis-CI to access my public github projects
  • Went to my profile page and flicked the switch for Jakovo
  • Added a .travis.yml file to my project
  • Committed the git changes to my project, and push it to Github
At first it broke. The results are here (but here is a screenshot):



There needs to be a database created before the tests can succeed. So I jumped to the next part of the Travis CI documentation and read-on.

Turns out the solution is to just provide a setup step before you run the test, its recommended that if you have a lot of steps you write separate scripts for this - but I'm going to take the easy option and just add:

before_script: bundle exec rake db:migrate

To the definition file. Again, committing and pushing this to Github, I get back positive results for the next test. Fairly impressive really:



What impressed me about this, is just like Jenkins it displays the running results in real-time so you can see it do the build instead of waiting for a failure/success.

The Github integration is sublime and suits my preferred workflow perfectly. The ability for users to have their clones be tested before they submit a pull request to a main clone will surely be helpful as well (although I haven't looked into how to do this on a topic branch yet).

I guess the only gap I see is the ability to have code tested on multiple platforms, which in my business is important. However, for a lot of projects this won't matter.

The ability to choose different Ruby revisions, Gemfiles and Environments creates an interesting matrix capability which parallels the capability in Jenkins that I find quite useful.

All in all - this looks like a fascinating and useful tool.

No comments:

Post a Comment