Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a .travis.yml config and travis specific ci script.
Don't install ruby-debug if running the test suite on Travis, linecache19 is the main offender, very very slow. And do not install pg if Travis is bundling the gems, pg will be setup on Travis soon. Conflicts: Gemfile
- Loading branch information
Showing
3 changed files
with
157 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
script: 'ci/travis.rb' | ||
notifications: | ||
disabled: true | ||
rvm: | ||
- 1.8.7 | ||
- 1.9.2 | ||
env: | ||
- "GEM=railties" | ||
- "GEM=ap,am,amo,ares,as" | ||
- "GEM=ar:mysql" | ||
- "GEM=ar:mysql2" | ||
- "GEM=ar:sqlite3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,13 +21,13 @@ gem "memcache-client", ">= 1.8.5" | |
|
||
platforms :mri_18 do | ||
gem "system_timer" | ||
gem "ruby-debug", ">= 0.10.3" | ||
gem "ruby-debug", ">= 0.10.3" unless ENV['TRAVIS'] | ||
gem 'ruby-prof' | ||
end | ||
|
||
platforms :mri_19 do | ||
# TODO: Remove the conditional when ruby-debug19 supports Ruby >= 1.9.3 | ||
gem "ruby-debug19", :require => 'ruby-debug' if RUBY_VERSION < "1.9.3" | ||
gem "ruby-debug19", :require => 'ruby-debug' unless > "1.9.2" || ENV['TRAVIS'] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
fxn
Member
|
||
end | ||
|
||
platforms :ruby do | ||
|
@@ -39,7 +39,7 @@ platforms :ruby do | |
gem "sqlite3", "~> 1.3.3" | ||
|
||
group :db do | ||
gem "pg", ">= 0.9.0" | ||
gem "pg", ">= 0.9.0" unless ENV['TRAVIS'] # once pg is on travis this can be removed | ||
gem "mysql", ">= 2.8.1" | ||
gem "mysql2", "~> 0.2.11" | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
#!/usr/bin/env ruby | ||
require 'fileutils' | ||
include FileUtils | ||
|
||
commands = [ | ||
'mysql -e "create database activerecord_unittest;"', | ||
'mysql -e "create database activerecord_unittest2;"', | ||
'psql -c "create database activerecord_unittest;" -U postgres', | ||
'psql -c "create database activerecord_unittest2;" -U postgres' | ||
] | ||
|
||
commands.each do |command| | ||
system("#{command} > /dev/null 2>&1") | ||
end | ||
|
||
class Build | ||
MAP = { | ||
'railties' => 'railties', | ||
'ap' => 'actionpack', | ||
'am' => 'actionmailer', | ||
'amo' => 'activemodel', | ||
'ares' => 'activeresource', | ||
'as' => 'activesupport', | ||
'ar' => 'activerecord' | ||
} | ||
|
||
attr_reader :component, :options | ||
|
||
def initialize(component, options = {}) | ||
@component = component | ||
@options = options | ||
end | ||
|
||
def run!(options = {}) | ||
self.options.update(options) | ||
Dir.chdir(dir) do | ||
announce(heading) | ||
ENV['IM'] = identity_map?.inspect | ||
rake(*tasks) | ||
end | ||
end | ||
|
||
def announce(heading) | ||
puts "\n\e[1;33m[Travis CI] #{heading}\e[m\n" | ||
end | ||
|
||
def heading | ||
heading = [gem] | ||
heading << "with #{adapter} IM #{identity_map? ? 'enabled' : 'disabled'}" if activerecord? | ||
heading << "in isolation" if isolated? | ||
heading.join(' ') | ||
end | ||
|
||
def tasks | ||
if activerecord? | ||
['mysql:rebuild_databases', "#{adapter}:#{'isolated_' if isolated?}test"] | ||
else | ||
["test#{':isolated' if isolated?}"] | ||
end | ||
end | ||
|
||
def key | ||
key = [gem] | ||
key << adapter if activerecord? | ||
key << 'IM' if identity_map? | ||
key << 'isolated' if isolated? | ||
key.join(':') | ||
end | ||
|
||
def activerecord? | ||
gem == 'activerecord' | ||
end | ||
|
||
def identity_map? | ||
options[:identity_map] | ||
end | ||
|
||
def isolated? | ||
options[:isolated] | ||
end | ||
|
||
def gem | ||
MAP[component.split(':').first] | ||
end | ||
alias :dir :gem | ||
|
||
def adapter | ||
component.split(':').last | ||
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 | ||
end | ||
|
||
results = {} | ||
|
||
ENV['GEM'].split(',').each do |gem| | ||
[false, true].each do |isolated| | ||
next if gem == 'railties' && isolated | ||
|
||
build = Build.new(gem, :isolated => isolated) | ||
results[build.key] = build.run! | ||
|
||
if build.activerecord? | ||
build.options[:identity_map] = true | ||
results[build.key] = build.run! | ||
end | ||
end | ||
end | ||
|
||
# puts | ||
# puts "Build environment:" | ||
# puts " #{`cat /etc/issue`}" | ||
# puts " #{`uname -a`}" | ||
# puts " #{`ruby -v`}" | ||
# puts " #{`mysql --version`}" | ||
# # puts " #{`pg_config --version`}" | ||
# puts " SQLite3: #{`sqlite3 -version`}" | ||
# `gem env`.each_line {|line| print " #{line}"} | ||
# puts " Bundled gems:" | ||
# `bundle show`.each_line {|line| print " #{line}"} | ||
# puts " Local gems:" | ||
# `gem list`.each_line {|line| print " #{line}"} | ||
|
||
failures = results.select { |key, value| value == false } | ||
|
||
if failures.empty? | ||
puts | ||
puts "Rails build finished sucessfully" | ||
exit(true) | ||
else | ||
puts | ||
puts "Rails build FAILED" | ||
puts "Failed components: #{failures.map { |component| component.first }.join(', ')}" | ||
exit(false) | ||
end |
Common bros. Was this patch reviewed or tested?