Setting up a Hudson Continuous Integration Testing Server for Ruby(and Rails)

If you work on a project with multiple developers, a continuous integration testing setup is a must. A CI package will run automated tests on a server on a set(daily) or evented(whenever commits are made) interval.
There are a number of continuous integration packages for Ruby software including CI Joe, CruiseControl.rb. I chose Hudson because it is extendable via plugins and has great support for running automated testing for non-ruby software as well.

Install hudson and jetty:

Hudson itself is a self contained Java servlet. You can either run it in a servlet container like jetty by sticking hudson.war into the webapps directory or just running it using java -jar hudson.war

On your testing server:

Set a working dir:

export HUDSON_HOME=/data/apps/test/hudson

Install ci_reporter:

sudo gem install ci_reporter

Install plugins:

cd /data/apps/test/hudson/plugins

Setting up a Project in Hudson

We can follow these tasks to create a CI job for a Ruby on Rails 3.0 project.
Hudson will be accessible from http://localhost:8080 or http://localhost:8080/hudson if you used a servlet container.

Click ‘New Job’
Click ‘Build a free-style software project’
This lets you use a custom ruby app.

On the project configuration page:
set the git repo and the option to poll SCM
Add a Execute Shell option with:

bundle install

This will install all the necessary gems from the Gemfile.

Finally, add the rake task for the actual testing itself.
Invoke Rake


You can test the setup by clicking the “Build Now” link. In the future, the “Poll SCM” will just run your tests on a set interval whenever code is pushed to your git repo.

2 thoughts on “Setting up a Hudson Continuous Integration Testing Server for Ruby(and Rails)

  1. Pingback: Link dump for August 11th | The Queue Blog

  2. Pingback: Part One: Setting up CI Glory for Rails | GC

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s