diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c15fac..314144a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,13 @@ jobs: run: | bundle install - - name: Run automated tests & generate code coverage report + - name: Run automated tests run: | bundle exec rake + + - name: Upload code coverage + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true diff --git a/Gemfile b/Gemfile index 3fdca31..9411627 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source "https://rubygems.org" +source 'https://rubygems.org' gem 'commander', '~> 5.0' gem 'paint', '~> 2.2' @@ -11,10 +11,10 @@ group :development do end group :test do - gem 'codecov', '~> 0.6.0', require: false gem 'fakefs', '~> 2.5', require: 'fakefs/safe' gem 'rspec', '~> 3.10' gem 'rspec-collection_matchers', '~> 1.2' gem 'rspec-its', '~> 1.1' gem 'simplecov', '~> 0.21.2' + gem 'simplecov-cobertura', '~> 2.1' end diff --git a/Gemfile.lock b/Gemfile.lock index f321c9c..c3189a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,8 +6,6 @@ GEM base64 (0.2.0) bigdecimal (3.1.8) builder (3.3.0) - codecov (0.6.0) - simplecov (>= 0.15, < 0.22) commander (5.0.0) highline (~> 3.0.0) descendants_tracker (0.0.4) @@ -75,6 +73,7 @@ GEM rdoc (6.7.0) psych (>= 4.0.0) regexp_parser (2.9.2) + rexml (3.3.7) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -111,6 +110,9 @@ GEM docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) + simplecov-cobertura (2.1.0) + rexml + simplecov (~> 0.19) simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) stringio (3.1.1) @@ -121,7 +123,6 @@ PLATFORMS ruby DEPENDENCIES - codecov (~> 0.6.0) commander (~> 5.0) fakefs (~> 2.5) jeweler (~> 2.0) @@ -133,6 +134,7 @@ DEPENDENCIES rspec-its (~> 1.1) rubocop (~> 1.66) simplecov (~> 0.21.2) + simplecov-cobertura (~> 2.1) BUNDLED WITH 2.2.15 diff --git a/spec/helper.rb b/spec/helper.rb index bf52e92..840344f 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -4,35 +4,31 @@ begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e - $stderr.puts e.message - $stderr.puts "Run `bundle install` to install missing gems" + warn e.message + warn 'Run `bundle install` to install missing gems' exit e.status_code end unless ENV['COVERAGE_DISABLED'] require 'simplecov' - require 'codecov' + require 'simplecov-cobertura' coverage_formatters = [ + SimpleCov::Formatter::CoberturaFormatter, SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::SimpleFormatter ] - # Upload code coverage to https://codecov.io on continuous integration - # environment. - coverage_formatters.push(SimpleCov::Formatter::Codecov) if ENV['CI'] - SimpleCov.start do formatter SimpleCov::Formatter::MultiFormatter.new(coverage_formatters) end end RSpec.configure do |config| - config.before :each, fakefs: true do FakeFS.activate! # necessary because fakefs doesn't implement readpartial - allow_any_instance_of(Gitenv::Copy).to receive(:digest){ |c,f| Digest::MD5.hexdigest File.read(f) } + allow_any_instance_of(Gitenv::Copy).to receive(:digest) { |c, f| Digest::MD5.hexdigest File.read(f) } end config.after :each, fakefs: true do @@ -45,7 +41,7 @@ require 'rspec/collection_matchers' require 'rspec/its' -Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each{ |f| require f } +Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f } require 'fakefs/spec_helpers'