Move coverage reporting into brew tests.

This commit is contained in:
Markus Reiter 2017-03-05 08:06:45 +01:00
parent bba2c632ec
commit 4944d43d58
5 changed files with 15 additions and 42 deletions

View File

@ -11,8 +11,6 @@ SimpleCov.start do
# tests to be dropped. This causes random fluctuations in test coverage. # tests to be dropped. This causes random fluctuations in test coverage.
merge_timeout 86400 merge_timeout 86400
add_filter "/Homebrew/cask/spec/"
add_filter "/Homebrew/cask/test/"
add_filter "/Homebrew/compat/" add_filter "/Homebrew/compat/"
add_filter "/Homebrew/dev-cmd/tests.rb" add_filter "/Homebrew/dev-cmd/tests.rb"
add_filter "/Homebrew/test/" add_filter "/Homebrew/test/"

View File

@ -1 +0,0 @@
../.simplecov

View File

@ -1,33 +0,0 @@
require "English"
ENV["BUNDLE_GEMFILE"] = "#{HOMEBREW_LIBRARY_PATH}/cask/Gemfile"
ENV["BUNDLE_PATH"] = "#{HOMEBREW_LIBRARY_PATH}/vendor/bundle"
def run_tests(executable, files, args = [])
opts = []
opts << "--serialize-stdout" if ENV["CI"]
system "bundle", "exec", executable, *opts, "--", *args, "--", *files
end
cask_root = Pathname.new(__FILE__).realpath.parent.parent
cask_root.cd do
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
ENV["HOMEBREW_NO_EMOJI"] = "1"
ENV.delete("HOMEBREW_CASK_OPTS")
Homebrew.install_gem_setup_path! "bundler"
unless quiet_system("bundle", "check")
system "bundle", "install"
end
if ARGV.flag?("--coverage")
ENV["HOMEBREW_TESTS_COVERAGE"] = "1"
upload_coverage = ENV["CODECOV_TOKEN"] || ENV["TRAVIS"]
end
if upload_coverage
puts "Submitting Codecov coverage..."
system "bundle", "exec", "spec/upload_coverage.rb"
end
end

View File

@ -1,6 +0,0 @@
#!/usr/bin/env ruby
require "simplecov"
require "codecov"
formatter = SimpleCov::Formatter::Codecov.new
formatter.format SimpleCov::ResultMerger.merged_result

View File

@ -1,4 +1,5 @@
require "find" require "find"
require "parallel_tests"
require "pathname" require "pathname"
require "rspec/its" require "rspec/its"
require "rspec/wait" require "rspec/wait"
@ -6,6 +7,20 @@ require "set"
if ENV["HOMEBREW_TESTS_COVERAGE"] if ENV["HOMEBREW_TESTS_COVERAGE"]
require "simplecov" require "simplecov"
if ENV["CODECOV_TOKEN"] || ENV["TRAVIS"]
require "codecov"
if ParallelTests.last_process?
at_exit do
ParallelTests.wait_for_other_processes_to_finish
puts "Sending coverage report to CodeCov …"
formatter = SimpleCov::Formatter::Codecov.new
formatter.format SimpleCov::ResultMerger.merged_result
end
end
end
end end
$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew")) $LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew"))