Skip to Content

What should a Python FastAPI GitHub Actions pipeline enforce?

Category: DevOps & Deployment

Answer

Lint + type + test + (optionally) seed + build-and-push image. The matrix runs per Python version. The pipeline is a contract: no green pipeline, no merge.

Concrete examples from the fca project context

Example 1

Job 1: ruff + black —check + mypy.

Example 2

Job 2: pytest with —cov-fail-under=80.

Example 3

Job 3: docker build, push to ghcr.io, sign with cosign.

Example 4

Job 4: alembic upgrade head against a temporary Postgres.

Data flow / flow chart

PR -> lint+type+test -> main -> build image -> push to GHCR -> deploy K8s
  Each step gates the next

Takeaway

Pipeline is the audit log. If a step skipped, the PR is suspect.