Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/workflows/_tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ on:
default: false
required: false
type: boolean
secrets:
CODECOV_TOKEN:
description: 'Codecov token'
required: true

jobs:
validate:
Expand Down Expand Up @@ -64,6 +68,14 @@ jobs:
run: |
if ${{ inputs.headless }}; then
export DISPLAY=:99

fi
python -m pytest
pytest --cov
coverage report -m
codecov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uploading to the branch within Codecov.io other than main to generate the PR comment. This approach ensures that the user-facing main branch coverage remains unaffected during a PR:

I have tested using a dummy package:

branch:

https://app.codecov.io/gh/bobleesj-test-org/bobleesj.release/commits/test-codecov

main:

https://app.codecov.io/gh/bobleesj-test-org/bobleesj.release/commits/main

with:
verbose: true
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/templates/tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ jobs:
project: {{ PROJECT/PROJECT_NAME }}
c_extension: {{ C_EXTENSION/false }}
headless: {{ HEADLESS/false }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}