Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
---
name: Coverage Badge
on:
push:
branches: [main]
paths:
- 'cmd/scadm/**'
- 'cmd/scadfmt/**'
- 'cmd/test/mutation_report.py'
- '.github/actions/publish-badge/**'
- '.github/workflows/coverage-badge.yml'
workflow_dispatch:
permissions: {}
concurrency:
group: coverage-badge
cancel-in-progress: true
jobs:
# The gates live in the scadm-tests and scadfmt-unit-tests pre-commit hooks. This only refreshes the README badges.
badge:
strategy:
matrix:
include:
- package: scadm
badge: coverage.json
- package: scadfmt
badge: scadfmt-coverage.json
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: true # publish-badge pushes with these
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.14'
- name: Install dependencies
env:
PACKAGE: ${{ matrix.package }}
run: |
set -euo pipefail
pip install -e "cmd/$PACKAGE" pytest -r requirements.txt
- name: Measure coverage
working-directory: cmd/${{ matrix.package }}
run: |
set -euo pipefail
python -m pytest tests/ -m "not integration" -q --cov --cov-report=json:"$RUNNER_TEMP/coverage.json"
python ../test/mutation_report.py coverage-badge "$RUNNER_TEMP/coverage.json" > "$RUNNER_TEMP/badge.json"
- name: Publish coverage badge
if: github.ref == 'refs/heads/main'
uses: ./.github/actions/publish-badge
with:
file: ${{ runner.temp }}/badge.json
name: ${{ matrix.badge }}
4121c9fb7This file is pinned to the selected release. Download the original to open it in your design tool.