diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f10898..3f5df28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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/codeclimate-action@v3.0.0 - 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 diff --git a/.simplecov b/.simplecov index e566a07..4e756af 100644 --- a/.simplecov +++ b/.simplecov @@ -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 diff --git a/Gemfile b/Gemfile index 51ce58f..a9281a8 100644 --- a/Gemfile +++ b/Gemfile @@ -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 @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index 2e5dbd2..0ccaeae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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