Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,13 @@ jobs:
- name: Run tox
run: tox -e py

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: .coverage

windows:
name: Windows
runs-on: windows-latest

steps:
- uses: actions/checkout@v5

- uses: codecov/codecov-action@v3

- name: Set up Python
uses: actions/setup-python@v6
with:
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Coverage

on:
push:
branches:
- master

permissions:
contents: write

jobs:
coverage:
name: Generate coverage badge
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Install tox and genbadge
run: python -m pip install tox "genbadge[coverage]"

- name: Run tests with coverage
run: tox -e py -- --cov-report xml

- name: Generate coverage badge
run: genbadge coverage -i coverage.xml -o coverage.svg

- name: Publish badge to coverage-badge branch
run: |
cp coverage.svg "${RUNNER_TEMP}/coverage.svg"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout --orphan coverage-badge
git rm -rf . > /dev/null 2>&1 || true
cp "${RUNNER_TEMP}/coverage.svg" coverage.svg
git add coverage.svg
git commit -m "Update coverage badge"
git push --force origin coverage-badge
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Distro - an OS platform information API
[![CI Status](https://github.com/python-distro/distro/workflows/CI/badge.svg)](https://github.com/python-distro/distro/actions/workflows/ci.yaml)
[![PyPI version](http://img.shields.io/pypi/v/distro.svg)](https://pypi.python.org/pypi/distro)
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/distro.svg)](https://img.shields.io/pypi/pyversions/distro.svg)
[![Code Coverage](https://codecov.io/github/python-distro/distro/coverage.svg?branch=master)](https://codecov.io/github/python-distro/distro?branch=master)
[![Code Coverage](https://raw.githubusercontent.com/python-distro/distro/coverage-badge/coverage.svg)](https://github.com/python-distro/distro/actions/workflows/coverage.yaml)
[![Is Wheel](https://img.shields.io/pypi/wheel/distro.svg?style=flat)](https://pypi.python.org/pypi/distro)
[![Latest Github Release](https://readthedocs.org/projects/distro/badge/?version=stable)](http://distro.readthedocs.io/en/latest/)

Expand Down
Loading