Skip to content

Commit 4c52bcb

Browse files
gijzelaerrclaude
andauthored
Add coverage badge and coverage threshold (gijzelaerr#637)
* Add coverage badge and coverage threshold - Replace artifact upload with codecov/codecov-action@v5 in test workflow - Add codecov badge to README.rst - Add coverage threshold of 80% in pyproject.toml and codecov.yml Closes gijzelaerr#619 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Lower coverage threshold to 75% to match current coverage Current coverage is 78% — set threshold to 75% to provide a safety net without failing CI. Can be raised as coverage improves. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add project badges to README Add PyPI version, Python versions, license, CI status, and Read the Docs badges alongside the existing Codecov badge for a professional landing page. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Don't fail CI when Codecov upload fails Codecov v5 requires a token for protected branches, causing "Token required because branch is protected" errors that block CI. Coverage upload is best-effort, not a gate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f880d8c commit 4c52bcb

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ jobs:
3333
uv pip install ".[test]"
3434
- name: Run pytest
3535
run: uv run pytest --cov=snap7 --cov-report=xml --cov-report=term
36-
- name: Upload coverage report
36+
- name: Upload coverage to Codecov
3737
if: matrix.python-version == '3.13' && matrix.runs-on == 'ubuntu-24.04'
38-
uses: actions/upload-artifact@v7
38+
uses: codecov/codecov-action@v5
3939
with:
40-
name: coverage-report
41-
path: coverage.xml
40+
files: coverage.xml
41+
fail_ci_if_error: false

README.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
.. image:: https://img.shields.io/pypi/v/python-snap7.svg
2+
:target: https://pypi.org/project/python-snap7/
3+
4+
.. image:: https://img.shields.io/pypi/pyversions/python-snap7.svg
5+
:target: https://pypi.org/project/python-snap7/
6+
7+
.. image:: https://img.shields.io/github/license/gijzelaerr/python-snap7.svg
8+
:target: https://github.com/gijzelaerr/python-snap7/blob/master/LICENSE
9+
10+
.. image:: https://github.com/gijzelaerr/python-snap7/actions/workflows/test.yml/badge.svg
11+
:target: https://github.com/gijzelaerr/python-snap7/actions/workflows/test.yml
12+
13+
.. image:: https://readthedocs.org/projects/python-snap7/badge/
14+
:target: https://python-snap7.readthedocs.io/en/latest/
15+
16+
.. image:: https://codecov.io/gh/gijzelaerr/python-snap7/branch/master/graph/badge.svg
17+
:target: https://codecov.io/gh/gijzelaerr/python-snap7
18+
119
About
220
=====
321

codecov.yml

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

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ strict = true
6464
# https://github.com/python/mypy/issues/2427#issuecomment-1419206807
6565
disable_error_code = ["method-assign", "attr-defined"]
6666

67+
[tool.coverage.report]
68+
fail_under = 75
69+
6770
[tool.ruff]
6871
output-format = "full"
6972
line-length = 130

0 commit comments

Comments
 (0)