diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cea9631..d3bd061 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -71,7 +71,10 @@ jobs: run: poetry install --no-interaction --with dev - name: Run tests (full suite) - run: poetry run pytest --cov --cov-report=term-missing + run: poetry run pytest --cov --cov-branch --cov-report=xml + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 docs: name: Build docs (mkdocs) diff --git a/README.md b/README.md index ad15011..74e5147 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Python Project Template ![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2Fgemmadanks%2Fpython-project-template%2Frefs%2Fheads%2Fmain%2Fpyproject.toml) +[![codecov](https://codecov.io/gh/gemmadanks/python-project-template/graph/badge.svg?token=SJVFI32RHC)](https://codecov.io/gh/gemmadanks/python-project-template) [![CI](https://github.com/gemmadanks/python-project-template/actions/workflows/ci.yaml/badge.svg?branch=main)](.github/workflows/ci.yaml) [![release-please](https://github.com/gemmadanks/python-project-template/actions/workflows/release-please.yaml/badge.svg)](release-please-config.json) [![Docs (GitHub Pages)](https://github.com/gemmadanks/python-project-template/actions/workflows/docs-pages.yaml/badge.svg)](https://github.com/gemmadanks/python-project-template/actions/workflows/docs-pages.yaml) @@ -10,7 +11,7 @@ [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) -A minimal, opinionated template for modern Python projects -- featuring Poetry packaging, Ruff for linting and formatting, pytest testing, MkDocs documentation with configuration for Read The Docs, pre-commit hooks, GitHub Actions CI, GitHub issue and pull request templates and automated semantic releases. +A minimal, opinionated template for modern Python projects -- featuring Poetry packaging, Ruff for linting and formatting, pytest testing with code coverage upload to codecov, MkDocs documentation with configuration for Read The Docs, pre-commit hooks, GitHub Actions CI, GitHub issue and pull request templates and automated semantic releases. The goal is to help you start writing code immediately without having to spend time deciding what tools or conventions to use. diff --git a/pyproject.toml b/pyproject.toml index 8432453..8dda695 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,10 +19,10 @@ dependencies = [ [dependency-groups] dev = [ "pytest (>=8.4.2,<9.0.0)", - "pytest-cov (>=7.0.0,<8.0.0)", "ruff (>=0.13.1,<0.15.0)", "pre-commit (>=4.3.0,<5.0.0)", - "pyright (>=1.1.406,<2.0.0)" + "pyright (>=1.1.406,<2.0.0)", + "pytest-cov (>=7.0.0,<8.0.0)" ] docs = [ "mkdocs", @@ -30,6 +30,12 @@ docs = [ "mkdocs-material" ] +[tool.coverage.run] +source = ["package_name"] +omit = [ + "tests/*", + "conftest.py" +] [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"]