Continuous Integration

Posted by Jonathan

As a follower of Extreme Programming and Test Driven Development I strive for Continuous Integration. This means that after every commit an agent automatically builds the project, runs every test and bail in case of errors. This should insure that the project is always build-able and that no errors are sneaking in. The automation is very important as developers tend to be sloppy and forget to build or run all tests. Also if the complete build is taking too long in order to test it locally after each change, Continuous Integration can help. Have a look at this article by Martin Fowler for more about Continuous Integration and why you should use it.

While poking around in the Ruby on Rails subversion source code tree I found CIA, the Continuous Integration Automater. Seems like again Ruby on Rails is a leader in integrating known processes, patterns and tools into an excellent framework for web development. CIA follows the above described workflow of Continuous Integration and is easy to set up. It works as a post-commit hook in Subversion. Quoting the README:

Setting up CIA requires that you’re on the same machine as the repository. If
you haven’t already activated the post-commit hook, then copy /path/to/repos/hooks/post-commit.tmpl
to /path/to/repos/hooks/post-commit and add to the bottom of it:

/
path/to/cia/script/runner “Agent.build(”$REPOS”, $REV)”

Another usefull tool developed in the Ruby community is DamageControl. DamageControl comes as a ruby-gem and can build several dependent projects. The project can be in an arbitrary language as long as it can be built by executing a simple command line. That means that if your project uses for example Ant, Make, Rake or Rant you can use DamageControl. Refer to the documentation for more information.

I will start using CIA for my next Ruby on Rails project and will publish my experiences with this tool.

UPDATE:
I wrote a small HOWTO on CIA, rails, and subversion here.

Comments

Leave a response

  1. Jacob StetserMay 15, 2005 @ 11:28 AM
    I figured out a really nice and simple way to do continuous testing on my Mac OS X machine - using the built-in rake testing facilities and a tiny little app called 'stakeout'. I [detailed the tip][tip] on my blog... [tip]: http://blog.unquiet.net/archives/2005/05/14/continuous-testing-with-os-x-and-rails/