Skip to content

Warning

You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?

Python Coverage

Actions
Publish coverage report to a PR enforce coverage on new modified files
v3
Star (113)

Python Coverage: The Esential Coverage Reporter GitHub Action for python

☂️ parse and publish coverage xml to a PR, enforce coverage rate on new & modified files

Usage

Create a new workflow .yml file in the .github/workflows/ directory.

You can create a coverage report using python:

  • pytest $ pytest --cov-report xml:path/to/coverage.xml
  • coverage $ coverage xml path/to/coverage.xml

Minimal Configuration

name: 'coverage'
on:
    pull_request:
        branches:
            - master
            - main
jobs:
    coverage:
        runs-on: ubuntu-latest
        steps:
          - name: Get Cover 
            uses: orgoro/coverage@v3
            with:
                coverageFile: path/to/coverage.xml
                token: ${{ secrets.GITHUB_TOKEN }}

PR Message & Job Summary 🆕

message

Inputs

Input Optional Description Example
coverageFile path to .xml coverage report ./path/to/coverage.xml
token your github token 🤫
thresholdAll the minimal average line coverage 0.8
thresholdNew the minimal average new files line coverage 0.9
thresholdModified the minimal average modified files line coverage 0.0

Python Coverage is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Publish coverage report to a PR enforce coverage on new modified files
v3

Python Coverage is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.