Skip to content

Commit 8c274e9

Browse files
committed
fix(ci): self-install deps per job (GHA same-run cache not shareable across jobs)
1 parent a8edd6c commit 8c274e9

1 file changed

Lines changed: 34 additions & 35 deletions

File tree

.github/workflows/ci.yml

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ env:
1919
BUN_CACHE: ~/.bun/install/cache
2020
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
2121

22+
# Each job is self-sufficient: it restores the persistent bun *store* cache
23+
# (~/.bun/install/cache, which survives across runs) and runs its own
24+
# `bun install --frozen-lockfile`. We deliberately do NOT share node_modules
25+
# across jobs — a cache saved by the `install` job is not reliably visible to
26+
# needs-dependent jobs within the SAME run (GitHub Actions same-run cross-job
27+
# cache propagation gap), which previously left every downstream job with no
28+
# deps. With a warm store the per-job install is a few seconds; on a cold miss
29+
# it still produces a correct node_modules (just slower). The `install` job
30+
# warms the store once before the fan-out.
31+
2232
jobs:
2333
install:
2434
name: Install Dependencies
@@ -28,14 +38,10 @@ jobs:
2838
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
2939
with: { bun-version: 1.3.14 } # renovate: datasource=docker depName=oven/bun
3040
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
31-
id: cache-deps
3241
with:
33-
path: |
34-
${{ env.BUN_CACHE }}
35-
**/node_modules
36-
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lock', '**/package.json') }}
37-
- if: steps.cache-deps.outputs.cache-hit != 'true'
38-
run: bun install --frozen-lockfile
42+
path: ${{ env.BUN_CACHE }}
43+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock', '**/package.json') }}
44+
- run: bun install --frozen-lockfile
3945

4046
lint:
4147
name: Lint
@@ -47,10 +53,9 @@ jobs:
4753
with: { bun-version: 1.3.14 } # renovate: datasource=docker depName=oven/bun
4854
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
4955
with:
50-
path: |
51-
${{ env.BUN_CACHE }}
52-
**/node_modules
53-
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lock', '**/package.json') }}
56+
path: ${{ env.BUN_CACHE }}
57+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock', '**/package.json') }}
58+
- run: bun install --frozen-lockfile
5459
- run: bun run lint:ci
5560

5661
typecheck:
@@ -63,10 +68,9 @@ jobs:
6368
with: { bun-version: 1.3.14 } # renovate: datasource=docker depName=oven/bun
6469
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
6570
with:
66-
path: |
67-
${{ env.BUN_CACHE }}
68-
**/node_modules
69-
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lock', '**/package.json') }}
71+
path: ${{ env.BUN_CACHE }}
72+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock', '**/package.json') }}
73+
- run: bun install --frozen-lockfile
7074
- run: bun run typecheck
7175

7276
unit-tests:
@@ -79,10 +83,9 @@ jobs:
7983
with: { bun-version: 1.3.14 } # renovate: datasource=docker depName=oven/bun
8084
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
8185
with:
82-
path: |
83-
${{ env.BUN_CACHE }}
84-
**/node_modules
85-
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lock', '**/package.json') }}
86+
path: ${{ env.BUN_CACHE }}
87+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock', '**/package.json') }}
88+
- run: bun install --frozen-lockfile
8689
- run: bun run test:unit
8790

8891
i18n-check:
@@ -95,10 +98,9 @@ jobs:
9598
with: { bun-version: 1.3.14 } # renovate: datasource=docker depName=oven/bun
9699
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
97100
with:
98-
path: |
99-
${{ env.BUN_CACHE }}
100-
**/node_modules
101-
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lock', '**/package.json') }}
101+
path: ${{ env.BUN_CACHE }}
102+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock', '**/package.json') }}
103+
- run: bun install --frozen-lockfile
102104
# Catches commits made with --no-verify that bypass the lefthook i18n hook.
103105
- run: bun run i18n:extract && bun run i18n:compile
104106
env:
@@ -115,10 +117,9 @@ jobs:
115117
with: { bun-version: 1.3.14 } # renovate: datasource=docker depName=oven/bun
116118
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
117119
with:
118-
path: |
119-
${{ env.BUN_CACHE }}
120-
**/node_modules
121-
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lock', '**/package.json') }}
120+
path: ${{ env.BUN_CACHE }}
121+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock', '**/package.json') }}
122+
- run: bun install --frozen-lockfile
122123
- name: Dependency audit (blocking)
123124
# All ignored advisories are dev/build-only — they never ship (the Dockerfile
124125
# installs --production). Runtime advisories (js-yaml, @opentelemetry/core) were
@@ -150,10 +151,9 @@ jobs:
150151
with: { bun-version: 1.3.14 } # renovate: datasource=docker depName=oven/bun
151152
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
152153
with:
153-
path: |
154-
${{ env.BUN_CACHE }}
155-
**/node_modules
156-
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lock', '**/package.json') }}
154+
path: ${{ env.BUN_CACHE }}
155+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock', '**/package.json') }}
156+
- run: bun install --frozen-lockfile
157157
- run: bun run build
158158
- run: bun run size
159159
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
@@ -172,10 +172,9 @@ jobs:
172172
with: { bun-version: 1.3.14 } # renovate: datasource=docker depName=oven/bun
173173
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
174174
with:
175-
path: |
176-
${{ env.BUN_CACHE }}
177-
**/node_modules
178-
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lock', '**/package.json') }}
175+
path: ${{ env.BUN_CACHE }}
176+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock', '**/package.json') }}
177+
- run: bun install --frozen-lockfile
179178
- run: bunx cypress install
180179
- run: bun run test:e2e:fast
181180
- if: failure()

0 commit comments

Comments
 (0)