feat(scripts): one Sieve generator, and the preview now comes from it #122
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| # Deliberately NO `branches` filter. This was `branches: [main]`, which | |
| # matched only PRs based on main — so a STACKED pull request, the way this | |
| # repo lands dependent work, ran none of the jobs below. Its checks then | |
| # read as green because they never ran, which looks exactly like green | |
| # because they passed (areyousievious-8su; observed on PR #54). | |
| # | |
| # Not double work: a pull_request run tests the MERGE of head into base, so | |
| # the stacked PR tests itself against its parent and the parent later tests | |
| # itself against main. Different trees. | |
| pull_request: | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| backend: | |
| name: backend (pytest + ruff) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| backend/requirements.txt | |
| backend/requirements-dev.txt | |
| - name: Install backend dependencies | |
| run: pip install -r backend/requirements.txt -r backend/requirements-dev.txt | |
| - name: Ruff check | |
| run: ruff check backend/ | |
| - name: Ruff format check | |
| run: ruff format --check backend/ | |
| - name: Pytest | |
| working-directory: backend | |
| run: python -m pytest tests/ -v --tb=short | |
| frontend: | |
| name: frontend (vitest + vite build) | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| - name: Vitest | |
| run: npm test | |
| - name: Type check | |
| run: npm run check | |
| - name: Vite build | |
| run: npm run build | |
| contract: | |
| name: contract (generated wire types are current) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| cache-dependency-path: backend/requirements.txt | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: | | |
| pip install -r backend/requirements.txt | |
| cd frontend && npm ci | |
| # The SPA and the DTOs are two encodings of one wire format. Regenerating | |
| # here means a backend schema change that hasn't been reflected in the | |
| # committed artifacts fails CI instead of reaching a client at runtime — | |
| # which is how `additionalProperties: false` shipped a two-month 422. | |
| - name: Regenerate wire types | |
| working-directory: frontend | |
| run: npm run gen:types | |
| - name: Fail if generated artifacts are stale | |
| run: | | |
| if ! git diff --exit-code -- frontend/src/lib/openapi.json frontend/src/lib/api-types.d.ts; then | |
| echo "::error::Generated wire types are out of date. Run 'npm run gen:types' in frontend/ and commit the result." | |
| exit 1 | |
| fi |