-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
180 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Upload coverage | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
fail-on-coverage-error: | ||
required: false | ||
type: boolean | ||
default: true | ||
description: "Fail if codecov action fails." | ||
artifact-pattern: | ||
required: false | ||
type: string | ||
default: "covreport-*" | ||
description: "glob pattern to the artifacts that should be downloaded for coverage reports. This should match the `name` you used for the `upload-artifact` step in the job that generates the coverage reports. (*This default matches the name in test-pyrepo.yml*)" | ||
secrets: | ||
codecov-token: | ||
required: false | ||
description: "Token for codecov-action." | ||
|
||
jobs: | ||
upload_coverage: | ||
name: Upload coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set CODECOV_TOKEN | ||
shell: bash | ||
run: | | ||
# merge inherited secret with explicit secret | ||
if [ -n "${{ secrets.codecov-token }}" ]; then | ||
echo "CODECOV_TOKEN=${{ secrets.codecov-token }}" >> $GITHUB_ENV | ||
else | ||
echo "CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}" >> $GITHUB_ENV | ||
fi | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install coverage | ||
run: pip install coverage | ||
|
||
- name: Download coverage data | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: ${{ inputs.artifact-pattern }} | ||
path: covreports | ||
merge-multiple: true | ||
|
||
- name: Combine coverage data | ||
run: | | ||
python -Im coverage combine covreports | ||
python -Im coverage xml -o coverage.xml | ||
python -Im coverage report | ||
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY | ||
- name: Upload to codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
fail_ci_if_error: ${{ inputs.fail-on-coverage-error }} | ||
verbose: true | ||
token: ${{ env.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters