Skip to content

Commit

Permalink
Code coverage: Allow developer to use simplecov and CI to use codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
neomilium committed Oct 6, 2021
1 parent 7b1d526 commit 7aab54c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
- ruby: "2.6"
- ruby: "2.7"
- ruby: "3.0"
coverage: "yes"
codecov: "yes"
env:
COVERAGE: ${{ matrix.coverage }}
CODECOV: ${{ matrix.codecov }}
steps:
- uses: actions/checkout@v2
- name: Install Ruby ${{ matrix.ruby }}
Expand Down
26 changes: 12 additions & 14 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
begin
require 'simplecov'
require 'simplecov-console'
require 'codecov'
rescue LoadError
else
SimpleCov.start do
track_files 'lib/**/*.rb'
SimpleCov.start do
track_files 'lib/**/*.rb'

add_filter '/spec'

add_filter '/spec'
enable_coverage :branch

enable_coverage :branch
# do not track vendored files
add_filter '/vendor'
add_filter '/.vendor'
end

# do not track vendored files
add_filter '/vendor'
add_filter '/.vendor'
end
if ENV['CODECOV']
require 'simplecov-console'
require 'codecov'

SimpleCov.formatters = [
SimpleCov::Formatter::Console,
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ group :release do
gem 'github_changelog_generator', :require => false
end

group :coverage, optional: ENV['COVERAGE']!='yes' do
group :coverage, optional: ENV['CODECOV']!='yes' do
gem 'simplecov-console', :require => false
gem 'codecov', :require => false
end

0 comments on commit 7aab54c

Please sign in to comment.