Skip to content

Commit

Permalink
ci: better coverage reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
nebolsin committed Feb 26, 2024
1 parent 0bc6f72 commit 560cd92
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 22 deletions.
41 changes: 30 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,37 @@ jobs:
coverage:
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
runs-on: ubuntu-latest
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Upload code coverage data to CodeClimate
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: bin/rake test:coverage
debug: true
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Generate coverage
run: bin/rake test:coverage
- name: Upload code coverage report to Coveralls
uses: coverallsapp/github-action@v2
with:
file: coverage/lcov.info
debug: true
if: success()
continue-on-error: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
verbose: true
if: success()
continue-on-error: true
- name: Upload code coverage data to CodeClimate
uses: paambaati/codeclimate-action@v5
with:
coverageLocations: coverage/coverage.json:simplecov
debug: true
if: success()
continue-on-error: true

lint:
runs-on: ubuntu-latest
Expand Down
17 changes: 12 additions & 5 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
formatters = SimpleCov.formatters
require "simplecov_json_formatter"
require "simplecov-lcov"

if ENV.key?("CI")
require "codecov"
formatters << SimpleCov::Formatter::Codecov
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = "coverage/lcov.info"
end

SimpleCov.formatters = formatters
SimpleCov.formatters = [
SimpleCov::Formatter::LcovFormatter,
SimpleCov::Formatter::JSONFormatter
]

SimpleCov.start do
enable_coverage_for_eval if SimpleCov.coverage_for_eval_supported?
enable_coverage(:branch)

track_files "**/*.rb"
end
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ group :test do
gem "rake"
gem "rspec"
gem "rspec-its"
gem "simplecov", require: false
gem "simplecov_json_formatter", require: false
gem "simplecov-lcov", require: false
gem "vcr"
gem "webmock"
end
Expand All @@ -18,9 +21,7 @@ group :development do
end

group :lint do
gem "codecov"
gem "bundler-audit", require: false
gem "simplecov", require: false
gem "standard", require: false
gem "yard-junk", require: false
end
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ GEM
bundler-audit (0.9.1)
bundler (>= 1.2.0, < 3)
thor (~> 1.0)
codecov (0.6.0)
simplecov (>= 0.15, < 0.22)
coderay (1.1.3)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
Expand Down Expand Up @@ -126,11 +124,12 @@ GEM
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
shellany (0.0.1)
simplecov (0.21.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
standard (1.34.0)
language_server-protocol (~> 3.17.0.2)
Expand Down Expand Up @@ -166,13 +165,14 @@ PLATFORMS
DEPENDENCIES
break
bundler-audit
codecov
guard-rspec
pry
rake
rspec
rspec-its
simplecov
simplecov-lcov
simplecov_json_formatter
standard
vcr
webmock
Expand Down

0 comments on commit 560cd92

Please sign in to comment.