name: CI on: pull_request: push: branches: - main merge_group: types: - checks_requested workflow_dispatch: permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: api: name: API contracts runs-on: ubuntu-24.04 timeout-minutes: 30 steps: - name: Check out source uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: fetch-depth: 0 persist-credentials: false - name: Set up Node.js uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: frontend/.node-version cache: npm cache-dependency-path: api/package-lock.json - name: Set up Go uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: backend/go.mod cache: true cache-dependency-path: backend/go.sum - name: Set up Python uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: python-version-file: ml/.python-version cache: pip cache-dependency-path: scripts/requirements-codegen.txt # make -C api verify runs check-toolchain, which generates the OpenAPI 3.2 # fixture with ogen, Orval, and datamodel-code-generator, so the job also # needs the frontend and ML toolchains. - name: Install declared pnpm run: npm install --global "$(node -p "require('./frontend/package.json').packageManager")" - name: Cache pnpm store uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: ~/.local/share/pnpm/store key: ${{ runner.os }}-pnpm-${{ hashFiles('frontend/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- - name: Set up uv uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: version: 0.12.22 enable-cache: true cache-dependency-glob: ml/uv.lock - name: Install API tooling run: make -C api install - name: Install frontend dependencies run: make -C frontend install - name: Install ML dependencies run: make -C ml install - name: Check API formatting and compatibility run: make -C api fmt-check verify - name: Check compatibility with the pull request base if: github.event_name == 'pull_request' env: API_BASE_REF: ${{ github.event.pull_request.base.sha }} run: make -C api check-compat backend: name: Go backend runs-on: ubuntu-24.04 timeout-minutes: 30 steps: - name: Check out source uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: persist-credentials: false - name: Set up Go uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: backend/go.mod cache: true cache-dependency-path: backend/go.sum - name: Install Go tools run: make -C backend deps - name: Check backend run: make -C backend check - name: Run backend race tests run: make -C backend test-race integration: name: Integration tests (${{ matrix.shard }}/${{ strategy.job-total }}) runs-on: ubuntu-24.04 timeout-minutes: 30 strategy: fail-fast: false matrix: shard: [1, 2] steps: - name: Check out source uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: persist-credentials: false - name: Set up Go uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: backend/go.mod cache: true cache-dependency-path: backend/go.sum - name: Install Go dependencies run: make -C backend deps # The shard total comes from the matrix size, so adding a shard cannot # leave TEST_SHARD_TOTAL stale; an index outside the total fails the run. - name: Run PostgreSQL, Redis, SeaweedFS, and Kafka integration shard env: TEST_SHARD_INDEX: ${{ matrix.shard }} TEST_SHARD_TOTAL: ${{ strategy.job-total }} GOFLAGS: -race run: make -C backend test-int frontend: name: Frontend runs-on: ubuntu-24.04 timeout-minutes: 30 steps: - name: Check out source uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: persist-credentials: false - name: Set up Node.js uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: frontend/.node-version - name: Install declared pnpm run: npm install --global "$(node -p "require('./frontend/package.json').packageManager")" - name: Cache pnpm store uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: ~/.local/share/pnpm/store key: ${{ runner.os }}-pnpm-${{ hashFiles('frontend/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- - name: Install frontend dependencies run: make -C frontend install - name: Check frontend run: make -C frontend check ml: name: ML service runs-on: ubuntu-24.04 timeout-minutes: 30 steps: - name: Check out source uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: persist-credentials: false - name: Set up Python uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: python-version-file: ml/.python-version - name: Set up uv uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: version: 0.12.22 enable-cache: true cache-dependency-glob: ml/uv.lock - name: Install ML dependencies run: make -C ml install - name: Check ML service and contract run: make -C ml verify codegen: name: Generation and drift runs-on: ubuntu-24.04 timeout-minutes: 45 steps: - name: Check out source uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: persist-credentials: false - name: Set up Go uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: backend/go.mod cache: true cache-dependency-path: backend/go.sum - name: Set up Node.js uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: frontend/.node-version cache: npm cache-dependency-path: api/package-lock.json - name: Install declared pnpm run: npm install --global "$(node -p "require('./frontend/package.json').packageManager")" - name: Set up Python uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: python-version-file: ml/.python-version cache: pip cache-dependency-path: scripts/requirements-codegen.txt - name: Set up uv uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: version: 0.12.22 enable-cache: true cache-dependency-glob: ml/uv.lock - name: Install project dependencies run: make install - name: Regenerate and check drift run: make generate check-generated infrastructure: name: Infrastructure configuration runs-on: ubuntu-24.04 timeout-minutes: 25 steps: - name: Check out source uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: persist-credentials: false - name: Check Compose files run: make -C deploy check - name: Test the public Nginx perimeter on throwaway containers run: make -C deploy perimeter-test - name: Check observability files run: make -C observability check - name: Build the separate ML image run: make -C deploy ml-build security: name: Source security checks runs-on: ubuntu-24.04 timeout-minutes: 30 steps: - name: Check out source and history uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: fetch-depth: 0 persist-credentials: false - name: Set up Go uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: backend/go.mod cache: true cache-dependency-path: backend/go.sum - name: Set up Python uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: python-version-file: ml/.python-version - name: Set up uv uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: version: 0.12.22 enable-cache: false - name: Install security tools run: make -C security install - name: Check scanner rules and source run: make -C security test check - name: Upload security reports if: ${{ !cancelled() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: security-source-reports path: security/reports/ if-no-files-found: warn retention-days: 14 security-images: name: Container security checks runs-on: ubuntu-24.04 timeout-minutes: 45 steps: - name: Check out source uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: persist-credentials: false - name: Set up Python uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: python-version-file: ml/.python-version - name: Install Trivy run: make -C security install-trivy - name: Build and scan service images run: make -C security images - name: Upload container security reports if: ${{ !cancelled() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: security-image-reports path: security/reports/ if-no-files-found: warn retention-days: 14 smoke: name: Isolated technical smoke needs: - backend - integration - frontend - infrastructure runs-on: ubuntu-24.04 timeout-minutes: 35 steps: - name: Check out source uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: persist-credentials: false - name: Build and check technical health routes run: make -C deploy smoke e2e: name: Browser E2E needs: - backend - frontend - infrastructure runs-on: ubuntu-24.04 timeout-minutes: 45 steps: - name: Check out source uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: persist-credentials: false - name: Set up Node.js uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: frontend/.node-version - name: Install declared pnpm run: npm install --global "$(node -p "require('./frontend/package.json').packageManager")" - name: Cache pnpm store uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: ~/.local/share/pnpm/store key: ${{ runner.os }}-pnpm-${{ hashFiles('frontend/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- # The runner mounts the installed @playwright/test into the browser image. - name: Install frontend dependencies run: make -C frontend install # deploy/scripts/e2e.sh generates its own throwaway env file with random # secrets outside the workspace and starts a fresh, uniquely named stand, # so the job needs no repository secrets and no root .env. - name: Run the Playwright suite on an isolated stand run: make -C deploy test-e2e # Only the Playwright report, failed-test traces and screenshots, and the # stand logs are uploaded; the generated env file never enters this tree. - name: Upload E2E diagnostics if: ${{ failure() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: e2e-diagnostics-attempt-${{ github.run_attempt }} path: | frontend/test-results/e2e/report/ frontend/test-results/e2e/results/ frontend/test-results/e2e/stand.log if-no-files-found: warn include-hidden-files: false retention-days: 14 aggregate: name: Required CI result if: always() needs: - api - backend - integration - frontend - ml - codegen - infrastructure - smoke - e2e - security - security-images runs-on: ubuntu-24.04 timeout-minutes: 5 steps: # Every job in needs must report success. failure, cancelled, and # skipped (for example after a failed dependency) all fail this result, # and a job added to needs is checked without a separate line here. - name: Require every CI job to pass env: NEEDS_JSON: ${{ toJSON(needs) }} run: | set -euo pipefail jq -r 'to_entries[] | "\(.key)=\(.value.result)"' <<<"$NEEDS_JSON" test "$(jq 'length' <<<"$NEEDS_JSON")" -gt 0 failed=$(jq -r '[to_entries[] | select(.value.result != "success") | .key] | join(" ")' <<<"$NEEDS_JSON") if [ -n "$failed" ]; then printf 'Required jobs did not succeed: %s\n' "$failed" >&2 exit 1 fi