File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Coverage
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+
8+ permissions :
9+ contents : write
10+
11+ jobs :
12+ coverage :
13+ name : Generate coverage badge
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - uses : actions/checkout@v5
18+
19+ - name : Set up Python
20+ uses : actions/setup-python@v6
21+ with :
22+ python-version : " 3.12"
23+
24+ - name : Install tox and genbadge
25+ run : python -m pip install tox "genbadge[coverage]"
26+
27+ - name : Run tests with coverage
28+ run : tox -e py -- --cov-report xml
29+
30+ - name : Generate coverage badge
31+ run : genbadge coverage -i coverage.xml -o coverage.svg
32+
33+ - name : Publish badge to coverage-badge branch
34+ run : |
35+ cp coverage.svg "${RUNNER_TEMP}/coverage.svg"
36+ git config user.name "github-actions[bot]"
37+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
38+ git checkout --orphan coverage-badge
39+ git rm -rf . > /dev/null 2>&1 || true
40+ cp "${RUNNER_TEMP}/coverage.svg" coverage.svg
41+ git add coverage.svg
42+ git commit -m "Update coverage badge"
43+ git push --force origin coverage-badge
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ Distro - an OS platform information API
44[ ![ CI Status] ( https://github.com/python-distro/distro/workflows/CI/badge.svg )] ( https://github.com/python-distro/distro/actions/workflows/ci.yaml )
55[ ![ PyPI version] ( http://img.shields.io/pypi/v/distro.svg )] ( https://pypi.python.org/pypi/distro )
66[ ![ Supported Python Versions] ( https://img.shields.io/pypi/pyversions/distro.svg )] ( https://img.shields.io/pypi/pyversions/distro.svg )
7+ [ ![ Code Coverage] ( https://raw.githubusercontent.com/python-distro/distro/coverage-badge/coverage.svg )] ( https://github.com/python-distro/distro/actions/workflows/coverage.yaml )
78[ ![ Is Wheel] ( https://img.shields.io/pypi/wheel/distro.svg?style=flat )] ( https://pypi.python.org/pypi/distro )
89[ ![ Latest Github Release] ( https://readthedocs.org/projects/distro/badge/?version=stable )] ( http://distro.readthedocs.io/en/latest/ )
910
You can’t perform that action at this time.
0 commit comments