Skip to content

Commit 2d59efc

Browse files
authored
ci: add Codecov coverage upload and policy
Adds --cov-report=xml to pytest and uploads coverage.xml to Codecov via codecov-action@v6.0.0 on Python 3.12 only to avoid duplicate reports. Adds codecov.yml enforcing no project regression and ≥80% patch coverage. Adds coverage badge to README. Refs opendecree/decree#153 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent a865ca4 commit 2d59efc

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,15 @@ jobs:
8989
run: pip install -e "sdk[dev]"
9090

9191
- name: Run tests with coverage
92-
run: cd sdk && pytest --cov --cov-report=term-missing
92+
run: cd sdk && pytest --cov --cov-report=term-missing --cov-report=xml:coverage.xml
93+
94+
- name: Upload coverage to Codecov
95+
if: matrix.python-version == '3.12'
96+
# codecov/codecov-action@v6.0.0
97+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2
98+
with:
99+
files: sdk/coverage.xml
100+
token: ${{ secrets.CODECOV_TOKEN }}
93101

94102
examples:
95103
name: Examples

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[![Downloads](https://img.shields.io/pypi/dm/opendecree)](https://pypi.org/project/opendecree/)
77
[![License](https://img.shields.io/github/license/opendecree/decree-python)](LICENSE)
88
[![Project Status: WIP](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
9+
[![codecov](https://codecov.io/gh/opendecree/decree-python/graph/badge.svg)](https://codecov.io/gh/opendecree/decree-python)
910

1011
Python SDK for [OpenDecree](https://github.com/opendecree/decree) — schema-driven configuration management.
1112

codecov.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: auto
6+
threshold: 0%
7+
patch:
8+
default:
9+
target: 80%

0 commit comments

Comments
 (0)