cask-tests: run in parallel
This commit is contained in:
parent
d3740ec34f
commit
176c82516f
@ -16,6 +16,7 @@ group :test do
|
|||||||
gem "minitest", "5.4.1"
|
gem "minitest", "5.4.1"
|
||||||
gem "minitest-reporters"
|
gem "minitest-reporters"
|
||||||
gem "mocha", "1.1.0", require: false
|
gem "mocha", "1.1.0", require: false
|
||||||
|
gem "parallel_tests"
|
||||||
gem "rspec", "~> 3.0.0"
|
gem "rspec", "~> 3.0.0"
|
||||||
gem "rspec-its", require: false
|
gem "rspec-its", require: false
|
||||||
gem "rspec-wait", require: false
|
gem "rspec-wait", require: false
|
||||||
|
|||||||
@ -23,6 +23,9 @@ GEM
|
|||||||
ruby-progressbar
|
ruby-progressbar
|
||||||
mocha (1.1.0)
|
mocha (1.1.0)
|
||||||
metaclass (~> 0.0.1)
|
metaclass (~> 0.0.1)
|
||||||
|
parallel (1.9.0)
|
||||||
|
parallel_tests (2.9.0)
|
||||||
|
parallel
|
||||||
parser (2.3.1.2)
|
parser (2.3.1.2)
|
||||||
ast (~> 2.2)
|
ast (~> 2.2)
|
||||||
powerpack (0.1.1)
|
powerpack (0.1.1)
|
||||||
@ -80,6 +83,7 @@ DEPENDENCIES
|
|||||||
minitest (= 5.4.1)
|
minitest (= 5.4.1)
|
||||||
minitest-reporters
|
minitest-reporters
|
||||||
mocha (= 1.1.0)
|
mocha (= 1.1.0)
|
||||||
|
parallel_tests
|
||||||
pry
|
pry
|
||||||
pry-byebug
|
pry-byebug
|
||||||
rake
|
rake
|
||||||
|
|||||||
@ -6,40 +6,11 @@ homebrew_repo = `brew --repository`.chomp
|
|||||||
$LOAD_PATH.unshift(File.expand_path("#{homebrew_repo}/Library/Homebrew"))
|
$LOAD_PATH.unshift(File.expand_path("#{homebrew_repo}/Library/Homebrew"))
|
||||||
$LOAD_PATH.unshift(File.expand_path("../lib", __FILE__))
|
$LOAD_PATH.unshift(File.expand_path("../lib", __FILE__))
|
||||||
|
|
||||||
namespace :test do
|
|
||||||
Rake::TestTask.new(:minitest) do |t|
|
|
||||||
# TODO: setting the --seed here is an ugly temporary hack, to remain only
|
|
||||||
# until test-suite glitches are fixed.
|
|
||||||
ENV["TESTOPTS"] = "--seed=14830" if ENV["TRAVIS"]
|
|
||||||
t.pattern = "test/**/*_test.rb"
|
|
||||||
t.libs << "test"
|
|
||||||
end
|
|
||||||
|
|
||||||
RSpec::Core::RakeTask.new(:rspec)
|
|
||||||
|
|
||||||
desc "Run tests for minitest and RSpec with coverage"
|
|
||||||
task :coverage do
|
|
||||||
ENV["HOMEBREW_TESTS_COVERAGE"] = "1"
|
|
||||||
|
|
||||||
Rake::Task[:test].invoke
|
|
||||||
|
|
||||||
if ENV["CODECOV_TOKEN"]
|
|
||||||
require "simplecov"
|
|
||||||
require "codecov"
|
|
||||||
formatter = SimpleCov::Formatter::Codecov.new
|
|
||||||
formatter.format(SimpleCov::ResultMerger.merged_result)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
desc "Run tests for minitest and RSpec"
|
|
||||||
task test: ["test:minitest", "test:rspec"]
|
|
||||||
|
|
||||||
RuboCop::RakeTask.new(:rubocop) do |t|
|
RuboCop::RakeTask.new(:rubocop) do |t|
|
||||||
t.options = ["--force-exclusion"]
|
t.options = ["--force-exclusion"]
|
||||||
end
|
end
|
||||||
|
|
||||||
task default: [:test, :rubocop]
|
task default: [:rubocop]
|
||||||
|
|
||||||
desc "Open a REPL for debugging and experimentation"
|
desc "Open a REPL for debugging and experimentation"
|
||||||
task :console do
|
task :console do
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
require "English"
|
require "English"
|
||||||
|
|
||||||
|
def run_tests(executable, files, args = [])
|
||||||
|
system "bundle", "exec", executable, "--", *args, "--", *files
|
||||||
|
end
|
||||||
|
|
||||||
repo_root = Pathname(__FILE__).realpath.parent.parent
|
repo_root = Pathname(__FILE__).realpath.parent.parent
|
||||||
repo_root.cd do
|
repo_root.cd do
|
||||||
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
|
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
|
||||||
@ -9,12 +13,21 @@ repo_root.cd do
|
|||||||
system "bundle", "install", "--path", "vendor/bundle"
|
system "bundle", "install", "--path", "vendor/bundle"
|
||||||
end
|
end
|
||||||
|
|
||||||
test_task = "test"
|
rspec = ARGV.flag?("--rspec") || !ARGV.flag?("--minitest")
|
||||||
%w[rspec minitest coverage].each do |subtask|
|
minitest = ARGV.flag?("--minitest") || !ARGV.flag?("--rspec")
|
||||||
next unless ARGV.flag?("--#{subtask}")
|
|
||||||
test_task = "test:#{subtask}"
|
ENV["TESTOPTS"] = "--seed=14830" if ENV["TRAVIS"]
|
||||||
|
ENV["HOMEBREW_TESTS_COVERAGE"] = "1" if ARGV.flag?("--coverage")
|
||||||
|
|
||||||
|
run_tests "parallel_rspec", Dir["spec/**/*_spec.rb"] if rspec
|
||||||
|
run_tests "parallel_test", Dir["test/**/*_test.rb"] if minitest
|
||||||
|
|
||||||
|
if ENV["CODECOV_TOKEN"]
|
||||||
|
require "simplecov"
|
||||||
|
require "codecov"
|
||||||
|
formatter = SimpleCov::Formatter::Codecov.new
|
||||||
|
formatter.format(SimpleCov::ResultMerger.merged_result)
|
||||||
end
|
end
|
||||||
|
|
||||||
system "bundle", "exec", "rake", test_task
|
|
||||||
Homebrew.failed = !$CHILD_STATUS.success?
|
Homebrew.failed = !$CHILD_STATUS.success?
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user