Skip to content

Commit

Permalink
Setup codecov code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
justinhoward committed Aug 12, 2022
1 parent 31b5a9c commit 765fe30
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,10 @@ jobs:
env:
MYSQL_USER: root
MYSQL_PASSWORD: root
- name: Run codacy-coverage-reporter
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
if: matrix.ruby == '2.7' && env.CODACY_PROJECT_TOKEN
uses: codacy/codacy-coverage-reporter-action@master
- uses: codecov/codecov-action@v3
if: matrix.ruby == '2.7'
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/lcov/faulty.lcov
files: coverage/coverage.xml

release:
needs: test
Expand Down
6 changes: 2 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ gem 'irb', '~> 1.0'
gem 'mysql2', '>= 0.5.0', platforms: not_jruby
gem 'redcarpet', '~> 3.5', platforms: not_jruby
gem 'rspec_junit_formatter', '~> 0.4'
gem 'simplecov', '>= 0.17.1'
# 0.8 is incompatible with simplecov < 0.18
# https://github.com/fortissimo1997/simplecov-lcov/pull/25
gem 'simplecov-lcov', '~> 0.7', '< 0.8'
gem 'yard', '~> 0.9.25', platforms: not_jruby

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6')
gem 'rubocop', '~> 1.32.0'
gem 'rubocop-rspec', '~> 2.12'
gem 'simplecov', '>= 0.17.1'
gem 'simplecov-cobertura', '~> 2.1'
end

if ENV['REDIS_VERSION']
Expand Down
11 changes: 4 additions & 7 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

require 'byebug' if Gem.loaded_specs['byebug']

if ENV['COVERAGE'] || ENV['CI']
if Gem.loaded_specs['simplecov'] && (ENV.fetch('COVERAGE', nil) || ENV.fetch('CI', nil))
require 'simplecov'
if ENV['CI']
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
end

SimpleCov.start do
if Gem::Version.new(SimpleCov::VERSION) >= Gem::Version.new('0.18.0')
enable_coverage :branch
end
enable_coverage :branch
add_filter '/spec/'
add_filter '/vendor/'
end
Expand Down

0 comments on commit 765fe30

Please sign in to comment.