Skip to content

Commit

Permalink
Update code coverage in CI workflow
Browse files Browse the repository at this point in the history
This matches what we do in other repos for managing code coverage file and upload.
  • Loading branch information
javierjulio committed Apr 16, 2024
1 parent c3c44cb commit d9964a9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
41 changes: 30 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 0 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d9964a9

Please sign in to comment.