Private
Public Access
45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
name: Codacy Coverage
|
|
|
|
# Runs the test suite with coverage and reports it to Codacy (feeds the grade
|
|
# and coverage badge). Triggers on every commit reaching main and on PRs.
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
coverage:
|
|
name: Tests + coverage
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Set up uv
|
|
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
|
|
with:
|
|
python-version: "3.14"
|
|
|
|
- name: Install dependencies
|
|
run: uv sync
|
|
|
|
- name: Run tests with coverage
|
|
run: uv run pytest --cov --cov-report=xml
|
|
|
|
# Only uploads when the CODACY_PROJECT_TOKEN secret is configured, so the
|
|
# job still passes (tests + coverage) before Codacy is wired up. Add the
|
|
# token under Settings > Secrets and variables > Actions to enable upload.
|
|
- name: Upload coverage to Codacy
|
|
if: env.CODACY_PROJECT_TOKEN != ''
|
|
uses: codacy/codacy-coverage-reporter-action@89d6c85cfafaec52c72b6c5e8b2878d33104c699 # v1.3.0
|
|
with:
|
|
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
coverage-reports: coverage.xml
|