Skip to content

Commit 3651575

Browse files
committed
Run testiq and coverage separately in CI
1 parent 25d6b96 commit 3651575

3 files changed

Lines changed: 31 additions & 7 deletions

File tree

.github/workflows/pytest.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,38 @@ jobs:
3232
run: |
3333
uv run black --check .
3434
35-
- name: Test with pytest
35+
- name: Test with pytest (for testiq)
3636
run: |
3737
uv run pytest --testiq-output=testiq_coverage.json
3838
3939
- name: Analyze test quality with TestIQ
4040
run: |
4141
uv run testiq analyze testiq_coverage.json --threshold 1.0
4242
43-
- name: Upload coverage
44-
uses: codecov/codecov-action@v4
43+
- name: Test with pytest (for coverage)
44+
run: |
45+
uv run pytest --cov=pingping --cov-report=json --cov-report=term
46+
47+
- name: Generate coverage badge
48+
uses: tj-actions/coverage-badge-py@v2
49+
with:
50+
output: coverage.svg
51+
52+
- name: Upload coverage badge
53+
if: github.ref == 'refs/heads/master'
54+
uses: actions/upload-artifact@v4
4555
with:
46-
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
47-
token: ${{ secrets.CODECOV_TOKEN }}
48-
verbose: true
56+
name: coverage-badge
57+
path: coverage.svg
58+
59+
- name: Commit coverage badge
60+
if: github.ref == 'refs/heads/master'
61+
run: |
62+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
63+
git config --local user.name "github-actions[bot]"
64+
mkdir -p .github/badges
65+
mv coverage.svg .github/badges/
66+
git add .github/badges/coverage.svg || true
67+
git diff --quiet && git diff --staged --quiet || git commit -m "Update coverage badge [skip ci]"
68+
git push || true
4969

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ testiq_report.html
5555
.hypothesis/
5656
.pytest_cache/
5757

58+
# Keep coverage badge in git
59+
!.github/badges/coverage.svg
60+
5861
# Translations
5962
*.mo
6063
*.pot

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
44
[![Build Status](https://github.com/network-tools/pingping/actions/workflows/pytest.yml/badge.svg)](https://github.com/network-tools/pingping)
5-
[![codecov](https://codecov.io/gh/network-tools/pingping/branch/master/graph/badge.svg?token=jNB6BX5az1)](https://codecov.io/gh/network-tools/pingping)
5+
[![Coverage](https://raw.githubusercontent.com/network-tools/pingping/master/.github/badges/coverage.svg)](https://github.com/network-tools/pingping)
6+
[![Python Version](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
67
[![Downloads](https://pepy.tech/badge/pingping)](https://pepy.tech/project/pingping)
78
[![GitHub issues open](https://img.shields.io/github/issues/network-tools/pingping.svg?)](https://github.com/network-tools/pingping/issues)
89

0 commit comments

Comments
 (0)