Ingo Weiss
2007-Oct-24 16:56 UTC
[Cruisecontrolrb-users] rspec html report and rcov report as build artifacts
Hi all, we are using rspec and would like to make both an rspec html report and an rcov html report available as cc build artifacts. I cobbled something together for the rspec report, but it feels clunky and I am wondering whether anybody has written a plugin or something for this already. Failing that, I am wondering how to tell cc where the build artifacts directory is. Thanks! Ingo
gcnovus
2007-Dec-21 21:11 UTC
[Cruisecontrolrb-users] rspec html report and rcov report as build artifacts
I find the following works fairly well for the rcov output:
1. create a build_settings.rb file in your [rails_project]/lib directory
that contains the following:
module BuildSettings
attr_reader :coverage_dir
def coverage_dir
@coverage_dir ||= ( ENV[''CC_BUILD_ARTIFACTS''] ||
''coverage'' )
end
end
2. include the file at the top of your rake file
([rails_project]/lib/tasks/my_project.rake) and use that method in the tasks
:
require "#{RAILS_ROOT}/lib/build_settings"
...
desc "Task for cruise Control"
task :cruise do
Rake::Task[''test:coverage:run''].invoke
end
namespace :test do
namespace :coverage do
include BuildSettings
desc "Run specs and rcov"
Spec::Rake::SpecTask.new(:run => [''test:prepare'',
''test:coverage:prepare'']) do |t|
t.verbose = true
t.spec_opts = [ ... ]
t.spec_files = [ ... ]
t.rcov = true
t.libs = [''lib'']
t.rcov_dir = coverage_dir
t.rcov_opts = [ ... ]
end
end
end
That way, if you call rake cruise manually, it defaults to
[rails_project]/coverage. If CruiseControl runs it, it sets the property
for the task.
My problem with this setup is that, while all the rcov files end up in the
"Custom Build Artifacts" section, I can''t get the build.log
to work
properly. I always just get "build failed" if it fails, and the
message,
"/home/builder/cruisecontrolrb-1.2.1/projects/foo/build-10/build.log
doesn''t
exist"
Anybody else seeing this problem? I''ve tried calling the regular
"test"
task before the "spec" task to no avail.
-Gaius
Ingo Weiss-3 wrote:>
> ...
> we are using rspec and would like to make both an rspec html report
> and an rcov html report available as cc build artifacts. I cobbled
> something together for the rspec report, but it feels clunky and I am
> wondering whether anybody has written a plugin or something for this
> already.
> ...
>
--
View this message in context:
http://www.nabble.com/rspec-html-report-and-rcov-report-as-build-artifacts-tp13390178p14462351.html
Sent from the CruiseControl.rb - Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20071221/a6d52dd0/attachment-0001.html
gcnovus
2007-Dec-23 19:30 UTC
[Cruisecontrolrb-users] rspec html report and rcov report as build artifacts
I''ve narrowed it down a bit more. It only happens if I include "t.rcov true" It seems to have something to do with the way Rspec_on_Rails calls the Rcov script. -Gaius My problem with this setup is that, while all the rcov files end up in the "Custom Build Artifacts" section, I can''t get the build.log to work properly. I always just get "build failed" if it fails, and the message, "/home/builder/cruisecontrolrb-1.2.1/projects/foo/build-10/build.log doesn''t exist" -- View this message in context: http://www.nabble.com/rspec-html-report-and-rcov-report-as-build-artifacts-tp13390178p14481110.html Sent from the CruiseControl.rb - Users mailing list archive at Nabble.com.