Skip to content

Commit

Permalink
Use codecov github action
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaHydrae committed Sep 19, 2024
1 parent 271d625 commit aa31956
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source "https://rubygems.org"
source 'https://rubygems.org'

gem 'commander', '~> 5.0'
gem 'paint', '~> 2.2'
Expand All @@ -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
8 changes: 5 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -121,7 +123,6 @@ PLATFORMS
ruby

DEPENDENCIES
codecov (~> 0.6.0)
commander (~> 5.0)
fakefs (~> 2.5)
jeweler (~> 2.0)
Expand All @@ -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
16 changes: 6 additions & 10 deletions spec/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'

Expand Down

0 comments on commit aa31956

Please sign in to comment.