@@ -111,8 +111,13 @@ jobs:
111111 restore-keys : |
112112 ${{ runner.os }}-pnpm-store-v3-
113113
114- - name : Setup Turbo cache
115- uses : actions/cache@v6
114+ # Restore-only on PRs: PR-side saves (~5 turbo entries per push) churned
115+ # the repo's 10 GB Actions cache pool and evicted the main-branch seeds —
116+ # observed as sudden cold-cache spikes (Build Core 51s → 4m30s). PRs fall
117+ # back to main's entries via the prefix restore-keys; only main pushes
118+ # save (the "Save Turbo cache" step at the end of the job).
119+ - name : Restore Turbo cache
120+ uses : actions/cache/restore@v6
116121 with :
117122 path : .turbo/cache
118123 key : ${{ runner.os }}-turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
@@ -142,25 +147,25 @@ jobs:
142147 TURBO_SCM_BASE : ${{ github.event.pull_request.base.sha }}
143148 run : pnpm turbo run test --affected --filter=!@objectstack/dogfood --concurrency=4
144149
145- # Push to main: full run, but exclude spec's plain test task — the
146- # coverage step below executes the exact same 250-file spec suite once,
147- # with coverage. Previously the spec suite ran twice per push. Dogfood is
148- # excluded for the same reason as the PR step: the Dogfood job runs it.
150+ # Push to main: full run. Spec's suite runs here plain (uninstrumented);
151+ # the coverage-instrumented pass moved to the nightly Spec Coverage
152+ # workflow (coverage-nightly.yml) — instrumentation added minutes to
153+ # every main push for a trend artifact that is consulted occasionally at
154+ # best. Dogfood is excluded for the same reason as the PR step: the
155+ # Dogfood job runs it.
149156 - name : Run all tests (push)
150157 if : github.event_name == 'push'
151- run : pnpm turbo run test --filter=!@objectstack/spec --filter=!@objectstack/dogfood --concurrency=4
152-
153- - name : Generate coverage report
154- if : github.event_name == 'push'
155- run : pnpm --filter @objectstack/spec test:coverage
156-
157- - name : Upload coverage reports
158- if : github.event_name == 'push'
159- uses : actions/upload-artifact@v7
158+ run : pnpm turbo run test --filter=!@objectstack/dogfood --concurrency=4
159+
160+ # Seed the shared Turbo cache from main only (see the restore step
161+ # above). always(): keep the seed fresh even when a test fails, matching
162+ # the old actions/cache post-step behavior.
163+ - name : Save Turbo cache (main only)
164+ if : always() && github.event_name == 'push'
165+ uses : actions/cache/save@v6
160166 with :
161- name : coverage-report
162- path : packages/spec/coverage/
163- retention-days : 30
167+ path : .turbo/cache
168+ key : ${{ runner.os }}-turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
164169
165170 dogfood :
166171 # Sharded 2-way: the suite is ~60 independent test files, each booting its
@@ -209,10 +214,11 @@ jobs:
209214 ${{ runner.os }}-pnpm-store-v3-
210215
211216 # Shard-scoped key: the turbo test hash differs per shard (pass-through
212- # args are part of the task hash), and two same-named matrix jobs would
213- # otherwise race to save one cache entry per sha.
214- - name : Setup Turbo cache
215- uses : actions/cache@v6
217+ # args are part of the task hash). Restore-only on PRs — see the Restore
218+ # Turbo cache comment in the test job; the save step at the end of this
219+ # job seeds from main only.
220+ - name : Restore Turbo cache
221+ uses : actions/cache/restore@v6
216222 with :
217223 path : .turbo/cache
218224 key : ${{ runner.os }}-turbo-${{ github.job }}-${{ matrix.shard }}-${{ github.ref_name }}-${{ github.sha }}
@@ -247,6 +253,15 @@ jobs:
247253 echo "::endgroup::"
248254 done
249255
256+ # Seed the shared Turbo cache from main only (see the restore step
257+ # above); shard-scoped key so the two matrix jobs don't collide.
258+ - name : Save Turbo cache (main only)
259+ if : always() && github.event_name == 'push'
260+ uses : actions/cache/save@v6
261+ with :
262+ path : .turbo/cache
263+ key : ${{ runner.os }}-turbo-${{ github.job }}-${{ matrix.shard }}-${{ github.ref_name }}-${{ github.sha }}
264+
250265 dogfood-gate :
251266 # Stable required-check name for a SHARDED job (#3622 follow-up).
252267 #
@@ -312,8 +327,13 @@ jobs:
312327 restore-keys : |
313328 ${{ runner.os }}-pnpm-store-v3-
314329
315- - name : Setup Turbo cache
316- uses : actions/cache@v6
330+ # Restore-only on PRs: PR-side saves (~5 turbo entries per push) churned
331+ # the repo's 10 GB Actions cache pool and evicted the main-branch seeds —
332+ # observed as sudden cold-cache spikes (Build Core 51s → 4m30s). PRs fall
333+ # back to main's entries via the prefix restore-keys; only main pushes
334+ # save (the "Save Turbo cache" step at the end of the job).
335+ - name : Restore Turbo cache
336+ uses : actions/cache/restore@v6
317337 with :
318338 path : .turbo/cache
319339 key : ${{ runner.os }}-turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
@@ -377,6 +397,14 @@ jobs:
377397 packages/spec/json-schema/
378398 retention-days : 30
379399
400+ # Seed the shared Turbo cache from main only (see the restore step above).
401+ - name : Save Turbo cache (main only)
402+ if : always() && github.event_name == 'push'
403+ uses : actions/cache/save@v6
404+ with :
405+ path : .turbo/cache
406+ key : ${{ runner.os }}-turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
407+
380408 build-docs :
381409 name : Build Docs
382410 needs : filter
0 commit comments