Configuring Cruisecontrol, Git and RSpec
The realization we needed a continuous integration server sank in good last week when work on our internal project really got started. The project has seen quite some development in the past, mainly when my skills in (RSpec) testing where, uhm, less than optimal. This on top of some high pressure hacking left the project in a pretty shabby shape. We are now working on it with three people and we’d like to introduce a bit more rigour in our development process.
One of the first steps was to use a continuous integration server. I was actually surprised so few existed and the choice for CruiseControl(CC) was a quick one. This pretty piece of software did not support Git out of the box but there exists a GitHub branch incorporating this functionality. What is even better is this post which explains how to use it! So I won’t go into the nitty gritty details, what I will do is point out some pit falls and how to make CruiseControl play nice with RSpec. Which it also does not support out of the box but which is really easy.
Install CC as per previously mentioned post. What threw me off where the site_config.rb and the cruise_config.rb I got the (wrong) impression that these files lived in the root directory of the CC install. This is not the case. When installing CC it, by default, creates a directory ~/.cruise which holds your projects. It is here where the site_config.rb file lives. And this is the file to configure ActionMailer! And in the directory ~/.cruise/projects/MyProject the other file can be found in which to configure the people who need to receive emails when the build breaks.
When CC builds a project it just runs some Rake tasks, one of which is cruise. Getting CC to use RSpec is as simple a overwriting this task! This is what I gleaned from other posts:
desc "Task to do some preparations for CruiseControl" task :prepare do RAILS_ENV = 'test' end desc "Task for CruiseControl.rb, automatically picked up" task :cruise => [:prepare, "db:migrate", "spec"] do end
The first task is to make sure the test environment is used which is really what you want in a situation like this.
The next step would be to produce something more readable than the dump of the log file with the results of the ran RSpecs.
Tags: cruisecontrol, git, rspec
May 14th, 2008 at 4:07 pm
Hi,
FYI, we’ve got Git support into CC.rb master branch now.
–
Alex
May 14th, 2008 at 6:44 pm
That is most excellent! Thanks for telling.
May 26th, 2008 at 7:21 pm
Anothr feed track -Ruby Tutorials…
One new subscriber from Anothr Alerts…