Skip to content

GitHub Action for python coverage publish & analysis

License

Notifications You must be signed in to change notification settings

orgoro/coverage

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7dbd48c · Apr 15, 2025

History

77 Commits
Mar 2, 2023
Sep 30, 2022
Jul 11, 2024
Oct 2, 2022
Jul 11, 2024
Oct 6, 2021
Oct 3, 2021
Oct 3, 2021
Oct 3, 2021
Oct 3, 2021
Oct 10, 2021
Oct 6, 2021
Oct 3, 2021
Apr 15, 2025
Jul 11, 2024
Sep 30, 2022
Sep 30, 2022
Oct 3, 2021
Jul 11, 2024
Jul 11, 2024
Oct 3, 2021

Repository files navigation

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/[email protected]
            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
passIcon the indicator to use for files that passed 🟢
failIcon the indicator to use for files that failed 🔴
sourceDir the directory to use as the source of the coverage report ./path/to/src