Skip to content

try adding coverage badge #25

try adding coverage badge

try adding coverage badge #25

name: CI first code check
on:
push:
workflow_dispatch:
inputs:
tag:
description: Tag for manually running CI first code check workflow
required: False
default: ''
jobs:
first_check:
name: first code check / python-3.13 / ubuntu-latest
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Python info
run: |
which python
python --version
- name: Build package and create dev environment
run: |
python -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install --with dev
- name: Show pip list
run: |
pip list
- name: Test with coverage
run: |
poetry run pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml
- name: Correct coverage paths
run: sed -i "s+$PWD/++g" coverage.xml
- name: Run ruff linter
run: ruff check --output-format=github
- name: Create coverage badge (SVG)
run: |
python -m pip install --upgrade genbadge[coverage]
mkdir -p badges
genbadge coverage -i coverage.xml -o docs/badges/coverage.svg
- name: Commit coverage badge on default branch
if: github.ref == 'refs/heads/main'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "ci: update coverage badge [skip ci]"
file_pattern: docs/badges/coverage.svg