2.3 KiB
2.3 KiB
Coverage Badges Integration
This document explains how to integrate the coverage badges generated by the CI workflow into your README.
How It Works
The Python CI workflow automatically:
- Runs tests with coverage reporting
- Checks documentation coverage with interrogate
- Generates coverage badges
- Commits badges to a separate
badgesbranch
Using the Badges in README
Once the workflow has run successfully on the master branch, you can add the following badges to your README.md:
Test Coverage Badge

Documentation Coverage Badge

Example README Section
# pyPhotoAlbum


A Python application for designing photo albums and exporting them to PDF.
Workflow Details
- Workflow File:
.gitea/workflows/ci.yml - Trigger: Pushes to
main,master, ordevelopbranches - Runner: Self-hosted
- Badge Branch:
badges(automatically created/updated) - Badge Location:
cov_info/directory in badges branch
Requirements
The workflow requires a PUSH_TOKEN secret to be configured in your Gitea repository settings. This token allows the workflow to push to the badges branch.
Setting Up the PUSH_TOKEN
- Go to your Gitea profile settings
- Navigate to Applications → Generate New Token
- Give it a descriptive name (e.g., "CI Badges Token")
- Select the
repositoryscope - Generate the token
- Go to your repository → Settings → Secrets
- Add a new secret named
PUSH_TOKENwith the token value
Coverage Reports
In addition to badges, the workflow also generates:
coverage.json- Machine-readable coverage datacoverage.xml- XML format coverage reporthtmlcov/- HTML coverage reportcoverage-summary.txt- Simple text summary of coverage percentage
All these files are available as artifacts after each workflow run and are stored in the badges branch under cov_info/.