Skip to content

Commit 97e483b

Browse files
committed
fix(ci): persist dependency caches and restore default-branch seeds
1 parent f8a561d commit 97e483b

2 files changed

Lines changed: 49 additions & 4 deletions

File tree

‎.github/CI.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CI selection and acceptance ownership
22

3+
GitHub-hosted jobs restore their event-specific dependency caches first. Trusted PRs also try the default branch's push caches, so a new PR can reuse installed dependencies before it has saved a cache of its own. The `node_modules` fallback requires the identical lockfile hash. Saves stay in the event-specific namespace, fork PRs do not receive the fallback, and push jobs never restore PR caches. Blacksmith sticky disks keep their existing event-scoped keys. Dependency installation still validates the frozen lockfile after every restore. Explicit save steps run immediately after installation, while the composite action's path inputs are available, so later test failures do not prevent dependency-cache population.
4+
35
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.
46

57
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.

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

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ inputs:
1919
required: false
2020
default: ''
2121

22-
# Cache keys are scoped by event name, and fork PRs get their own namespace on
23-
# top: untrusted fork runs must never share a cache with push runs (whose caches
24-
# feed production image builds) or with trusted internal-PR runs.
22+
# Writes stay scoped by event and fork status. Trusted GitHub PRs can read the
23+
# default branch's push caches; push jobs never read PR caches.
2524
#
2625
# node_modules also keys on the lockfile hash: a sticky disk is a mutable volume,
2726
# and `bun install --frozen-lockfile` adds what the lockfile needs without
@@ -45,27 +44,57 @@ runs:
4544
registry-url: ${{ inputs.registry-url }}
4645

4746
- name: Mount Bun cache
47+
if: inputs.provider == '' || inputs.provider == 'blacksmith'
4848
uses: ./.github/actions/cache
4949
with:
5050
provider: ${{ inputs.provider }}
5151
key: ${{ github.repository }}-bun-cache-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}
5252
path: ~/.bun/install/cache
5353

5454
- name: Mount node_modules
55+
if: inputs.provider == '' || inputs.provider == 'blacksmith'
5556
uses: ./.github/actions/cache
5657
with:
5758
provider: ${{ inputs.provider }}
5859
key: ${{ github.repository }}-node-modules-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-${{ hashFiles('bun.lock') }}
5960
path: ./node_modules
6061

62+
- name: Restore Bun cache
63+
if: inputs.provider != '' && inputs.provider != 'blacksmith'
64+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
65+
with:
66+
key: ${{ github.repository }}-bun-cache-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-${{ github.run_id }}
67+
restore-keys: |
68+
${{ github.repository }}-bun-cache-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-
69+
${{ github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && format('{0}-bun-cache-push-', github.repository) || '' }}
70+
path: ~/.bun/install/cache
71+
72+
- name: Restore node_modules
73+
if: inputs.provider != '' && inputs.provider != 'blacksmith'
74+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
75+
with:
76+
key: ${{ github.repository }}-node-modules-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-${{ hashFiles('bun.lock') }}-${{ github.run_id }}
77+
restore-keys: |
78+
${{ github.repository }}-node-modules-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-${{ hashFiles('bun.lock') }}-
79+
${{ github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && format('{0}-node-modules-push-{1}-', github.repository, hashFiles('bun.lock')) || '' }}
80+
path: ./node_modules
81+
6182
- name: Mount Turbo cache
62-
if: inputs.turbo-cache-key != ''
83+
if: inputs.turbo-cache-key != '' && (inputs.provider == '' || inputs.provider == 'blacksmith')
6384
uses: ./.github/actions/cache
6485
with:
6586
provider: ${{ inputs.provider }}
6687
key: ${{ github.repository }}-${{ inputs.turbo-cache-key }}-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}
6788
path: ./.turbo
6889

90+
- name: Restore and save Turbo cache
91+
if: inputs.turbo-cache-key != '' && inputs.provider != '' && inputs.provider != 'blacksmith'
92+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
93+
with:
94+
key: ${{ github.repository }}-${{ inputs.turbo-cache-key }}-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-${{ github.run_id }}
95+
restore-keys: ${{ github.repository }}-${{ inputs.turbo-cache-key }}-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-
96+
path: ./.turbo
97+
6998
# Bun retries a failed request itself, but a registry connection that stalls
7099
# without failing leaves `bun install` waiting until the job's own timeout
71100
# cancels it, the whole budget spent on one hung step. Healthy installs finish
@@ -83,3 +112,17 @@ runs:
83112
done
84113
echo "::error title=bun install stalled::both attempts ran past 3 minutes"
85114
exit 1
115+
116+
- name: Save Bun cache
117+
if: inputs.provider != '' && inputs.provider != 'blacksmith'
118+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
119+
with:
120+
key: ${{ github.repository }}-bun-cache-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-${{ github.run_id }}
121+
path: ~/.bun/install/cache
122+
123+
- name: Save node_modules
124+
if: inputs.provider != '' && inputs.provider != 'blacksmith'
125+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
126+
with:
127+
key: ${{ github.repository }}-node-modules-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-${{ hashFiles('bun.lock') }}-${{ github.run_id }}
128+
path: ./node_modules

0 commit comments

Comments
 (0)