Skip to content

Commit 0e06fc4

Browse files
committed
Shard backend verification across runners
1 parent 6ab5d35 commit 0e06fc4

3 files changed

Lines changed: 97 additions & 4 deletions

File tree

‎.github/workflows/deploy-production.yml‎

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,103 @@ jobs:
119119

120120
- name: Verify D1, Worker, CLI and security behavior
121121
if: ${{ steps.scope.outputs.scope == 'full' }}
122-
run: npm run test:d1 && npm run orbit:test:cli
122+
run: npm run test:d1:core && npm run orbit:test:cli
123123

124124
- name: Record frontend-only backend decision
125125
if: ${{ steps.scope.outputs.scope != 'full' }}
126126
run: echo 'No backend/security path changed; the fail-safe classifier selected frontend validation.'
127127

128+
backend-publication:
129+
runs-on: ubuntu-latest
130+
timeout-minutes: 12
131+
outputs:
132+
scope: ${{ steps.scope.outputs.scope }}
133+
steps:
134+
- name: Checkout publication candidate and history
135+
uses: actions/checkout@v7
136+
with:
137+
fetch-depth: 0
138+
139+
- name: Classify changed paths independently
140+
id: scope
141+
env:
142+
BEFORE_SHA: ${{ github.event.before }}
143+
EVENT_NAME: ${{ github.event_name }}
144+
run: |
145+
if [[ "$EVENT_NAME" == 'workflow_dispatch' || -z "$BEFORE_SHA" || "$BEFORE_SHA" =~ ^0+$ ]]; then
146+
printf 'scope=full\n' >> "$GITHUB_OUTPUT"
147+
exit 0
148+
fi
149+
git diff --name-only "$BEFORE_SHA" "$GITHUB_SHA" | node scripts/orbit-actions-scope.mjs
150+
151+
- name: Set up Node
152+
if: ${{ steps.scope.outputs.scope == 'full' }}
153+
uses: actions/setup-node@v7
154+
with:
155+
node-version: 24
156+
cache: npm
157+
158+
- name: Install dependencies
159+
if: ${{ steps.scope.outputs.scope == 'full' }}
160+
run: npm ci
161+
162+
- name: Verify publication, backup, media and dashboard behavior
163+
if: ${{ steps.scope.outputs.scope == 'full' }}
164+
run: npm run test:d1:publication
165+
166+
- name: Record frontend-only publication decision
167+
if: ${{ steps.scope.outputs.scope != 'full' }}
168+
run: echo 'No backend/security path changed; publication validation is not required.'
169+
170+
backend-platform:
171+
runs-on: ubuntu-latest
172+
timeout-minutes: 12
173+
outputs:
174+
scope: ${{ steps.scope.outputs.scope }}
175+
steps:
176+
- name: Checkout platform candidate and history
177+
uses: actions/checkout@v7
178+
with:
179+
fetch-depth: 0
180+
181+
- name: Classify changed paths independently
182+
id: scope
183+
env:
184+
BEFORE_SHA: ${{ github.event.before }}
185+
EVENT_NAME: ${{ github.event_name }}
186+
run: |
187+
if [[ "$EVENT_NAME" == 'workflow_dispatch' || -z "$BEFORE_SHA" || "$BEFORE_SHA" =~ ^0+$ ]]; then
188+
printf 'scope=full\n' >> "$GITHUB_OUTPUT"
189+
exit 0
190+
fi
191+
git diff --name-only "$BEFORE_SHA" "$GITHUB_SHA" | node scripts/orbit-actions-scope.mjs
192+
193+
- name: Set up Node
194+
if: ${{ steps.scope.outputs.scope == 'full' }}
195+
uses: actions/setup-node@v7
196+
with:
197+
node-version: 24
198+
cache: npm
199+
200+
- name: Install dependencies
201+
if: ${{ steps.scope.outputs.scope == 'full' }}
202+
run: npm ci
203+
204+
- name: Verify dashboard, media and platform behavior
205+
if: ${{ steps.scope.outputs.scope == 'full' }}
206+
run: npm run test:d1:platform
207+
208+
- name: Record frontend-only platform decision
209+
if: ${{ steps.scope.outputs.scope != 'full' }}
210+
run: echo 'No backend/security path changed; platform validation is not required.'
211+
128212
deploy:
129213
needs:
130214
- frontend
131215
- backend
132-
if: ${{ needs.frontend.result == 'success' && needs.backend.result == 'success' && needs.frontend.outputs.scope != 'docs' && needs.frontend.outputs.scope == needs.backend.outputs.scope }}
216+
- backend-publication
217+
- backend-platform
218+
if: ${{ needs.frontend.result == 'success' && needs.backend.result == 'success' && needs.backend-publication.result == 'success' && needs.backend-platform.result == 'success' && needs.frontend.outputs.scope != 'docs' && needs.frontend.outputs.scope == needs.backend.outputs.scope && needs.frontend.outputs.scope == needs.backend-publication.outputs.scope && needs.frontend.outputs.scope == needs.backend-platform.outputs.scope }}
133219
runs-on: ubuntu-latest
134220
timeout-minutes: 8
135221
environment:

