##// END OF EJS Templates
ci.rake: use 'jdbcsqlite3' for JRuby...
ci.rake: use 'jdbcsqlite3' for JRuby git-svn-id: http://svn.redmine.org/redmine/trunk@12258 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r12028:ccf55e65f002
r12028:ccf55e65f002
Show More
ci.rake
75 lines | 2.5 KiB | text/x-ruby | RubyLexer
Eric Davis
Add a rake task to run CI....
r3805 desc "Run the Continous Integration tests for Redmine"
task :ci do
# RAILS_ENV and ENV[] can diverge so force them both to test
ENV['RAILS_ENV'] = 'test'
RAILS_ENV = 'test'
Rake::Task["ci:setup"].invoke
Rake::Task["ci:build"].invoke
Rake::Task["ci:teardown"].invoke
end
namespace :ci do
Jean-Philippe Lang
CI tasks cleanup....
r11053 desc "Setup Redmine for a new build"
Eric Davis
Add a rake task to run CI....
r3805 task :setup do
Toshi MARUYAMA
add "tmp:clear" to "ci:setup" rake task for new translation...
r11159 Rake::Task["tmp:clear"].invoke
Jean-Philippe Lang
CI tasks cleanup....
r11053 Rake::Task["log:clear"].invoke
Toshi MARUYAMA
work around "rake db:create:all" error on JRuby SQLite3...
r12026 database = ENV['DATABASE_ADAPTER']
unless Object.const_defined?(:JRUBY_VERSION) && database =~ /sqlite3/
Rake::Task["db:create:all"].invoke
end
Eric Davis
Add a rake task to run CI....
r3805 Rake::Task["db:migrate"].invoke
Rake::Task["db:schema:dump"].invoke
Jean-Philippe Lang
CI tasks cleanup....
r11053 Rake::Task["test:scm:setup:all"].invoke
Jean-Philippe Lang
Adds a rake task test:scm:update to update test repositories if needed....
r4523 Rake::Task["test:scm:update"].invoke
Eric Davis
Add a rake task to run CI....
r3805 end
desc "Build Redmine"
task :build do
Rake::Task["test"].invoke
Toshi MARUYAMA
not run Capybara tests on the CI server (#12822)...
r11749 # Rake::Task["test:ui"].invoke if RUBY_VERSION >= '1.9.3'
Eric Davis
Add a rake task to run CI....
r3805 end
desc "Finish the build"
task :teardown do
end
Jean-Philippe Lang
CI tasks cleanup....
r11053 end
Eric Davis
Add a rake task to run CI....
r3805
Jean-Philippe Lang
CI tasks cleanup....
r11053 desc "Creates database.yml for the CI server"
file 'config/database.yml' do
require 'yaml'
database = ENV['DATABASE_ADAPTER']
ruby = ENV['RUBY_VER'].gsub('.', '').gsub('-', '')
branch = ENV['BRANCH'].gsub('.', '').gsub('-', '')
dev_db_name = "ci_#{branch}_#{ruby}_dev"
test_db_name = "ci_#{branch}_#{ruby}_test"
case database
when 'mysql'
Toshi MARUYAMA
ci.rake: code format cleanup...
r12027 dev_conf = {'adapter' => (RUBY_VERSION >= '1.9' ? 'mysql2' : 'mysql'),
'database' => dev_db_name, 'host' => 'localhost',
'username' => 'jenkins', 'password' => 'jenkins',
'encoding' => 'utf8'}
Jean-Philippe Lang
CI tasks cleanup....
r11053 test_conf = dev_conf.merge('database' => test_db_name)
when 'postgresql'
Toshi MARUYAMA
ci.rake: code format cleanup...
r12027 dev_conf = {'adapter' => 'postgresql', 'database' => dev_db_name,
'host' => 'localhost',
'username' => 'jenkins', 'password' => 'jenkins'}
Jean-Philippe Lang
CI tasks cleanup....
r11053 test_conf = dev_conf.merge('database' => test_db_name)
Toshi MARUYAMA
ci.rake: use 'jdbcsqlite3' for JRuby...
r12028 when /sqlite3/
dev_conf = {'adapter' => (Object.const_defined?(:JRUBY_VERSION) ?
'jdbcsqlite3' : 'sqlite3'),
Toshi MARUYAMA
ci.rake: code format cleanup...
r12027 'database' => "db/#{dev_db_name}.sqlite3"}
Jean-Philippe Lang
CI tasks cleanup....
r11053 test_conf = dev_conf.merge('database' => "db/#{test_db_name}.sqlite3")
when 'sqlserver'
Toshi MARUYAMA
ci.rake: code format cleanup...
r12027 dev_conf = {'adapter' => 'sqlserver', 'database' => dev_db_name,
'host' => 'mssqlserver', 'port' => 1433,
'username' => 'jenkins', 'password' => 'jenkins'}
Jean-Philippe Lang
CI tasks cleanup....
r11053 test_conf = dev_conf.merge('database' => test_db_name)
else
abort "Unknown database"
Jean-Philippe Lang
Adds a quick and dirty task for creating databases on the CI server....
r9201 end
Jean-Philippe Lang
CI tasks cleanup....
r11053 File.open('config/database.yml', 'w') do |f|
f.write YAML.dump({'development' => dev_conf, 'test' => test_conf})
Eric Davis
Add a rake task to run CI....
r3805 end
end