diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 719bda6..0000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Coverage - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v7 - - name: Install Ruby (3.4) - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.4 - bundler-cache: true - - name: Build and test with RSpec - run: RACK_ENV=test bundle exec rake spec - env: - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a917b3a..5e9e543 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,7 @@ jobs: test: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: ruby-version: - "3.1" @@ -21,7 +22,17 @@ jobs: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - name: Run Tests - run: RACK_ENV=test bundle exec rake spec + env: + RACK_ENV: test + CI: true + run: bundle exec rake spec + - name: Report coverage to Coveralls + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: coverage/lcov.info + flag-name: ${{ matrix.ruby-version }} + parallel: true integration: runs-on: ubuntu-latest steps: @@ -33,3 +44,12 @@ jobs: bundler-cache: true - name: Run Integration Tests run: RACK_ENV=test bundle exec rake spec:integration + coverage-finished: + needs: [test] + runs-on: ubuntu-latest + steps: + - name: Report coverage build as finished + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/CHANGELOG.md b/CHANGELOG.md index e744cbc..24b3342 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * [#108](https://github.com/dblock/strava-ruby-client/pull/108): Adds an integration test that verifies the real Strava API endpoint is reachable, run in CI on every push and pull request via `rake spec:integration` - [@dblock](https://github.com/dblock). * [#107](https://github.com/dblock/strava-ruby-client/pull/107): Fixes `explore_segments` and `star_segment` raising `UncaughtThrowError` instead of `ArgumentError` for missing required arguments - [@dblock](https://github.com/dblock). * [#107](https://github.com/dblock/strava-ruby-client/pull/107): Fixes `start_date_local` to always derive the timezone offset from the difference between `start_date` and `start_date_local`, since Strava's `timezone` property does not account for daylight saving time - [@dblock](https://github.com/dblock). +* [#109](https://github.com/dblock/strava-ruby-client/pull/109): Fixed coverage reporting to Coveralls not running on pull requests, and to report coverage from every Ruby/JRuby test matrix job merged into a single build, by switching from `coveralls_reborn`/`COVERALLS_REPO_TOKEN` to `coverallsapp/github-action`/`GITHUB_TOKEN` - [@dblock](https://github.com/dblock). * Your contribution here. ### 3.0.0 (2025/10/24) diff --git a/Gemfile b/Gemfile index 8b1cfd4..d3f59ce 100755 --- a/Gemfile +++ b/Gemfile @@ -27,5 +27,6 @@ group :development, :test do end group :test do - gem 'coveralls_reborn', require: false + gem 'simplecov' + gem 'simplecov-lcov', require: false end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3b1f171..d662033 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,8 +4,16 @@ require 'rubygems' -require 'coveralls' -Coveralls.wear! +require 'simplecov' +require 'simplecov-lcov' + +SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true +SimpleCov::Formatter::LcovFormatter.config.single_report_path = 'coverage/lcov.info' +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::LcovFormatter + ]) +SimpleCov.start require 'rspec' require 'strava-ruby-client'