-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add coverage report handling * test the foobar file * fix coverage run * forgot checkout * specify shell * debug * debug * try again * do not fail on combine * add docs
- Loading branch information
Showing
4 changed files
with
118 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: "Report Coverage" | ||
description: "Combine Coverage and Report" | ||
inputs: | ||
fail_under: | ||
description: "The coverage amount to fail under" | ||
default: 80 | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
# Use latest Python, so it understands all syntax. | ||
python-version: "3.11" | ||
|
||
- run: python -Im pip install --upgrade coverage[toml] | ||
shell: bash | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: coverage-data | ||
|
||
- name: Combine coverage & fail if it's <${{inputs.fail_under}}. | ||
shell: bash | ||
run: | | ||
python -Im coverage combine || true | ||
python -Im coverage html --skip-covered --skip-empty | ||
# Report and write to summary. | ||
python -Im coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY | ||
# Report again and fail if under threshold | ||
python -Im coverage report --fail-under=${{inputs.fail_under}} | ||
- name: Upload HTML report if check failed. | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: html-report | ||
path: htmlcov | ||
if: ${{ failure() }} |
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,16 @@ | ||
name: "Upload Coverage" | ||
description: "Upload the coverage report(s) for this job" | ||
inputs: | ||
file_pattern: | ||
description: "The coverage file pattern" | ||
default: ".coverage" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Upload coverage data | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-data | ||
path: ${{inputs.file_pattern}} | ||
if-no-files-found: ignore |
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