pyPhotoAlbum/BADGES.md
Duncan Tourolle f953e1a38a
Some checks failed
Lint / lint (push) Has been cancelled
Tests / test (3.10) (push) Has been cancelled
Tests / test (3.11) (push) Has been cancelled
Tests / test (3.9) (push) Has been cancelled
Python CI / test (push) Has been cancelled
CI integration
2025-10-21 22:24:56 +02:00

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:

  1. Runs tests with coverage reporting
  2. Checks documentation coverage with interrogate
  3. Generates coverage badges
  4. Commits badges to a separate badges branch

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

![Coverage Badge](https://gitea.tourolle.paris/dtourolle/pyPhotoAlbum/raw/branch/badges/cov_info/coverage.svg)

Documentation Coverage Badge

![Docs Badge](https://gitea.tourolle.paris/dtourolle/pyPhotoAlbum/raw/branch/badges/cov_info/coverage-docs.svg)

Example README Section

# pyPhotoAlbum

![Coverage Badge](https://gitea.tourolle.paris/dtourolle/pyPhotoAlbum/raw/branch/badges/cov_info/coverage.svg)
![Docs Badge](https://gitea.tourolle.paris/dtourolle/pyPhotoAlbum/raw/branch/badges/cov_info/coverage-docs.svg)

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, or develop branches
  • 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

  1. Go to your Gitea profile settings
  2. Navigate to Applications → Generate New Token
  3. Give it a descriptive name (e.g., "CI Badges Token")
  4. Select the repository scope
  5. Generate the token
  6. Go to your repository → Settings → Secrets
  7. Add a new secret named PUSH_TOKEN with the token value

Coverage Reports

In addition to badges, the workflow also generates:

  • coverage.json - Machine-readable coverage data
  • coverage.xml - XML format coverage report
  • htmlcov/ - HTML coverage report
  • coverage-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/.