Skip to content

Commit 1a34292

Browse files
authored
Merge pull request #36 from t-strings/dave/coverage-badge
Add test count and coverage badges to README
2 parents d03981b + 010605e commit 1a34292

File tree

6 files changed

+151
-2
lines changed

6 files changed

+151
-2
lines changed

.github/workflows/pages.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ concurrency:
2222
jobs:
2323
build:
2424
runs-on: ubuntu-latest
25-
name: Build Sphinx documentation
25+
name: Build Sphinx documentation and Special Badges
2626
steps:
2727
- uses: actions/checkout@v4
2828

@@ -39,6 +39,20 @@ jobs:
3939
cd docs
4040
uv run sphinx-build . _build
4141
42+
- name: Generate reports
43+
run: |
44+
mkdir -p reports
45+
uv run pytest --cov=tdom --cov-report=xml:reports/coverage.xml --cov-report=term --cov-report=html:reports/coverage --junitxml=reports/pytest.xml --html=reports/pytest.html
46+
47+
- name: Generate badges
48+
run: |
49+
uv run genbadge tests -i reports/pytest.xml -v -o reports/pytest.svg
50+
uv run genbadge coverage -i reports/coverage.xml -v -o reports/coverage.svg
51+
52+
- name: Move reports to docs/_build
53+
run: |
54+
mv reports docs/_build/
55+
4256
- name: Upload artifact to pages
4357
uses: actions/upload-pages-artifact@v3
4458
with:

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ wheels/
99
# Virtual environments
1010
.venv
1111

12-
# Coverage
12+
# Coverage and test reports
1313
.coverage
14+
reports/
1415

1516
# Sphinx build output
1617
docs/_build/
18+
19+
# macOS
20+
.DS_Store

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ A 🤘 rockin' t-string HTML templating system for Python 3.14.
44

55
[![PyPI](https://img.shields.io/pypi/v/tdom.svg)](https://pypi.org/project/tdom/)
66
[![Tests](https://github.com/t-strings/tdom/actions/workflows/ci.yml/badge.svg)](https://github.com/t-strings/tdom/actions/workflows/pytest.yml)
7+
[![Test Count](https://t-strings.github.io/tdom/reports/pytest.svg)](https://t-strings.github.io/tdom/reports/pytest.html)
8+
[![Coverage](https://t-strings.github.io/tdom/reports/coverage.svg)](https://t-strings.github.io/tdom/reports/coverage.html)
79
[![Changelog](https://img.shields.io/github/v/release/t-strings/tdom?include_prereleases&label=changelog)](https://github.com/t-strings/tdom/releases)
810
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/t-strings/tdom/blob/main/LICENSE)
11+
[![Docs](https://img.shields.io/badge/docs-online-blue.svg)](https://t-strings.github.io/tdom/)
912

1013
## Installation
1114

justfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,16 @@ clean_package:
3131
build: build_docs build_package
3232

3333
clean: clean_docs clean_package
34+
35+
reports:
36+
uv run pytest --cov=tdom --cov-report=xml:reports/coverage.xml --cov-report=term --cov-report=html:reports/coverage --junitxml=reports/pytest.xml --html=reports/pytest.html
37+
38+
clean_reports:
39+
rm -rf reports/
40+
41+
badges:
42+
uv run genbadge tests -i reports/pytest.xml -v -o reports/pytest.svg
43+
uv run genbadge coverage -i reports/coverage.xml -v -o reports/coverage.svg
44+
45+
clean_badges:
46+
rm -rf reports/*.svg

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ CI = "https://github.com/t-strings/tdom/actions"
3737
[dependency-groups]
3838
dev = [
3939
"furo>=2025.7.19",
40+
"genbadge[coverage,tests]>=1.1.2",
4041
"myst-parser>=4.0.1",
4142
"pyright>=1.1.404",
4243
"pytest>=8.4.1",
4344
"pytest-cov>=6.3.0",
45+
"pytest-html>=4.1.1",
4446
"pytest-watcher>=0.4.3",
4547
"ruff>=0.12.11",
4648
"sphinx>=8.2.3",

uv.lock

Lines changed: 113 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)