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

Repository files navigation

Pytest Coverage Commentator

A Github action to comments a Pytest Coverage on PR. Please note: this action only available on pull request.

GitHub Action

The following is an example GitHub Action workflow that uses the Pytest Coverage Commentator to extract the coverage to comment at pull request. Here is an example setup of this action:

# This workflow will install dependencies, create coverage tests and run Pytest Coverage Commentator# For more information see: https://github.com/coroo/pytest-coverage-commentatorname: pytest-coverage-commentatoron:
pull_request:
branches: - '*'jobs:
build:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v2
- name: Set up Python 3.8uses: actions/setup-python@v2with:
python-version: 3.8
- name: Install dependenciesrun: | python -m pip install --upgrade pip pip install flake8 pytest pytest-cov if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Build coverage filerun: | pytest --cache-clear --cov=app test/ > pytest-coverage.txt - name: Comment coverageuses: coroo/pytest-coverage-commentator@v1.0.2

Action Input

By default, action is designed to run with minimal configuration but you can alter Pytest Coverage Commentator using following action input:

VariableDefaultPurpose
pytest-coveragepytest-coverage.txtFile conversion from pytest coverage. It will be used to create a comment.

You can see the action block with all variables as below:

 - name: pytest-coverage-commentatoruses: coroo/pytest-coverage-commentator@v1.0.2with:
pytest-coverage: pytest-coverage.txt

Result Example

coverage-result

About

A Github action to comments a Pytest Coverage on PR

Resources

Stars

46 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages