Skip to content

Commit 2101b3c

Browse files
committed
improvement(ci): elect one dependency cache writer per integration matrix
1 parent 97e483b commit 2101b3c

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎.github/CI.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ GitHub-hosted jobs restore their event-specific dependency caches first. Trusted
44

55
The `changes` job runs Turborepo 2.9.14's `affectedTasks` query before installing application dependencies or provisioning services. `turbo.json` records package dependency propagation; `apps/sim/turbo.json` partitions the app into shared runtime, server, workspace UI, and acceptance tasks. `.github/ci-suites.json` turns those tasks into job matrices. The uploaded `ci-plan` artifact names changed files, selected tasks, attribution reasons, and any fallback.
66

7+
The integration matrix's `push/db` job owns dependency-cache uploads; the other integration jobs only restore. Exact hits skip uploads. This avoids concurrently compressing the same dependency trees across all shards merely to lose the shared-key reservation race.
8+
79
A PR compares its merge base with the checked-out merge commit. Main/staging pushes execute all checks; the parent `ci` workflow skips checks on `dev` pushes, while PRs targeting `dev` still run checks. A manual `checks` run executes all checks unless supplied a full base commit SHA to reproduce a scoped plan. Missing history, an empty diff, unknown files outside the workspace graph, root script/CI changes, or a planner error run every check. Missing selection outputs fail the aggregate gate. The gate also rejects an omitted dependency, any failed/cancelled job, and any skip that its explicit selection flag did not authorize.
810

911
| Change | Expensive checks selected |

‎.github/actions/setup/action.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ inputs:
1818
description: npm registry to write an .npmrc for, so `npm publish` reads NODE_AUTH_TOKEN. Empty writes none.
1919
required: false
2020
default: ''
21+
save-dependency-cache:
22+
description: Save GitHub dependency caches after installation. Parallel matrices can elect one writer.
23+
required: false
24+
default: 'true'
2125

2226
# Writes stay scoped by event and fork status. Trusted GitHub PRs can read the
2327
# default branch's push caches; push jobs never read PR caches.
@@ -60,6 +64,7 @@ runs:
6064
path: ./node_modules
6165

6266
- name: Restore Bun cache
67+
id: bun-cache
6368
if: inputs.provider != '' && inputs.provider != 'blacksmith'
6469
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
6570
with:
@@ -70,6 +75,7 @@ runs:
7075
path: ~/.bun/install/cache
7176

7277
- name: Restore node_modules
78+
id: node-modules-cache
7379
if: inputs.provider != '' && inputs.provider != 'blacksmith'
7480
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
7581
with:
@@ -114,14 +120,14 @@ runs:
114120
exit 1
115121
116122
- name: Save Bun cache
117-
if: inputs.provider != '' && inputs.provider != 'blacksmith'
123+
if: inputs.provider != '' && inputs.provider != 'blacksmith' && inputs.save-dependency-cache == 'true' && steps.bun-cache.outputs.cache-hit != 'true'
118124
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
119125
with:
120126
key: ${{ github.repository }}-bun-cache-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-${{ github.run_id }}
121127
path: ~/.bun/install/cache
122128

123129
- name: Save node_modules
124-
if: inputs.provider != '' && inputs.provider != 'blacksmith'
130+
if: inputs.provider != '' && inputs.provider != 'blacksmith' && inputs.save-dependency-cache == 'true' && steps.node-modules-cache.outputs.cache-hit != 'true'
125131
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
126132
with:
127133
key: ${{ github.repository }}-node-modules-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-${{ hashFiles('bun.lock') }}-${{ github.run_id }}

‎.github/workflows/checks.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ jobs:
136136
uses: ./.github/actions/setup
137137
with:
138138
provider: github
139+
save-dependency-cache: ${{ matrix.provision == 'push' && matrix.shard == 'db' }}
139140

140141
- name: Provision a fresh database through the supported command
141142
working-directory: packages/db

0 commit comments

Comments
 (0)