Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Coverage

Coverage #122

Workflow file for this run

# This file was generated from skeleton-ci/[email protected].
# Instead of changing this particular file, you might want to alter the template:
# https://github.com/skeleton-ci/skeleton-python/tree/0.0.2rc-215-g792492f/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/skeleton-ci/skeleton-python.
name: "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.8.2"
- 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}}"
- name: "Combine coverage data files from multicontextual runs"
run: "poetry run coverage combine --append .covfiles/*"
- name: "Show coverage report"
run: "poetry run coverage report --show-missing --fail-under=0"
- 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 "autorefine 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: "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@v4"
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: "Coverage"
steps:
- uses: "actions/checkout@v4"
- name: "Install Poetry"
run: "pipx install poetry==1.8.2"
- 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}}"