From d60cbb9c3bd545383cb36c65b4cc513bbd4453ab Mon Sep 17 00:00:00 2001 From: merencia Date: Mon, 22 Jun 2026 11:56:06 -0300 Subject: [PATCH] fix(ci): build the workspace in each job instead of sharing dist via cache Master CI went red after merging #189/#190/#191 (all individually green, docs/metadata-only changes). The build job passed, but lint/test/integration failed with missing build outputs (unresolved types; 'Cannot find module .../sidequest/dist/index.cjs'). Root cause: the setup action cached build outputs (**/dist) and the downstream jobs (which do not build) restored them via actions/cache. That cross-job cache handoff is unreliable: even after the build job saved the cache successfully, a downstream job starting seconds later got a cache miss (GitHub Actions cache read-after-write inconsistency, surfacing now that runners were force-migrated to Node 24). A miss left the job with no dist, so type-aware lint and the tests broke. Fix: stop sharing dist across jobs. Cache only dependencies, keyed on the lockfile (stable, high reuse), and have setup always run 'yarn build' so every job has a freshly built workspace. Builds are fast via Turbo. Also switches the deprecated --frozen-lockfile to --immutable. --- .github/actions/setup/action.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 43072651..e733867e 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,5 +1,5 @@ name: Setup Project -description: Setup Node.js, restore build cache, and setup Yarn +description: Setup Node.js, install dependencies, and build the workspace inputs: node-version: @@ -15,7 +15,12 @@ runs: with: node-version: ${{ inputs.node-version }} - - name: Restore build outputs + # Cache dependencies only (not build outputs). Keyed on the lockfile, so it is + # stable and reused across commits. Build outputs are intentionally NOT cached + # across jobs: every job builds its own dist below. Relying on a cross-job cache + # to carry **/dist proved unreliable (read-after-write inconsistency between the + # build job and downstream lint/test jobs left them with missing dist). + - name: Restore dependencies id: cache uses: actions/cache@v4 with: @@ -23,8 +28,7 @@ runs: .yarn node_modules **/node_modules - **/dist - key: ${{ runner.os }}-build-${{ hashFiles('**/yarn.lock') }}-${{ github.sha }} + key: ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }} - name: Enable Corepack shell: bash @@ -33,4 +37,8 @@ runs: - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' shell: bash - run: yarn install --frozen-lockfile + run: yarn install --immutable + + - name: Build workspace + shell: bash + run: yarn build