From ea9a296e6ba8bc63065c1430464ade6ddc6be6e0 Mon Sep 17 00:00:00 2001 From: mvm Date: Fri, 20 Mar 2026 13:02:47 -0500 Subject: [PATCH 1/6] organize build into pre-build, build, and post-build --- .github/workflows/ci.yml | 111 ++++++++++++++---------- bin/post-pr-ci-failure-comment/index.ts | 5 +- 2 files changed, 69 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82e4a6aaf82eb4d..e654219582eaf73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,11 +89,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npx tsx bin/post-pr-ci-failure-comment/index.ts - build: - name: Build + pre-build: + name: Pre Build runs-on: ubuntu-latest - outputs: - link_check_failed: ${{ steps.check_link_result.outputs.failed }} permissions: contents: read pull-requests: write @@ -114,7 +112,8 @@ jobs: exit 1 fi - - run: | + - name: Check for invalid file extensions + run: | FILES=$( find src/content \ -type f \ @@ -147,12 +146,6 @@ jobs: run: npm ci if: steps.node-modules-cache.outputs.cache-hit != 'true' - - uses: actions/cache/restore@v5 - with: - path: | - node_modules/.astro/assets - key: static - - run: npx tsx bin/post-codeowners-comment/index.ts continue-on-error: true env: @@ -160,10 +153,67 @@ jobs: - run: npm run check + - run: npm run check:worker + + - uses: reviewdog/action-eslint@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: github-pr-review + fail_level: error + filter_mode: nofilter + + - run: npm run format:core:check + + - name: Validate redirects + run: npx tsm bin/validate-redirects.ts + + - name: Tests + run: npm run test + + build: + name: Build + needs: pre-build + runs-on: ubuntu-latest + outputs: + link_check_failed: ${{ steps.check_link_result.outputs.failed }} + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 1 + + - uses: actions/setup-node@v6 + with: + node-version: 22.x + cache: npm + + - name: Cache node_modules + id: node-modules-cache + uses: actions/cache@v5 + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + + - name: Run sync (if cache hit) + run: npm run sync + if: steps.node-modules-cache.outputs.cache-hit == 'true' + + - name: Node install (cache miss) + run: npm ci + if: steps.node-modules-cache.outputs.cache-hit != 'true' + + - uses: actions/cache/restore@v5 + with: + path: | + node_modules/.astro/assets + key: static + # The starlight-links-validator plugin runs in astro:build:done, which fires # AFTER all pages have been written to dist/. If link validation fails, the # build exits non-zero but dist/ is complete. We use continue-on-error so the - # job succeeds (allowing deploy + validate to run), then check the outcome below. + # job succeeds (allowing deploy + post-build to run), then check the outcome below. - run: npm run build id: build_step name: Build @@ -199,45 +249,14 @@ jobs: name: dist path: dist - validate: - name: Validate + post-build: + name: Post Build needs: build runs-on: ubuntu-latest permissions: contents: read pull-requests: write steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 1 - - - uses: actions/setup-node@v6 - with: - node-version: 22.x - cache: npm - - - run: npm ci - - - uses: actions/download-artifact@v8 - with: - name: dist - path: dist - - - uses: reviewdog/action-eslint@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - reporter: github-pr-review - fail_level: error - filter_mode: nofilter - - - run: npm run format:core:check - - - name: Validate redirects - run: npx tsm bin/validate-redirects.ts - - - name: Tests - run: npm run test - - name: Link validation if: needs.build.outputs.link_check_failed == 'true' run: | @@ -246,7 +265,7 @@ jobs: notify: name: Notify - needs: [build, validate] + needs: [pre-build, build, post-build] if: always() runs-on: ubuntu-latest permissions: diff --git a/bin/post-pr-ci-failure-comment/index.ts b/bin/post-pr-ci-failure-comment/index.ts index 3f168bde4a03638..c24a25dc9210401 100644 --- a/bin/post-pr-ci-failure-comment/index.ts +++ b/bin/post-pr-ci-failure-comment/index.ts @@ -25,7 +25,10 @@ async function run(): Promise { }); const ciJobs = run.jobs.filter( - (job) => job.name === "Build" || job.name === "Validate", + (job) => + job.name === "Pre Build" || + job.name === "Build" || + job.name === "Post Build", ); if (ciJobs.length === 0) { From 6d187d00031e343c3686d20e7b073665c1130580 Mon Sep 17 00:00:00 2001 From: mvm Date: Fri, 20 Mar 2026 13:13:26 -0500 Subject: [PATCH 2/6] split tests into pre and post build compatible scripts --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++- bin/post-pr-ci-failure-comment/index.ts | 2 +- package.json | 2 ++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e654219582eaf73..e86bcdb31bd69f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,7 +168,7 @@ jobs: run: npx tsm bin/validate-redirects.ts - name: Tests - run: npm run test + run: npm run test:prebuild build: name: Build @@ -257,6 +257,38 @@ jobs: contents: read pull-requests: write steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 1 + + - uses: actions/setup-node@v6 + with: + node-version: 22.x + cache: npm + + - name: Cache node_modules + id: node-modules-cache + uses: actions/cache@v5 + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + + - name: Run sync (if cache hit) + run: npm run sync + if: steps.node-modules-cache.outputs.cache-hit == 'true' + + - name: Node install (cache miss) + run: npm ci + if: steps.node-modules-cache.outputs.cache-hit != 'true' + + - uses: actions/download-artifact@v8 + with: + name: dist + path: dist + + - name: Tests (Workers) + run: npm run test:postbuild + - name: Link validation if: needs.build.outputs.link_check_failed == 'true' run: | diff --git a/bin/post-pr-ci-failure-comment/index.ts b/bin/post-pr-ci-failure-comment/index.ts index c24a25dc9210401..0afca2394e59fac 100644 --- a/bin/post-pr-ci-failure-comment/index.ts +++ b/bin/post-pr-ci-failure-comment/index.ts @@ -32,7 +32,7 @@ async function run(): Promise { ); if (ciJobs.length === 0) { - core.setFailed(`Could not find Build or Validate jobs`); + core.setFailed(`Could not find Pre Build, Build, or Post Build jobs`); process.exit(); } diff --git a/package.json b/package.json index df570841140c3b0..eb0b981129666d8 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,8 @@ "start": "npx astro dev", "sync": "npx astro sync", "test": "npx vitest", + "test:prebuild": "npx vitest --project Node --project Astro", + "test:postbuild": "npx vitest --project Workers", "lint": "npx eslint", "ai-setup:import-from-opencode": "npx rulesync import --targets opencode --features rules,commands,subagents", "ai-setup:claudecode": "npm run ai-setup:import-from-opencode && npx rulesync generate --targets claudecode --features rules,commands,subagents", From 79937ba562ccff94a72f3983a1b16079c8e002dd Mon Sep 17 00:00:00 2001 From: mvm Date: Fri, 20 Mar 2026 13:26:18 -0500 Subject: [PATCH 3/6] merge conflicts --- .github/workflows/ci.yml | 46 +++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e86bcdb31bd69f7..b183cd002447541 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -131,18 +131,14 @@ jobs: exit 1 fi - - name: Cache node_modules + - name: Restore node_modules (cache hit) id: node-modules-cache uses: actions/cache@v5 with: path: node_modules key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} - - name: Run sync (if cache hit) - run: npm run sync - if: steps.node-modules-cache.outputs.cache-hit == 'true' - - - name: Node install (cache miss) + - name: Install node_modules (cache miss) run: npm ci if: steps.node-modules-cache.outputs.cache-hit != 'true' @@ -189,18 +185,14 @@ jobs: node-version: 22.x cache: npm - - name: Cache node_modules + - name: Restore node_modules (cache hit) id: node-modules-cache uses: actions/cache@v5 with: path: node_modules key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} - - name: Run sync (if cache hit) - run: npm run sync - if: steps.node-modules-cache.outputs.cache-hit == 'true' - - - name: Node install (cache miss) + - name: Install node_modules (cache miss) run: npm ci if: steps.node-modules-cache.outputs.cache-hit != 'true' @@ -266,18 +258,14 @@ jobs: node-version: 22.x cache: npm - - name: Cache node_modules + - name: Restore node_modules (cache hit) id: node-modules-cache uses: actions/cache@v5 with: path: node_modules key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} - - name: Run sync (if cache hit) - run: npm run sync - if: steps.node-modules-cache.outputs.cache-hit == 'true' - - - name: Node install (cache miss) + - name: Install node_modules (cache miss) run: npm ci if: steps.node-modules-cache.outputs.cache-hit != 'true' @@ -313,7 +301,16 @@ jobs: node-version: 22.x cache: npm - - run: npm ci + - name: Restore node_modules (cache hit) + id: node-modules-cache + uses: actions/cache@v5 + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + + - name: Install node_modules (cache miss) + run: npm ci + if: steps.node-modules-cache.outputs.cache-hit != 'true' - name: Post PR CI failure comment continue-on-error: true @@ -339,7 +336,16 @@ jobs: node-version: 22.x cache: npm - - run: npm ci + - name: Restore node_modules (cache hit) + id: node-modules-cache + uses: actions/cache@v5 + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + + - name: Install node_modules (cache miss) + run: npm ci + if: steps.node-modules-cache.outputs.cache-hit != 'true' - uses: actions/download-artifact@v8 with: From f48a883510d785b6ae058d091cc8a80929e23c8c Mon Sep 17 00:00:00 2001 From: mvm Date: Fri, 20 Mar 2026 14:53:37 -0500 Subject: [PATCH 4/6] implement kody's suggestion --- .github/workflows/ci.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b183cd002447541..b542f22fc192287 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -196,7 +196,7 @@ jobs: run: npm ci if: steps.node-modules-cache.outputs.cache-hit != 'true' - - uses: actions/cache/restore@v5 + - uses: actions/cache@v5 with: path: | node_modules/.astro/assets @@ -230,12 +230,6 @@ jobs: echo "failed=false" >> "$GITHUB_OUTPUT" fi - - uses: actions/cache/save@v5 - with: - path: | - node_modules/.astro/assets - key: static - - uses: actions/upload-artifact@v7 with: name: dist From dc66ee10d916e8e92426a299c821970ee8a941bf Mon Sep 17 00:00:00 2001 From: vance Date: Mon, 23 Mar 2026 10:10:01 -0500 Subject: [PATCH 5/6] Update .github/workflows/ci.yml Co-authored-by: Kody Jackson --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b542f22fc192287..f075c506c6173ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -196,6 +196,7 @@ jobs: run: npm ci if: steps.node-modules-cache.outputs.cache-hit != 'true' + - name: Restore Astro assets from cache - uses: actions/cache@v5 with: path: | From 94d50aa47a4380707a33e0df060f4f9080433f58 Mon Sep 17 00:00:00 2001 From: mvm Date: Mon, 23 Mar 2026 10:26:12 -0500 Subject: [PATCH 6/6] fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f075c506c6173ae..ef5a7b23435aa1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -197,7 +197,7 @@ jobs: if: steps.node-modules-cache.outputs.cache-hit != 'true' - name: Restore Astro assets from cache - - uses: actions/cache@v5 + uses: actions/cache@v5 with: path: | node_modules/.astro/assets