diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2acf77..44402bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,8 +33,16 @@ jobs: - name: Lint with ruff run: uv run ruff check src/ tests/ - - name: Run tests - run: uv run pytest tests/ -v + - name: Run tests with coverage + run: uv run pytest --cov --cov-report=xml + + - name: Upload coverage to Codecov + if: matrix.os == 'ubuntu-latest' + uses: codecov/codecov-action@v5 + with: + files: coverage.xml + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} smoke-macos: runs-on: macos-latest diff --git a/README.md b/README.md index 0833fe8..6dcedc7 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Python versions](https://img.shields.io/pypi/pyversions/yt-dont-recommend)](https://pypi.org/project/yt-dont-recommend/) [![License](https://img.shields.io/pypi/l/yt-dont-recommend)](https://github.com/cmeans/yt-dont-recommend/blob/main/LICENSE) [![CI](https://img.shields.io/github/actions/workflow/status/cmeans/yt-dont-recommend/ci.yml?label=CI)](https://github.com/cmeans/yt-dont-recommend/actions/workflows/ci.yml) +[![Coverage](https://codecov.io/gh/cmeans/yt-dont-recommend/graph/badge.svg)](https://codecov.io/gh/cmeans/yt-dont-recommend) [![Downloads](https://img.shields.io/pypi/dm/yt-dont-recommend)](https://pypi.org/project/yt-dont-recommend/) > **Early development / alpha:** This tool is functional and used daily by its author, but it is under active development with frequent releases. Breaking changes between versions are possible. **Auto-upgrade is not recommended** until the tool stabilises — enable it only if you are comfortable testing new features as they land and are willing to use `--revert` when something goes wrong. diff --git a/pyproject.toml b/pyproject.toml index 7fd86bc..22d7010 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ Changelog = "https://github.com/cmeans/yt-dont-recommend/blob/main/CHANGELOG.md" [project.optional-dependencies] dev = [ "pytest", + "pytest-cov>=7.0", "pyyaml", "ruff", ] @@ -61,3 +62,10 @@ ignore = [ [tool.ruff.lint.isort] known-first-party = ["yt_dont_recommend"] + +[tool.coverage.run] +source = ["yt_dont_recommend"] + +[tool.coverage.report] +show_missing = true +skip_empty = true