-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14141 from hennevogel/update/test-coverage
Renovate Coverage Report Generation & Upload
- Loading branch information
Showing
20 changed files
with
50 additions
and
112 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
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,15 @@ | ||
SimpleCov.start 'rails' do | ||
add_filter '/app/indices/' | ||
add_filter '/lib/templates/' | ||
add_filter '/lib/memory_debugger.rb' | ||
add_filter '/lib/memory_dumper.rb' | ||
merge_timeout 3600 | ||
add_group 'Components', 'app/components' | ||
add_group 'Datatables', 'app/datatables' | ||
add_group 'Instrumentations', 'app/instrumentations' | ||
add_group 'Mixins', 'app/mixins' | ||
add_group 'Policies', 'app/policies' | ||
add_group 'Queries', 'app/queries' | ||
add_group 'Services', 'app/services' | ||
add_group 'Validators', 'app/validators' | ||
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
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
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 |
---|---|---|
@@ -1,56 +1,12 @@ | ||
namespace :ci do | ||
def merged_results(glob) | ||
coverage_results = [] | ||
base_dir = Rails.root.join('coverage_results') | ||
Dir["#{base_dir}/" + glob].each do |file| | ||
# load json results from coverage folder | ||
file_results = JSON.parse(File.read(file)) | ||
|
||
# parse results from coverage file to array | ||
file_results.each do |command, data| | ||
result = SimpleCov::Result.from_hash(command => data) | ||
coverage_results << result | ||
end | ||
end | ||
|
||
# merge results from array to results object | ||
SimpleCov::ResultMerger.merge_results(*coverage_results) | ||
end | ||
|
||
desc 'Generate merged coverage report' | ||
task :simplecov_ci_merge do | ||
require 'simplecov' | ||
require 'codecov' | ||
require 'coveralls' | ||
require 'simplecov-cobertura' | ||
|
||
# initialize data members | ||
# and configure simplecov | ||
SimpleCov.filters.clear | ||
SimpleCov.merge_timeout 100_000 | ||
|
||
SimpleCov.configure do | ||
add_group('WebUI') { |file| file.filename =~ /webui/ } | ||
add_group('Jobs') { |file| file.filename =~ %r{jobs/} } | ||
add_group('Models') { |file| file.filename =~ %r{models/} } | ||
add_group('Helpers') { |file| file.filename =~ %r{helpers/} && file.filename !~ /webui/ } | ||
add_group('API Controllers') { |file| file.filename =~ %r{controllers/} && file.filename !~ /webui/ } | ||
SimpleCov.collate(Dir['coverage_results/*.json'], 'rails') do | ||
formatter SimpleCov::Formatter::MultiFormatter.new([SimpleCov::Formatter::CoberturaFormatter, | ||
SimpleCov::Formatter::HTMLFormatter]) | ||
end | ||
|
||
# upload the result for all | ||
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ | ||
Coveralls::SimpleCov::Formatter, | ||
SimpleCov::Formatter::HTMLFormatter, | ||
SimpleCov::Formatter::Codecov | ||
]) | ||
merged_results('resultset*.json').format! | ||
|
||
# render subsets | ||
SimpleCov.coverage_dir('coverage/rspec') | ||
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter | ||
merged_results('resultset-rspec*.json').format! | ||
|
||
SimpleCov.coverage_dir('coverage/minitest') | ||
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter | ||
merged_results('resultset-minitest*.json').format! | ||
end | ||
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
This file was deleted.
Oops, something went wrong.
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
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.