name: Consumer CI # Reusable CI for generated child repos — never runs in this repo. # The caller owns triggers, permissions policy, and secrets. This workflow # only assumes a directory (`working_directory`) from which the child repo's # standard scripts are valid: pnpm install, pnpm audit, biome, typecheck, test. on: workflow_call: inputs: working_directory: description: "Directory exposing the repo's standard scripts (default: repo root)" required: false type: string default: . outputs: lint-result: description: 'Result of the lint job' value: ${{ jobs.lint.outputs.result }} typecheck-result: description: 'Result of the typecheck job' value: ${{ jobs.typecheck.outputs.result }} test-result: description: 'Result of the test job' value: ${{ jobs.test.outputs.result }} permissions: contents: read jobs: lint: name: Lint runs-on: ubuntu-24.04 timeout-minutes: 15 outputs: result: ${{ steps.set-result.outputs.result }} defaults: run: working-directory: ${{ inputs.working_directory }} shell: bash steps: - name: Checkout repository uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 (Node 24) - name: Guard — no stray bun artifacts run: | if [ -f bun.lock ]; then echo "::error::bun.lock present — bun re-migrated the workspace (ADR 0026). Delete bun.lock and re-run pnpm install." exit 1 fi - name: Setup pnpm uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - name: Setup Node uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: "24" - name: Get pnpm store dir id: pnpm-cache shell: bash run: echo "STORE_PATH=$(pnpm store path)" >> "$GITHUB_OUTPUT" - name: Cache pnpm store uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 (Node 24) with: path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- - name: Install dependencies run: pnpm install --frozen-lockfile --ignore-scripts - name: Security audit id: audit timeout-minutes: 5 env: AUDIT_STRICT: ${{ secrets.AUDIT_STRICT }} run: | set +e audit_json="$RUNNER_TEMP/audit-output.json" timeout 240 pnpm audit --json > "$audit_json" 2>"$RUNNER_TEMP/audit-stderr.txt" audit_exit=$? if [ "$audit_exit" -eq 124 ]; then echo "::warning::pnpm audit timed out after 240s — the vulnerability check DID NOT RUN" echo "- Security audit: **SKIPPED** (pnpm audit timed out after 240s)" >> "$GITHUB_STEP_SUMMARY" exit 0 fi if [ "$audit_exit" -gt 1 ]; then echo "::warning::pnpm audit exited with code $audit_exit — the vulnerability check DID NOT RUN" echo "- Security audit: **SKIPPED** (audit exited with $audit_exit)" >> "$GITHUB_STEP_SUMMARY" exit 0 fi audit_status=0 node .github/scripts/audit-summary.mjs "$audit_json" || audit_status=$? if [ "$audit_status" = "10" ]; then if [ "$AUDIT_STRICT" = "true" ]; then echo "::error::pnpm audit found critical or high vulnerabilities — failing the audit (AUDIT_STRICT=true)" exit 1 fi echo "::warning::pnpm audit found critical or high vulnerabilities — set AUDIT_STRICT=true to fail on these" elif [ "$audit_status" = "3" ]; then echo "- Security audit: **SKIPPED** (audit output unreadable)" >> "$GITHUB_STEP_SUMMARY" fi - name: Run Biome lint and format check id: lint run: pnpm exec biome ci . - name: Set job result id: set-result if: always() run: echo "result=${{ job.status }}" >> "$GITHUB_OUTPUT" typecheck: name: Typecheck runs-on: ubuntu-24.04 timeout-minutes: 15 outputs: result: ${{ steps.set-result.outputs.result }} defaults: run: working-directory: ${{ inputs.working_directory }} shell: bash steps: - name: Checkout repository uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 (Node 24) - name: Guard — no stray bun artifacts run: | if [ -f bun.lock ]; then echo "::error::bun.lock present — bun re-migrated the workspace (ADR 0026). Delete bun.lock and re-run pnpm install." exit 1 fi - name: Setup pnpm uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - name: Setup Node uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: "24" - name: Get pnpm store dir id: pnpm-cache shell: bash run: echo "STORE_PATH=$(pnpm store path)" >> "$GITHUB_OUTPUT" - name: Cache pnpm store uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 (Node 24) with: path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- - name: Install dependencies run: pnpm install --frozen-lockfile --ignore-scripts - name: Restore generated types cache id: types-cache uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 (Node 24) with: path: | .bos/generated **/*.gen.ts key: ${{ runner.os }}-types-${{ hashFiles('bos.app.ts') }} restore-keys: | ${{ runner.os }}-types- - name: Run typecheck id: typecheck run: pnpm run typecheck - name: Save generated types cache if: steps.types-cache.outputs.cache-hit != 'true' uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 (Node 24) with: path: | .bos/generated **/*.gen.ts key: ${{ runner.os }}-types-${{ hashFiles('bos.app.ts') }} - name: Set job result id: set-result if: always() run: echo "result=${{ job.status }}" >> "$GITHUB_OUTPUT" test: name: Test runs-on: ubuntu-24.04 timeout-minutes: 15 outputs: result: ${{ steps.set-result.outputs.result }} defaults: run: working-directory: ${{ inputs.working_directory }} shell: bash steps: - name: Checkout repository uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 (Node 24) - name: Guard — no stray bun artifacts run: | if [ -f bun.lock ]; then echo "::error::bun.lock present — bun re-migrated the workspace (ADR 0026). Delete bun.lock and re-run pnpm install." exit 1 fi - name: Setup pnpm uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - name: Setup Node uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: "24" - name: Get pnpm store dir id: pnpm-cache shell: bash run: echo "STORE_PATH=$(pnpm store path)" >> "$GITHUB_OUTPUT" - name: Cache pnpm store uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 (Node 24) with: path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- - name: Install dependencies run: pnpm install --frozen-lockfile --ignore-scripts - name: Run tests id: test run: pnpm run test - name: Set job result id: set-result if: always() run: echo "result=${{ job.status }}" >> "$GITHUB_OUTPUT"