2008-08-24 10:25:05 -04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
require 'fileutils'
|
|
|
|
|
|
|
|
include FileUtils
|
|
|
|
|
|
|
|
puts "[CruiseControl] Rails build"
|
|
|
|
|
|
|
|
build_results = {}
|
|
|
|
root_dir = File.expand_path(File.dirname(__FILE__) + "/..")
|
|
|
|
|
|
|
|
# Requires gem home and path to be writeable and/or overridden to be ~/.gem,
|
|
|
|
# Will enable when RubyGems supports this properly (in a coming release)
|
|
|
|
# build_results[:geminstaller] = system 'geminstaller --exceptions'
|
|
|
|
|
|
|
|
# for now, use the no-passwd sudoers approach (documented in ci_setup_notes.txt)
|
|
|
|
# A security hole, but there is nothing valuable on rails CI box anyway.
|
2008-08-25 21:49:45 -04:00
|
|
|
build_results[:geminstaller] = system "sudo geminstaller --config=#{root_dir}/ci/geminstaller.yml --exceptions"
|
2008-08-24 10:25:05 -04:00
|
|
|
|
|
|
|
cd "#{root_dir}/activesupport" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActiveSupport"
|
|
|
|
puts
|
|
|
|
build_results[:activesupport] = system 'rake'
|
2009-09-25 02:16:41 -04:00
|
|
|
build_results[:activesupport_isolated] = system 'rake test:isolated'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
2009-01-06 22:42:53 -05:00
|
|
|
rm_f "#{root_dir}/activerecord/debug.log"
|
2008-08-24 10:25:05 -04:00
|
|
|
cd "#{root_dir}/activerecord" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActiveRecord with MySQL"
|
|
|
|
puts
|
2009-10-14 22:36:55 -04:00
|
|
|
build_results[:activerecord_mysql] = system 'gem bundle && rake mysql:rebuild_databases && rake test_mysql'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
2008-08-26 06:14:07 -04:00
|
|
|
cd "#{root_dir}/activerecord" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActiveRecord with PostgreSQL"
|
|
|
|
puts
|
2009-10-14 22:36:55 -04:00
|
|
|
build_results[:activerecord_postgresql8] = system 'gem bundle && rake postgresql:rebuild_databases && rake test_postgresql'
|
2008-08-26 06:14:07 -04:00
|
|
|
end
|
2008-08-24 10:25:05 -04:00
|
|
|
|
|
|
|
cd "#{root_dir}/activerecord" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActiveRecord with SQLite 3"
|
|
|
|
puts
|
2009-10-14 22:36:55 -04:00
|
|
|
build_results[:activerecord_sqlite3] = system 'gem bundle && rake test_sqlite3'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
cd "#{root_dir}/activemodel" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActiveModel"
|
|
|
|
puts
|
|
|
|
build_results[:activemodel] = system 'rake'
|
|
|
|
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
|
|
|
|
build_results[:activeresource] = system 'rake'
|
|
|
|
end
|
|
|
|
|
|
|
|
cd "#{root_dir}/actionpack" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActionPack"
|
|
|
|
puts
|
2009-09-15 20:56:20 -04:00
|
|
|
build_results[:actionpack] = system 'gem bundle && rake'
|
2009-10-03 23:14:58 -04:00
|
|
|
build_results[:actionpack_isolated] = system 'rake test:isolated'
|
2008-08-24 10:25:05 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
cd "#{root_dir}/actionmailer" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building ActionMailer"
|
|
|
|
puts
|
|
|
|
build_results[:actionmailer] = system 'rake'
|
|
|
|
end
|
|
|
|
|
|
|
|
cd "#{root_dir}/railties" do
|
|
|
|
puts
|
|
|
|
puts "[CruiseControl] Building RailTies"
|
|
|
|
puts
|
|
|
|
build_results[:railties] = system 'rake'
|
|
|
|
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}"}
|
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
|
|
|
|
|