Coverage #6
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 was generated from bswck/[email protected]. | |
# Instead of changing this particular file, you might want to alter the template: | |
# https://github.com/bswck/skeleton/tree/0.0.2rc-116-gaf71a4b/project/.github/workflows/%23%25%20if%20tests%20and%20public%20%25%23coverage.yml%23%25%20endif%20%25%23.jinja | |
# IMPORTANT! | |
# Pinned versions of actions and Poetry are managed in a different repository. | |
# Do not submit PRs to this file unless for this repo specifically. | |
# To change this workflow globally, submit a PR to https://github.com/bswck/skeleton. | |
name: "Upload Coverage" | |
on: | |
workflow_run: | |
workflows: ["Tests"] | |
types: ["completed"] | |
permissions: | |
actions: "read" | |
statuses: "write" | |
jobs: | |
combine: | |
if: "${{github.event.workflow_run.conclusion == 'success'}}" | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: "actions/checkout@v4" | |
- name: "Install Poetry" | |
run: "pipx install poetry==1.7.1" | |
- name: "Set up Python" | |
uses: "actions/setup-python@v5" | |
with: | |
cache: "poetry" | |
- name: "Install the project" | |
run: "poetry install --only=dev,dev-skeleton" | |
- run: "gh run download ${{github.event.workflow_run.id}} --dir .covfiles/" | |
env: | |
GH_TOKEN: "${{github.token}}" | |
- run: "poetry run coverage combine --append .covfiles/*" | |
- name: "Upload coverage data file" | |
uses: "actions/upload-artifact@v4" | |
with: | |
name: "coverage" | |
path: ".coverage" | |
- run: "poetry run coverage xml --fail-under=0" | |
- name: "Upload coverage XML report" | |
uses: "actions/upload-artifact@v4" | |
with: | |
name: "coverage-xml" | |
path: "coverage.xml" | |
- run: > | |
poetry run coverage html | |
--fail-under=0 | |
--directory=.covhtml/ | |
--show-contexts | |
--title "lazy-importing coverage for ${{github.sha}}" | |
- name: "Upload coverage HTML report" | |
uses: "actions/upload-artifact@v4" | |
with: | |
name: "coverage-html" | |
path: ".covhtml/" | |
codecov: | |
needs: "combine" | |
if: "${{github.event.workflow_run.pull_requests[0]}}" | |
runs-on: "ubuntu-latest" | |
environment: "Upload Coverage" | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "actions/download-artifact@v4" | |
with: | |
name: "coverage-xml" | |
merge-multiple: true | |
- name: "Upload coverage reports to Codecov" | |
uses: "codecov/codecov-action@v3" | |
with: | |
files: "coverage.xml" | |
env: | |
CODECOV_TOKEN: "${{secrets.CODECOV_TOKEN}}" | |
smokeshow: | |
needs: "combine" | |
if: "${{github.event.workflow_run.head_branch == 'main'}}" | |
runs-on: "ubuntu-latest" | |
environment: "Upload Coverage" | |
steps: | |
- uses: "actions/checkout@v4" | |
- name: "Install Poetry" | |
run: "pipx install poetry==1.7.1" | |
- uses: "actions/setup-python@v5" | |
with: | |
cache: "poetry" | |
- name: "Install the project" | |
run: "poetry install --only=dev,dev-skeleton" | |
- name: "Download coverage reports" | |
uses: "actions/download-artifact@v4" | |
with: | |
name: "coverage-html" | |
path: ".covhtml/" | |
merge-multiple: true | |
- run: "poetry run smokeshow upload .covhtml/" | |
env: | |
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: "Coverage {coverage-percentage}" | |
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 90 | |
SMOKESHOW_GITHUB_CONTEXT: "coverage" | |
SMOKESHOW_GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" | |
SMOKESHOW_GITHUB_PR_HEAD_SHA: "${{github.event.workflow_run.head_sha}}" | |
SMOKESHOW_AUTH_KEY: "${{secrets.SMOKESHOW_AUTH_KEY}}" |