From d9964a9f7867487dce669812174f0ce69307a63e Mon Sep 17 00:00:00 2001 From: Javier Julio Date: Tue, 16 Apr 2024 13:11:05 -0400 Subject: [PATCH] Update code coverage in CI workflow This matches what we do in other repos for managing code coverage file and upload. --- .github/workflows/ci.yml | 41 +++++++++++++++++++++++++++++----------- test/test_helper.rb | 2 -- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa4b245..cad4c8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,18 +2,20 @@ name: Tests on: push: - branches: [ master ] + branches: + - master pull_request: - branches: [ master ] jobs: build: runs-on: ubuntu-latest strategy: matrix: - ruby: [ '3.0', '3.1', '3.2' ] - env: - CODECOV_UPLOAD_TAG: ${{ matrix.ruby }} + ruby: + - '3.0' + - '3.1' + - '3.2' + - '3.3' name: Ruby ${{ matrix.ruby }} steps: - uses: actions/checkout@v4 @@ -34,11 +36,28 @@ jobs: PAYSAFE_UNITY_API_SECRET: test PAYSAFE_UNITY_SUT_API_KEY: test PAYSAFE_UNITY_SUT_API_SECRET: test - run: | - bundle exec rake - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + run: bundle exec rake + - name: Rename coverage file by matrix run + run: mv coverage/coverage.xml coverage/coverage-ruby-${{ matrix.ruby }}.xml + - uses: actions/upload-artifact@v4 + with: + name: coverage-ruby-${{ matrix.ruby }} + path: coverage + if-no-files-found: error + + upload_coverage: + name: Upload Coverage + runs-on: ubuntu-latest + needs: [build] + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + path: coverage + pattern: coverage-ruby-* + merge-multiple: true + - uses: codecov/codecov-action@v4 with: - env_vars: CODECOV_UPLOAD_TAG - fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + directory: coverage + fail_ci_if_error: true diff --git a/test/test_helper.rb b/test/test_helper.rb index 65feb93..dd28e69 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,8 +3,6 @@ require "simplecov-cobertura" SimpleCov.start do add_filter %r{^/test/} - minimum_coverage 99 - maximum_coverage_drop 0.2 formatter SimpleCov::Formatter::CoberturaFormatter end end