DEV: Support running Ruby tests in parallel (#7087)

This commit is contained in:
Penar Musaraj 2019-02-28 16:36:22 -05:00 committed by GitHub
parent bf0c855287
commit edffd0097f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

2
.rspec
View File

@ -1 +1,3 @@
--colour
--profile
--fail-fast

View File

@ -124,6 +124,18 @@ task 'docker:test' do
if ENV["RSPEC_SEED"]
params << "--seed #{ENV["RSPEC_SEED"]}"
end
if ENV['PARALLEL']
parts = ENV['PARALLEL'].split("/")
total = parts[1].to_i
subset = parts[0].to_i - 1
spec_partials = Dir["spec/**/*_spec.rb"].sort.in_groups(total, false)
params << spec_partials[subset].join(' ')
puts "Running spec subset #{subset + 1} of #{total}"
end
@good &&= run_or_fail("bundle exec rspec #{params.join(' ')}".strip)
end