|
| 1 | +name: CI |
| 2 | + |
| 3 | +# Action SHAs are pinned, not floating tags. To bump: |
| 4 | +# gh api repos/<owner>/<repo>/git/refs/tags/<tag> --jq .object.sha |
| 5 | +# and update the comment on the right with the new tag. |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: [develop, main] |
| 10 | + pull_request: |
| 11 | + branches: [develop, main] |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint: |
| 15 | + name: Lint & Format |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 19 | + - uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 |
| 20 | + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 |
| 21 | + with: |
| 22 | + python-version: "3.14" |
| 23 | + - run: uv sync --frozen --extra dev |
| 24 | + - run: uv run ruff check . |
| 25 | + - run: uv run ruff format --check . |
| 26 | + |
| 27 | + typecheck: |
| 28 | + name: Type Check |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 32 | + - uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 |
| 33 | + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 |
| 34 | + with: |
| 35 | + python-version: "3.14" |
| 36 | + - run: uv sync --frozen --extra dev |
| 37 | + - run: uv run mypy --strict src/ tests/ |
| 38 | + |
| 39 | + test-unit: |
| 40 | + name: Unit tests |
| 41 | + runs-on: ubuntu-latest |
| 42 | + # Pure in-process tests — Pydantic models, observability config, mocked |
| 43 | + # FastAPI endpoints. Completes fast so PR authors get quick feedback. |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 46 | + - uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 |
| 47 | + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 |
| 48 | + with: |
| 49 | + python-version: "3.14" |
| 50 | + - run: uv sync --frozen --extra dev |
| 51 | + - run: uv run pytest tests/ -v -m "not integration" |
| 52 | + |
| 53 | + test-integration: |
| 54 | + name: Integration tests |
| 55 | + runs-on: ubuntu-latest |
| 56 | + # Tests that touch real external systems (DBs, queues, etc.). The template |
| 57 | + # ships none, so this job runs the integration-marked subset and exits 0 |
| 58 | + # when no tests collect. |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 61 | + - uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 |
| 62 | + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 |
| 63 | + with: |
| 64 | + python-version: "3.14" |
| 65 | + - run: uv sync --frozen --extra dev |
| 66 | + - run: uv run pytest tests/ -v -m integration --no-header |
| 67 | + # `pytest` exits 5 when no tests are collected — treat that as success |
| 68 | + # while the template has no integration suite. |
| 69 | + continue-on-error: false |
| 70 | + shell: bash |
| 71 | + |
| 72 | + coverage: |
| 73 | + name: Coverage |
| 74 | + runs-on: ubuntu-latest |
| 75 | + # Runs the full suite with coverage. Until ticket #17 lands real source |
| 76 | + # under src/, the template has no measurable coverage; pyproject.toml's |
| 77 | + # [tool.coverage.report].fail_under stays at 75 (the eventual target), |
| 78 | + # while CI uses --cov-fail-under=0 so the empty scaffold doesn't fail. |
| 79 | + # When #17 + #18 ship real source + tests, drop the override here. |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 82 | + - uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 |
| 83 | + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 |
| 84 | + with: |
| 85 | + python-version: "3.14" |
| 86 | + - run: uv sync --frozen --extra dev |
| 87 | + - run: uv run pytest tests/ --cov=src --cov-report=term-missing --cov-fail-under=0 |
| 88 | + |
| 89 | + architecture: |
| 90 | + name: Architecture (import-linter) |
| 91 | + runs-on: ubuntu-latest |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 94 | + - uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 |
| 95 | + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 |
| 96 | + with: |
| 97 | + python-version: "3.14" |
| 98 | + - run: uv sync --frozen --extra dev |
| 99 | + - run: uv run lint-imports |
| 100 | + |
| 101 | + pre-commit: |
| 102 | + name: Pre-commit |
| 103 | + runs-on: ubuntu-latest |
| 104 | + # Runs every hook against all files — ensures a developer who forgot |
| 105 | + # `uv run pre-commit install` can't leak unformatted code or a stray |
| 106 | + # secret past the first defence layer. |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 109 | + - uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 |
| 110 | + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 |
| 111 | + with: |
| 112 | + python-version: "3.14" |
| 113 | + - run: uv sync --frozen --extra dev |
| 114 | + - run: uv run pre-commit run --all-files --show-diff-on-failure |
| 115 | + |
| 116 | + frontend-build: |
| 117 | + name: Frontend Build |
| 118 | + runs-on: ubuntu-latest |
| 119 | + # Skips cleanly until ticket #21 lands frontend/package.json. |
| 120 | + if: hashFiles('frontend/package.json') != '' |
| 121 | + steps: |
| 122 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 123 | + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
| 124 | + with: |
| 125 | + node-version: "24" |
| 126 | + cache: npm |
| 127 | + cache-dependency-path: frontend/package-lock.json |
| 128 | + - run: cd frontend && npm ci && npm run build |
| 129 | + |
| 130 | + frontend-quality: |
| 131 | + name: Frontend Quality |
| 132 | + runs-on: ubuntu-latest |
| 133 | + # Lint + format + tsc + vitest. Mirrors the strict posture the backend |
| 134 | + # enjoys (ruff + mypy + pytest); the Frontend Build job above validates |
| 135 | + # the bundler output, this one validates source quality. |
| 136 | + if: hashFiles('frontend/package.json') != '' |
| 137 | + defaults: |
| 138 | + run: |
| 139 | + working-directory: frontend |
| 140 | + steps: |
| 141 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 142 | + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
| 143 | + with: |
| 144 | + node-version: "24" |
| 145 | + cache: npm |
| 146 | + cache-dependency-path: frontend/package-lock.json |
| 147 | + - run: npm ci |
| 148 | + - run: npm run lint |
| 149 | + - run: npm run format:check |
| 150 | + - run: npm run check |
| 151 | + - run: npm run test |
0 commit comments