diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 00000000..5b1b06f5 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,40 @@ +# Codecov configuration for python-zk/kazoo +# Reference: https://docs.codecov.com/docs/codecov-yaml + +codecov: + # Wait for all 28 test matrix jobs (7 Python versions x 4 ZooKeeper versions) + # to upload their coverage reports before calculating the final coverage status. + # NOTE: If the test matrix in .github/workflows/testing.yml changes (e.g. adding + # or removing Python or ZooKeeper versions), this number must be updated to match + # the new total: len(python-version) * len(zk-version). + after_n_builds: 28 + +coverage: + status: + # Project coverage measures overall repository coverage against the base branch. + project: + default: + # 'auto' uses the coverage percentage of the base commit as the target. + target: auto + # Allow up to a 1% decrease in overall coverage to account for minor + # fluctuations, refactoring, or platform-specific code. + threshold: 1% + # Mark status as informational so minor drops do not block or fail PR CI checks. + informational: true + + # Patch coverage measures test coverage specifically on the lines modified in the PR. + patch: + default: + # Require 80% coverage on new/changed lines rather than strict 100%, + # allowing for defensive error handling, deprecation warnings, or unreachable branches. + target: 80% + # Allow up to 5% variance below the target. + threshold: 5% + # Mark status as informational so uncovered edge-case branches do not fail PR CI checks. + informational: true + +comment: + layout: "diff, flags, files" + behavior: default + # Only post or update the PR comment once all builds are complete. + require_changes: false diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index cae7955e..ed19b8e3 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -48,6 +48,10 @@ jobs: strategy: fail-fast: false matrix: + # NOTE: If you add or remove Python versions or ZooKeeper versions from this + # matrix, you MUST update `codecov.after_n_builds` in .codecov.yml to match + # len(python-version) * len(zk-version) so Codecov waits for all matrix builds + # before evaluating coverage status checks. python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "pypy-3.11-v7.3.21"] # Friendly note: If you change the minimum zk-version here, update it in # ensure-zookeeper-env.sh. Additionally, if you need to change the way that diff --git a/README.md b/README.md index fa80ed89..779e18d3 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ Kazoo [![Kazoo Awesome Testing](https://github.com/python-zk/kazoo/actions/workflows/testing.yml/badge.svg?branch=master)](https://github.com/python-zk/kazoo/actions/workflows/testing.yml?query=branch%3Amaster) [![Latest Version](https://img.shields.io/pypi/v/kazoo.svg)](https://pypi.org/project/kazoo/) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) +[![codecov](https://codecov.io/gh/python-zk/kazoo/branch/master/graph/badge.svg)](https://codecov.io/gh/python-zk/kazoo) `kazoo` implements a higher level API to [Apache ZooKeeper](http://zookeeper.apache.org/) for Python clients.