name: CI on: push: branches: [main] pull_request: workflow_call: concurrency: group: ${{ github.event_name == 'pull_request' && format('ci-pr-{0}', github.event.pull_request.number) || format('ci-{0}-{1}', github.event_name, github.run_id) }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: contents: read jobs: tsc: name: TypeScript Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Install pnpm uses: pnpm/action-setup@v5 - name: Set up Node uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: TypeScript project reference check run: pnpm run tsc ts-test-common: name: TypeScript Test Common runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: # The automatic-recall baseline test archives a pinned historical main commit, # and PR test selection diffs against the base commit. fetch-depth: 0 - name: Install pnpm uses: pnpm/action-setup@v5 - name: Set up Node uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Copy viewer static assets run: | mkdir -p packages/viewer-server/static cp packages/ui/static/index.html packages/ui/static/favicon.svg packages/viewer-server/static/ - name: Build run: pnpm run build - name: Affected PR tests if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:full') env: CI_TEST_BASE: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:full') && github.event.pull_request.base.sha || '' }} run: node scripts/ci-changed-tests.mjs test:release test:adapter-normalizers test:ci-workflow test:semantic-installed test:ci - name: Full auxiliary tests and isolated owner proof if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:full') run: pnpm run test:release && pnpm run test:adapter-normalizers && pnpm run test:ci-workflow && pnpm run test:semantic-installed && pnpm run test:ci:isolated ts-test-shards: name: TypeScript Test Shard ${{ matrix.shard }}/2 if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:full') runs-on: ubuntu-latest strategy: fail-fast: false matrix: shard: [1, 2] steps: - uses: actions/checkout@v6 with: # The automatic-recall baseline test archives a pinned historical main commit. fetch-depth: 0 - name: Install pnpm uses: pnpm/action-setup@v5 - name: Set up Node uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Copy viewer static assets run: | mkdir -p packages/viewer-server/static cp packages/ui/static/index.html packages/ui/static/favicon.svg packages/viewer-server/static/ - name: Build run: pnpm run build - name: Test shard run: pnpm run test:ci:parallel --shard=${{ matrix.shard }}/2 ts-test: name: TypeScript Test needs: [ts-test-common, ts-test-shards] if: always() runs-on: ubuntu-latest steps: - name: Require expected test jobs env: FULL_RUN: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:full') }} COMMON_RESULT: ${{ needs.ts-test-common.result }} SHARDS_RESULT: ${{ needs.ts-test-shards.result }} run: | node --input-type=module <<'NODE' const { FULL_RUN, COMMON_RESULT, SHARDS_RESULT } = process.env; const expectedShards = FULL_RUN === 'true' ? 'success' : 'skipped'; if (!['true', 'false'].includes(FULL_RUN) || COMMON_RESULT !== 'success' || SHARDS_RESULT !== expectedShards) { console.error(`TypeScript Test failed: common=${COMMON_RESULT || 'missing'}, shards=${SHARDS_RESULT || 'missing'}, full=${FULL_RUN || 'missing'}. Expected common=success and shards=${expectedShards}.`); process.exitCode = 1; } NODE account-browser: name: Account Browser Acceptance runs-on: ubuntu-latest timeout-minutes: 15 steps: - uses: actions/checkout@v6 - name: Install pnpm uses: pnpm/action-setup@v5 - name: Set up Node uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Install Chromium run: pnpm --filter @codemem/ui exec playwright install --with-deps chromium - name: Build run: pnpm run build - name: Run synthetic account browser acceptance run: pnpm --filter @codemem/ui test:account-browser worker-test: name: Cloudflare Worker Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: # PR test selection diffs against the base commit. fetch-depth: 0 - name: Install pnpm uses: pnpm/action-setup@v5 - name: Set up Node uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Worker integration test working-directory: packages/cloudflare-coordinator-worker env: CI_TEST_BASE: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:full') && github.event.pull_request.base.sha || '' }} # Attribute cold enrollment delays in the two synthetic receipt cases. CODEMEM_WORKER_D1_PROFILE: '1' run: node ../../scripts/ci-changed-tests.mjs test:worker d1-statement-check: name: D1 Statement Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: # PR scoping diffs against the base commit. fetch-depth: 0 # Coordinator SQL lives in core and the Worker package. Pull requests that change neither # skip the check; main and ci:full always run it. - name: Check whether coordinator SQL can have changed id: scope env: BASE: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:full') && github.event.pull_request.base.sha || '' }} run: | if [ -z "$BASE" ] || git diff --name-only "$BASE" HEAD | grep -qE '^(packages/core/|packages/cloudflare-coordinator-worker/|pnpm-lock\.yaml$|pnpm-workspace\.yaml$)'; then echo "run=true" >> "$GITHUB_OUTPUT" else echo "run=false" >> "$GITHUB_OUTPUT" fi - name: Install pnpm if: steps.scope.outputs.run == 'true' uses: pnpm/action-setup@v5 - name: Set up Node if: steps.scope.outputs.run == 'true' uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install dependencies if: steps.scope.outputs.run == 'true' run: pnpm install --frozen-lockfile # Runs beside the Worker job, because capturing statements reruns the core coordinator tests. - name: Compile coordinator statements on production D1's SQLite if: steps.scope.outputs.run == 'true' run: pnpm --filter @codemem/cloudflare-coordinator-worker check:d1-statements ts-lint: name: TypeScript Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: # The delta ratchet compares the immutable target and source commits, including stacked PR bases. fetch-depth: 0 - name: Install pnpm uses: pnpm/action-setup@v5 - name: Set up Node uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Biome delta ratchet if: github.event_name == 'pull_request' env: BASE_SHA: ${{ github.event.pull_request.base.sha }} MERGE_SHA: ${{ github.sha }} run: | mkdir -p .tmp/biome-delta pnpm --silent lint:delta -- --base "$BASE_SHA" --head "$MERGE_SHA" --json --github-annotations > .tmp/biome-delta/report.json - name: Biome check run: pnpm run lint - name: Upload Biome delta report if: always() && github.event_name == 'pull_request' uses: actions/upload-artifact@v6 with: name: biome-delta-${{ github.event.pull_request.base.sha }}-${{ github.sha }} path: .tmp/biome-delta/report.json if-no-files-found: error retention-days: 7 plugin-smoke: name: Plugin Smoke Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Install pnpm uses: pnpm/action-setup@v5 - name: Set up Node uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install workspace dependencies run: pnpm install --frozen-lockfile - name: Install minimum supported OpenCode 1 plugin runtime run: | npm install --prefix packages/cli/.opencode --no-save @opencode-ai/plugin@1.18.29 npm install --prefix packages/opencode-plugin/.opencode --no-save @opencode-ai/plugin@1.18.29 - name: Run plugin unit tests run: pnpm --filter codemem test:plugin && pnpm --filter @codemem/opencode-plugin test && pnpm --filter codemem test:smoke packaged-plugin-smoke: name: Packaged Plugin Smoke Test runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 - name: Install pnpm uses: pnpm/action-setup@v5 - name: Set up Node uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install workspace dependencies run: pnpm install --frozen-lockfile - name: Copy viewer static assets run: | mkdir -p packages/viewer-server/static cp packages/ui/static/index.html packages/ui/static/favicon.svg packages/viewer-server/static/ - name: Build run: pnpm run build - name: Run packed artifact smoke test run: | pnpm --filter @codemem/opencode-plugin test:packed-artifact:prepared pnpm --filter @codemem/opencode-plugin test:opencode-v2-contract pnpm --filter codemem test:packed-artifact windows-embedding-runtime-smoke: name: Windows Embedding Runtime Smoke Test if: github.event_name != 'pull_request' runs-on: windows-latest timeout-minutes: 20 steps: - uses: actions/checkout@v6 - name: Install pnpm uses: pnpm/action-setup@v5 - name: Set up Node uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install workspace dependencies run: pnpm install --frozen-lockfile - name: Build embedding runtime run: pnpm --filter @codemem/embeddings build - name: Run packed Windows x64 inference probe run: pnpm --filter @codemem/embeddings test:packed-runtime env: CODEMEM_EXPECT_WINDOWS_X64: "1" e2e-smoke: name: E2E Smoke runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Install pnpm uses: pnpm/action-setup@v5 - name: Set up Node uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Run E2E Smoke scenario env: CODEMEM_E2E_BUILD: "1" CODEMEM_E2E_ARTIFACTS_DIR: .tmp/e2e-artifacts CODEMEM_E2E_JSON: "1" run: pnpm run e2e:smoke -- --json - name: Upload E2E artifacts on failure if: failure() uses: actions/upload-artifact@v4 with: name: e2e-smoke-artifacts path: .tmp/e2e-artifacts if-no-files-found: ignore e2e-specialized: name: E2E ${{ matrix.name }} if: github.event_name != 'pull_request' runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - name: Legacy Team Migration script: e2e:legacy-team-migration artifact: legacy-team-migration - name: Project Sharing script: e2e:project-sharing artifact: project-sharing - name: Sharing Domains script: e2e:sharing-domains artifact: sharing-domains steps: - uses: actions/checkout@v6 - name: Install pnpm uses: pnpm/action-setup@v5 - name: Set up Node uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Run E2E ${{ matrix.name }} scenario env: CODEMEM_E2E_BUILD: "1" CODEMEM_E2E_ARTIFACTS_DIR: .tmp/e2e-artifacts CODEMEM_E2E_JSON: "1" run: pnpm run ${{ matrix.script }} -- --json - name: Upload E2E artifacts on failure if: failure() uses: actions/upload-artifact@v4 with: name: e2e-${{ matrix.artifact }}-artifacts path: .tmp/e2e-artifacts if-no-files-found: ignore