Skip to content

Add code coverage badge #233

Add code coverage badge

Add code coverage badge #233

# test-related stuff, but it doesn't need to run on every os/version of python
name: Check Test Coverage
on:
pull_request:
branches:
- development
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python --version
python -m pip install --upgrade pip
python -m pip install --upgrade build
pip install .
pip install .[test]
doit version
python -m build
# https://github.com/marketplace/actions/pytest-coverage-comment
- name: Generate coverage report
run: pytest --junitxml=pytest.xml --cov=tabcmd tests/ | tee pytest-coverage.txt
# trying another coverage reporter for PRs/badges
- name: Coveralls
uses: coverallsapp/github-action@v2
- name: Comment on pull request with coverage
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
# TODO: check if this has been fixed
# Error: The head commit for this pull_request event is not ahead of the base commit.
# Please submit an issue on this action's GitHub repo
# report-only-changed-files: true
# TODO track docstring coverage
# https://github.com/marketplace/actions/python-interrogate-check