2008-08-24 10:25:05 -04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
require 'fileutils'
|
|
|
|
include FileUtils
|
|
|
|
|
2009-11-10 18:18:21 -05:00
|
|
|
def root_dir
|
|
|
|
@root_dir ||= File.expand_path('../..', __FILE__)
|
|
|
|
end
|
|
|
|
|
|
|
|
def rake(*tasks)
|
2010-02-01 20:35:15 -05:00
|
|
|
tasks.each do |task|
|
|
|
|
cmd = "bundle exec rake #{task}"
|
|
|
|
puts "Running command: #{cmd}"
|
|
|
|
return false unless system(cmd)
|
|
|
|
end
|
2009-11-10 20:13:43 -05:00
|
|
|
true
|
2009-11-10 18:18:21 -05:00
|
|
|
end
|
2008-08-24 10:25:05 -04:00
|
|
|
|
2009-11-10 18:18:21 -05:00
|
|
|
puts "[CruiseControl] Rails build"
|
2008-08-24 10:25:05 -04:00
|
|
|
build_results = {}
|
|
|
|
|
2010-02-01 18:04:03 -05:00
|
|
|
# Install rubygems-update, so 'gem update --system' in cruise_config.rb auto-installs it on next build.
|
|
|
|
# This is how you can auto-update rubygems without logging in to CI system
|
|
|
|
build_results[:geminstaller] = system "sudo gem install rubygems-update -v 1.3.5 --no-ri --no-rdoc"
|
2008-08-24 10:25:05 -04:00
|
|
|
|
2010-02-01 18:04:03 -05:00
|
|
|
# Install required version of bundler.
|
2010-02-02 13:19:43 -05:00
|
|
|
build_results[:geminstaller] = system "sudo gem install bundler -v 0.9.0.pre4 --prerelease --no-ri --no-rdoc"
|
2008-08-24 10:25:05 -04:00
|
|
|
|
2009-10-27 04:55:17 -04:00
|
|
|
cd root_dir do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Bundling RubyGems"
|
|
|
|
puts
|
2010-01-31 23:18:13 -05:00
|
|
|
build_results[:bundle] = system 'env CI=1 sudo bundle install'
|
2009-10-27 04:55:17 -04:00
|
|
|
end
|
|
|
|
|
2008-08-24 10:25:05 -04:00
|
|
|
cd "#{root_dir}/activesupport" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActiveSupport"
|
|
|
|
puts
|
2009-11-10 20:19:39 -05:00
|
|
|
build_results[:activesupport] = rake 'test'
|
2009-11-10 17:59:59 -05:00
|
|
|
build_results[:activesupport_isolated] = rake 'test:isolated'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
2009-11-10 19:08:02 -05:00
|
|
|
cd "#{root_dir}/railties" do
|
2008-08-24 10:25:05 -04:00
|
|
|
puts
|
2009-11-10 19:08:02 -05:00
|
|
|
puts "[CruiseControl] Building RailTies"
|
2008-08-24 10:25:05 -04:00
|
|
|
puts
|
2009-11-10 20:19:39 -05:00
|
|
|
build_results[:railties] = rake 'test'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
2009-11-10 19:08:02 -05:00
|
|
|
cd "#{root_dir}/actionpack" do
|
2008-08-26 06:14:07 -04:00
|
|
|
puts
|
2009-11-10 19:08:02 -05:00
|
|
|
puts "[CruiseControl] Building ActionPack"
|
2008-08-26 06:14:07 -04:00
|
|
|
puts
|
2009-11-10 20:19:39 -05:00
|
|
|
build_results[:actionpack] = rake 'test'
|
2009-11-10 19:08:02 -05:00
|
|
|
build_results[:actionpack_isolated] = rake 'test:isolated'
|
2008-08-26 06:14:07 -04:00
|
|
|
end
|
2008-08-24 10:25:05 -04:00
|
|
|
|
2009-11-10 19:08:02 -05:00
|
|
|
cd "#{root_dir}/actionmailer" do
|
2008-08-24 10:25:05 -04:00
|
|
|
puts
|
2009-11-10 19:08:02 -05:00
|
|
|
puts "[CruiseControl] Building ActionMailer"
|
2008-08-24 10:25:05 -04:00
|
|
|
puts
|
2009-11-10 20:19:39 -05:00
|
|
|
build_results[:actionmailer] = rake 'test'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
cd "#{root_dir}/activemodel" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActiveModel"
|
|
|
|
puts
|
2009-11-10 20:19:39 -05:00
|
|
|
build_results[:activemodel] = rake 'test'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
2009-01-06 22:42:53 -05:00
|
|
|
rm_f "#{root_dir}/activeresource/debug.log"
|
2008-08-24 10:25:05 -04:00
|
|
|
cd "#{root_dir}/activeresource" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActiveResource"
|
|
|
|
puts
|
2009-11-10 20:19:39 -05:00
|
|
|
build_results[:activeresource] = rake 'test'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
2009-11-10 19:08:02 -05:00
|
|
|
rm_f "#{root_dir}/activerecord/debug.log"
|
|
|
|
cd "#{root_dir}/activerecord" do
|
2008-08-24 10:25:05 -04:00
|
|
|
puts
|
2009-11-10 19:08:02 -05:00
|
|
|
puts "[CruiseControl] Building ActiveRecord with MySQL"
|
2008-08-24 10:25:05 -04:00
|
|
|
puts
|
2009-11-10 19:08:02 -05:00
|
|
|
build_results[:activerecord_mysql] = rake 'mysql:rebuild_databases', 'test_mysql'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
2009-11-10 19:08:02 -05:00
|
|
|
cd "#{root_dir}/activerecord" do
|
2008-08-24 10:25:05 -04:00
|
|
|
puts
|
2009-11-10 19:08:02 -05:00
|
|
|
puts "[CruiseControl] Building ActiveRecord with PostgreSQL"
|
2008-08-24 10:25:05 -04:00
|
|
|
puts
|
2009-11-10 19:08:02 -05:00
|
|
|
build_results[:activerecord_postgresql8] = rake 'postgresql:rebuild_databases', 'test_postgresql'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
2009-11-10 19:08:02 -05:00
|
|
|
cd "#{root_dir}/activerecord" do
|
2008-08-24 10:25:05 -04:00
|
|
|
puts
|
2009-11-10 19:08:02 -05:00
|
|
|
puts "[CruiseControl] Building ActiveRecord with SQLite 3"
|
2008-08-24 10:25:05 -04:00
|
|
|
puts
|
2009-11-10 19:08:02 -05:00
|
|
|
build_results[:activerecord_sqlite3] = rake 'test_sqlite3'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Build environment:"
|
|
|
|
puts "[CruiseControl] #{`cat /etc/issue`}"
|
|
|
|
puts "[CruiseControl] #{`uname -a`}"
|
|
|
|
puts "[CruiseControl] #{`ruby -v`}"
|
|
|
|
puts "[CruiseControl] #{`mysql --version`}"
|
|
|
|
puts "[CruiseControl] #{`pg_config --version`}"
|
|
|
|
puts "[CruiseControl] SQLite3: #{`sqlite3 -version`}"
|
2009-02-04 12:29:00 -05:00
|
|
|
`gem env`.each_line {|line| print "[CruiseControl] #{line}"}
|
2010-02-01 20:35:15 -05:00
|
|
|
# Commented until bundler supports --list again
|
|
|
|
# puts "[CruiseControl] Bundled gems:"
|
2010-02-01 18:28:31 -05:00
|
|
|
# `gem bundle --list`.each_line {|line| print "[CruiseControl] #{line}"}
|
2008-08-24 10:25:05 -04:00
|
|
|
puts "[CruiseControl] Local gems:"
|
2009-02-04 12:29:00 -05:00
|
|
|
`gem list`.each_line {|line| print "[CruiseControl] #{line}"}
|
2008-08-24 10:25:05 -04:00
|
|
|
|
|
|
|
failures = build_results.select { |key, value| value == false }
|
|
|
|
|
|
|
|
if failures.empty?
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Rails build finished sucessfully"
|
|
|
|
exit(0)
|
|
|
|
else
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Rails build FAILED"
|
|
|
|
puts "[CruiseControl] Failed components: #{failures.map { |component| component.first }.join(', ')}"
|
|
|
|
exit(-1)
|
|
|
|
end
|
|
|
|
|