Skip to content

Latest commit

 

History

History
135 lines (105 loc) · 3.31 KB

File metadata and controls

135 lines (105 loc) · 3.31 KB

forge-ci-python-validate-pr

Complete PR validation pipeline for Python projects.

Usage

jobs:
  validate:
    uses: whisller/forge-ci/.github/workflows/forge-ci-python-validate-pr.yml@v1.2.0

What It Does

Runs complete validation pipeline:

  1. Dependency Manager: Install dependencies with caching
  2. Ruff: Code linting (parallel with mypy)
  3. Mypy: Type checking (parallel with ruff)
  4. Pytest: Test execution with coverage reporting
  5. SBOM: Software Bill of Materials (optional, for compliance)

Inputs

Input Type Default Description
python-version string '3.12' Python version to use
working-directory string '.' Working directory
dependency-manager string 'poetry' Dependency manager (poetry, uv, venv)
poetry-version string '2.2.0' Poetry version (if using poetry)
run-ruff boolean true Enable ruff linting
run-mypy boolean true Enable mypy type checking
run-pytest boolean true Enable pytest execution
run-pytest-cov boolean true Enable pytest with coverage
run-sbom boolean false Enable SBOM generation

Examples

Basic Usage (all defaults)

jobs:
  validate:
    uses: whisller/forge-ci/.github/workflows/forge-ci-python-validate-pr.yml@v1.2.0

Runs: dependency install, ruff, mypy, pytest with coverage

Custom Python Version

jobs:
  validate:
    uses: whisller/forge-ci/.github/workflows/forge-ci-python-validate-pr.yml@v1.2.0
    with:
      python-version: '3.11'

Use uv Instead of Poetry

jobs:
  validate:
    uses: whisller/forge-ci/.github/workflows/forge-ci-python-validate-pr.yml@v1.2.0
    with:
      dependency-manager: 'uv'

Skip Type Checking

jobs:
  validate:
    uses: whisller/forge-ci/.github/workflows/forge-ci-python-validate-pr.yml@v1.2.0
    with:
      run-mypy: false

Enable SBOM for Compliance

jobs:
  validate:
    uses: whisller/forge-ci/.github/workflows/forge-ci-python-validate-pr.yml@v1.2.0
    with:
      run-sbom: true

Useful for Digital Healthcare and regulated industries.

Monorepo

jobs:
  api:
    uses: whisller/forge-ci/.github/workflows/forge-ci-python-validate-pr.yml@v1.2.0
    with:
      working-directory: './services/api'

  worker:
    uses: whisller/forge-ci/.github/workflows/forge-ci-python-validate-pr.yml@v1.2.0
    with:
      working-directory: './services/worker'

Matrix Builds

jobs:
  validate:
    strategy:
      matrix:
        python-version: ['3.10', '3.11', '3.12']
    uses: whisller/forge-ci/.github/workflows/forge-ci-python-validate-pr.yml@v1.2.0
    with:
      python-version: ${{ matrix.python-version }}

Workflow Order

dependency-manager → ruff/mypy (parallel) → pytest → sbom (if enabled)
  • Ruff and mypy run in parallel after dependencies are installed
  • Pytest runs after both linting and type checking complete
  • SBOM runs last (only if enabled)

See Also

For custom composition, use individual workflows: