Martin Fowler says Continuous Integration is a software development practice where “members of a team integrate their work frequently, usually each person integrates at least daily. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible”.

Continuous integration has many advantages, if everyone commits frequently, the code base does not diverge too much and nasty conflicts are avoided, bugs or broken code can be detected easily due to automated builds and tests, and everyone can see the results of the latest build immediately. The principle is simple: merging is much easier to do frequently and small rather than rarely and large. As written earlier, continuous integration and agile development are very similar: frequent interaction and merging reduces conflicts and prevents that things diverge too much from each other.

ThoughtWorks offers a highly recommend open source software solution named CruiseControl.rb to make automated builds of Ruby on Rails projects. To run CruiseControl.rb, download the source code from the URL  http://cruisecontrolrb.thoughtworks.com/ . Install it as a normal Rails application in a directory and setup a  webserver for it, for example an Apache using Phusion Passenger. Then add your projects with “cruise add”, for instance

$ ./cruise add your_app_name --repository repository_url

If you have a Linux machine, this will install your project in the directory

$ ls /home/your_login/.cruise/projects/your_app_name/work

Finally you must add the config files in the config subdirectory

$ cd /home/your_login/.cruise/projects/your_app_name/work/config

that is to say a database.yml which points to an existing test database. Then you are done, and get start with continuous integration !

P.S. If you are using Sphinx you will probably need a config files for Sphinx, for example ultrasphinx/development.base in case of UltraSphinx or test.sphinx.conf for ThinkingSphinx generated with RAILS_ENV=test rake ts:conf

Advertisements