diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 4ad75a0..c90160a 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -6,3 +6,4 @@ on: jobs: tests: uses: Invoca/ruby-test-matrix-workflow/.github/workflows/ruby-test-matrix.yml@main + secrets: inherit diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..58d1399 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + project: + default: + target: auto + threshold: 1% + patch: + default: + target: auto + threshold: 1% diff --git a/spec/simplecov_helper.rb b/spec/simplecov_helper.rb new file mode 100644 index 0000000..2e8cc2d --- /dev/null +++ b/spec/simplecov_helper.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +unless ENV["NO_COVERAGE"] == "true" + require "simplecov" + + SimpleCov.start do + add_filter "/spec/" + track_files "lib/**/*.rb" + + if ENV["GITHUB_ACTIONS"] + require "simplecov-lcov" + + SimpleCov::Formatter::LcovFormatter.config do |config| + config.report_with_single_file = true + config.single_report_path = "coverage/lcov.info" + end + + formatter SimpleCov::Formatter::LcovFormatter + else + formatter SimpleCov::Formatter::HTMLFormatter + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ea008a5..e08cd5d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,24 +1,10 @@ # frozen_string_literal: true +require_relative "simplecov_helper" + require 'rspec_junit_formatter' require "active_record/data_classification" -if ENV['GITHUB_ACTIONS'].presence - require 'simplecov' - require 'simplecov-lcov' - - SimpleCov.start do - SimpleCov::Formatter::LcovFormatter.config do |c| - c.report_with_single_file = true - c.single_report_path = 'coverage/lcov.info' - end - - formatter SimpleCov::Formatter::LcovFormatter - - add_filter %w[version.rb initializer.rb] - end -end - RSpec.configure do |config| config.add_formatter RspecJunitFormatter, ENV['JUNIT_OUTPUT'].presence || 'spec/reports/rspec.xml'