1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/ci/ci_build.rb

182 lines
5.5 KiB
Ruby
Raw Normal View History

#!/usr/bin/env ruby
require 'fileutils'
include FileUtils
def root_dir
@root_dir ||= File.expand_path('../..', __FILE__)
end
def rake(*tasks)
tasks.each do |task|
cmd = "bundle exec rake #{task}"
puts "Running command: #{cmd}"
return false unless system(cmd)
end
true
end
puts "[CruiseControl] Rails build"
build_results = {}
# Install required version of bundler.
bundler_install_cmd = "sudo gem install bundler --no-ri --no-rdoc"
puts "Running command: #{bundler_install_cmd}"
build_results[:install_bundler] = system bundler_install_cmd
2009-10-27 04:55:17 -04:00
cd root_dir do
puts
2010-10-22 11:34:22 -04:00
puts "[CruiseControl] Bundling gems"
2009-10-27 04:55:17 -04:00
puts
2010-08-19 13:04:29 -04:00
build_results[:bundle] = system 'bundle update'
2009-10-27 04:55:17 -04:00
end
cd "#{root_dir}/activesupport" do
puts
2010-10-22 11:34:22 -04:00
puts "[CruiseControl] Building Active Support"
puts
2009-11-10 20:19:39 -05:00
build_results[:activesupport] = rake 'test'
2011-01-12 09:36:14 -05:00
build_results[:activesupport_isolated] = rake 'test:isolated'
end
system "sudo rm -R #{root_dir}/railties/tmp"
2009-11-10 19:08:02 -05:00
cd "#{root_dir}/railties" do
puts
2010-10-22 11:34:22 -04:00
puts "[CruiseControl] Building Railties"
puts
2009-11-10 20:19:39 -05:00
build_results[:railties] = rake 'test'
end
2009-11-10 19:08:02 -05:00
cd "#{root_dir}/actionpack" do
2008-08-26 06:14:07 -04:00
puts
2010-10-22 11:34:22 -04:00
puts "[CruiseControl] Building Action Pack"
2008-08-26 06:14:07 -04:00
puts
2009-11-10 20:19:39 -05:00
build_results[:actionpack] = rake 'test'
2011-01-12 09:36:14 -05:00
build_results[:actionpack_isolated] = rake 'test:isolated'
2008-08-26 06:14:07 -04:00
end
2009-11-10 19:08:02 -05:00
cd "#{root_dir}/actionmailer" do
puts
2010-10-22 11:34:22 -04:00
puts "[CruiseControl] Building Action Mailer"
puts
2009-11-10 20:19:39 -05:00
build_results[:actionmailer] = rake 'test'
2011-01-12 09:36:14 -05:00
build_results[:actionmailer_isolated] = rake 'test:isolated'
end
cd "#{root_dir}/activemodel" do
puts
2010-10-22 11:34:22 -04:00
puts "[CruiseControl] Building Active Model"
puts
2009-11-10 20:19:39 -05:00
build_results[:activemodel] = rake 'test'
2011-01-12 09:36:14 -05:00
build_results[:activemodel_isolated] = rake 'test:isolated'
end
rm_f "#{root_dir}/activeresource/debug.log"
cd "#{root_dir}/activeresource" do
puts
2010-10-22 11:34:22 -04:00
puts "[CruiseControl] Building Active Resource"
puts
2009-11-10 20:19:39 -05:00
build_results[:activeresource] = rake 'test'
2011-01-12 09:36:14 -05:00
build_results[:activeresource_isolated] = rake 'test:isolated'
end
2009-11-10 19:08:02 -05:00
rm_f "#{root_dir}/activerecord/debug.log"
cd "#{root_dir}/activerecord" do
puts
2011-03-04 16:03:47 -05:00
puts "[CruiseControl] Building Active Record with MySQL IM enabled"
puts
2011-03-04 18:38:12 -05:00
ENV['IM'] = 'true'
build_results[:activerecord_mysql_IM] = rake 'mysql:rebuild_databases', 'mysql:test'
build_results[:activerecord_mysql_isolated_IM] = rake 'mysql:rebuild_databases', 'mysql:isolated_test'
end
2010-08-14 20:54:37 -04:00
cd "#{root_dir}/activerecord" do
puts
2011-03-04 16:03:47 -05:00
puts "[CruiseControl] Building Active Record with MySQL IM disabled"
2010-08-14 20:54:37 -04:00
puts
2011-03-04 18:38:12 -05:00
ENV['IM'] = 'false'
2011-03-04 16:03:47 -05:00
build_results[:activerecord_mysql] = rake 'mysql:rebuild_databases', 'mysql:test'
build_results[:activerecord_mysql_isolated] = rake 'mysql:rebuild_databases', 'mysql:isolated_test'
end
cd "#{root_dir}/activerecord" do
puts
puts "[CruiseControl] Building Active Record with MySQL2 IM enabled"
puts
2011-03-04 18:38:12 -05:00
ENV['IM'] = 'true'
build_results[:activerecord_mysql2_IM] = rake 'mysql:rebuild_databases', 'mysql2:test'
build_results[:activerecord_mysql2_isolated_IM] = rake 'mysql:rebuild_databases', 'mysql2:isolated_test'
2011-03-04 16:03:47 -05:00
end
cd "#{root_dir}/activerecord" do
puts
puts "[CruiseControl] Building Active Record with MySQL2 IM disabled"
puts
2011-03-04 18:38:12 -05:00
ENV['IM'] = 'false'
2010-08-14 20:54:37 -04:00
build_results[:activerecord_mysql2] = rake 'mysql:rebuild_databases', 'mysql2:test'
2011-01-12 09:36:14 -05:00
build_results[:activerecord_mysql2_isolated] = rake 'mysql:rebuild_databases', 'mysql2:isolated_test'
2010-08-14 20:54:37 -04:00
end
2009-11-10 19:08:02 -05:00
cd "#{root_dir}/activerecord" do
puts
2011-03-04 16:03:47 -05:00
puts "[CruiseControl] Building Active Record with PostgreSQL IM enabled"
puts
2011-03-04 18:38:12 -05:00
ENV['IM'] = 'true'
build_results[:activerecord_postgresql8_IM] = rake 'postgresql:rebuild_databases', 'postgresql:test'
build_results[:activerecord_postgresql8_isolated_IM] = rake 'postgresql:rebuild_databases', 'postgresql:isolated_test'
end
2009-11-10 19:08:02 -05:00
cd "#{root_dir}/activerecord" do
puts
2011-03-04 16:03:47 -05:00
puts "[CruiseControl] Building Active Record with PostgreSQL IM disabled"
puts
2011-03-04 18:38:12 -05:00
ENV['IM'] = 'false'
2011-03-04 16:03:47 -05:00
build_results[:activerecord_postgresql8] = rake 'postgresql:rebuild_databases', 'postgresql:test'
build_results[:activerecord_postgresql8_isolated] = rake 'postgresql:rebuild_databases', 'postgresql:isolated_test'
end
cd "#{root_dir}/activerecord" do
puts
puts "[CruiseControl] Building Active Record with SQLite 3 IM enabled"
puts
2011-03-04 18:38:12 -05:00
ENV['IM'] = 'true'
build_results[:activerecord_sqlite3_IM] = rake 'sqlite3:test'
build_results[:activerecord_sqlite3_isolated_IM] = rake 'sqlite3:isolated_test'
2011-03-04 16:03:47 -05:00
end
cd "#{root_dir}/activerecord" do
puts
puts "[CruiseControl] Building Active Record with SQLite 3 IM disabled"
puts
2011-03-04 18:38:12 -05:00
ENV['IM'] = 'false'
2010-02-05 19:17:06 -05:00
build_results[:activerecord_sqlite3] = rake 'sqlite3:test'
2011-01-12 09:36:14 -05:00
build_results[:activerecord_sqlite3_isolated] = rake 'sqlite3:isolated_test'
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`}"
`gem env`.each_line {|line| print "[CruiseControl] #{line}"}
2010-02-05 19:18:26 -05:00
puts "[CruiseControl] Bundled gems:"
`bundle show`.each_line {|line| print "[CruiseControl] #{line}"}
puts "[CruiseControl] Local gems:"
`gem list`.each_line {|line| print "[CruiseControl] #{line}"}
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