Skip to content

CI — Python

Runs lint → format → typecheck → test for a Python application. Uses uv for dependency management, ruff for lint/format, and ty for type checking.

Usage

yaml
jobs:
  ci:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/ci-python.yml@main
    with:
      python-version: '3.12'
      working-directory: '.'

Inputs

InputTypeDefaultDescription
python-versionstring'3.12'Python version
working-directorystring'.'Path to the app root (e.g. apps/api)
run-lintbooleantrueRun ruff check
run-formatbooleantrueRun ruff format --check
run-typecheckbooleantrueRun ty check
run-testbooleantrueRun pytest
run-coveragebooleanfalseEnable coverage report via pytest-cov
coverage-fail-undernumber80Minimum coverage percentage required to pass
test-commandstringuv run pytest --tb=short -qCustom pytest command (ignored when run-coverage: true)

Steps

  1. Checkout
  2. Setup Python + uv (via setup-python)
  3. Lint (ruff check --output-format github)
  4. Format check (ruff format --check)
  5. Type check (ty check --output-format github)
  6. Test (pytest, with or without pytest-cov)

Notes

  • When run-coverage: true, the test-command input is ignored and coverage flags are applied automatically.
  • coverage-fail-under only applies when run-coverage: true.