@@ -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
0 commit comments