‎package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
"orbit:import:verify": "tsx scripts/orbit-slice3-manifest.ts",
2929
"orbit:import:local": "tsx scripts/orbit-slice3-import.ts --local --database=orbit-v6-local --config=wrangler.test.jsonc",
3030
"test:d1": "tsx --test --test-concurrency=5 scripts/orbit-d1-tests.ts scripts/orbit-public-page-tests.ts scripts/orbit-slice1-tests.ts scripts/orbit-slice1-worker-tests.ts scripts/orbit-slice3-tests.ts scripts/orbit-slice4-tests.ts scripts/orbit-slice5-tests.ts",
31+
"test:d1:core": "tsx --test --test-concurrency=5 scripts/orbit-d1-tests.ts scripts/orbit-public-page-tests.ts scripts/orbit-slice1-tests.ts scripts/orbit-slice1-worker-tests.ts scripts/orbit-slice3-tests.ts",
32+
"test:d1:publication": "tsx --test scripts/orbit-slice4-tests.ts",
33+
"test:d1:platform": "tsx --test scripts/orbit-slice5-tests.ts",
3134
"v6:check": "npm run test:d1 && npm run check && npm run worker:build",
3235
"preview": "astro preview",
3336
"check": "npm run orbit:validate && astro check",

‎scripts/orbit-production-config-tests.mjs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,19 @@ assert(
231231
assert(
232232
!deployWorkflow.includes('\n classify:')
233233
&& !deployWorkflow.includes('needs: classify')
234-
&& deployWorkflow.includes('needs.frontend.outputs.scope == needs.backend.outputs.scope'),
234+
&& deployWorkflow.includes('needs.frontend.outputs.scope == needs.backend.outputs.scope')
235+
&& deployWorkflow.includes('needs.frontend.outputs.scope == needs.backend-publication.outputs.scope')
236+
&& deployWorkflow.includes('needs.frontend.outputs.scope == needs.backend-platform.outputs.scope'),
235237
'path classification still serializes validation jobs or can disagree without failing closed',
236238
);
237239
assert(
238240
deployWorkflow.includes('npm run verify:frontend:production'),
239241
'production frontend is not built and verified through the single-build path',
240242
);
241243
assert(
242-
deployWorkflow.includes('npm run test:d1 && npm run orbit:test:cli'),
244+
deployWorkflow.includes('npm run test:d1:core && npm run orbit:test:cli')
245+
&& deployWorkflow.includes('npm run test:d1:publication')
246+
&& deployWorkflow.includes('npm run test:d1:platform'),
243247
'full backend scope can skip D1, Worker or CLI verification',
244248
);
245249
assert(

0 commit comments

Comments
 (0)