Repository navigation
ci: run the parts of Build, Unit Tests, E2E Local in parallel jobs - #963
Conversation
Build and checks, the API report check, the unit tests (in 3 shards) and the local E2E suite now run as parallel jobs. Build, Unit Tests, E2E Local stays as the required check: an always() job that fails unless every part succeeded, so jobs that need it keep waiting for all of them. scripts/ci/unit-test-shard.mjs splits the root workspaces so each one runs in exactly one shard; its test also checks the workflow wiring. E2E: all
|
…haviour - check:api only needs the build, so it moves into local-build after the packed-assets check, and the separate local-api job goes. That saves one install and build and one runner per run; local-build stays well under Local E2E. - The wiring test now runs the required check's aggregator script with crafted NEEDS: it must exit 0 only when every part succeeded, and 1 for any failed, skipped, cancelled or missing part. An `exit 0` or a dropped failure check used to pass the text-only assertions.
Locally it still skips without jq; in CI a missing jq now fails the test instead of hiding the check.
osama-rizk
left a comment
There was a problem hiding this comment.
Since the last review: 2 resolved · 0 new · 0 still open
- Resolved: the wiring test now runs the aggregator's own
run:block (scripts/ci/unit-test-shard.test.mjs). - Resolved:
check:apiis folded intolocal-build, andlocal-apiis gone.
Approving. The required check keeps its shape, and the test now guards what the script does, not only its text.
What I verified at 5316663:
-
The test fails on the edits that used to slip through. I applied each of these edits to
.github/workflows/pr-checks.ymland rannode --test scripts/ci/unit-test-shard.test.mjs:- final
exit 1changed toexit 0; - the closing
if [ "$failed" != 0 ] ... fideleted; exit 1changed totrue;!= successnarrowed to= failure;skippedallowed through;local-e2edropped from the loop;always()changed to!cancelled().
Each one fails the test. The unmodified file passes 29/29.
- final
-
The jq fallback behaves as described. With jq off
PATH, the new test skips locally and fails whenCI(continuous integration) is set, so it can't go quiet on a runner. -
The aggregator still gates on every part. I extracted the new
run:block and ran it against every result combination. Only an all-successrun exits 0. Afailure,skippedorcancelledpart fails it, and so do a missing part and an emptyneeds. The job is stillif: always()and still named "Build, Unit Tests, E2E Local", which is the context the main ruleset requires. -
No step from the old monolith was lost. I compared the job against main (763f67e). All 19 steps of main's
build-and-test-localare still there. Unit Tests and the CDK (Cloud Development Kit) probe check now run as the shardedlocal-unitversions. "Check API backward compatibility" runs once, inlocal-build, after the packed-assets check. -
CI is green. Run 39979839028 at this head passed. Local Build and Checks ran
check:api(step 15), and the aggregator test ran rather than skipping. The aggregator log shows the three parts, allsuccess. -
It merges cleanly. A trial merge with current main has no conflicts, and the test passes 29/29 on the merged tree.
No follow-ups from me. One observation, not a request: with check:api folded in, Local Build and Checks (6m37s) is now about level with the slowest unit shard (6m33s), so wall-clock time is essentially unchanged.
What
The required check Build, Unit Tests, E2E Local ran build, checks,
check:api(~2.4 min), unit tests (~8.5-9 min), local E2E (~3.5 min) and packing one after another: 15.4 min p50 over 25 runs, 17.6 / 18.9 min in the main baseline (#940). Every job that needs it (Templates, and on main the AWS E2E jobs) starts only after it.This PR runs the parts as parallel jobs:
local-build(Local Build and Checks)npm run check:api, pack and uploaddist-registrylocal-unit(Local Unit Tests, shards 1-3)npm run testin the shard's workspaces, the real-CDK probe marker check in the shard that runs@aws-blocks/corelocal-e2e(Local E2E)npm run test:e2e:localbuild-and-test-local(Build, Unit Tests, E2E Local)Why it is safe
build-and-test-localkeeps its id and name, runs withif: always()(so it is never skipped), and fails unless every part's result issuccess. A failed, cancelled or skipped part, or one missing fromneeds, fails it.scripts/ci/unit-test-shard.test.mjschecks this wiring, and also runs the aggregator's own script with craftedneedsresults: it must exit 0 only when every part succeeded. Mutations that drop a part fromneedsor from the loop, switch tosuccess(), accept a non-success result, turn the finalexit 1intoexit 0, delete the failure block, or add a second matrix axis all fail the test.needs: build-and-test-local, which now succeeds only once every part has. Under ci: start the AWS E2E jobs without waiting for unit tests #941 the AWS jobs drop that edge and Templates keep it, as before.scripts/ci/unit-test-shard.mjsreads the rootworkspaces, which is the listnpm run test --workspacesuses. It puts each workspace in exactly one shard and prints package names, because-w <path>would also select nested workspaces. It refuses glob, duplicate or unnamed entries. A new workspace is picked up automatically. The probe check fails if no shard runs@aws-blocks/core. Test counts before and after are below.dist-registryis now packed right after the build instead of after the tests. A local run packed it both ways: 3347 files, all identical.check-actions-pinned.mjs,actionlintclean).Cost
The setup (
npm ci+ build, ~2.8 min) now runs in 5 jobs instead of 1, so a run uses roughly 11 more runner minutes, in exchange for wall-clock time. Install caching (separate work) would cut it.Measurements
Minutes from run creation. Before: the main baseline (#940, runs 39812188339 and 39821845972) and the 25-run p50. After: this PR's runs 39864968616 (run 1) and 39873258910 (run 2).
check:apimoved into Build and Checks; it added ~1.4 min there, still under Local E2E): Build and Checks 3.2, API Check 3.1, Unit shards 5.0 / 5.5 / 5.9, Local E2E 6.5 (critical), then the aggregator 0.1. Each part spends ~2.5 min onnpm ci+ build.StreamFailedException: Bedrock is unable to process your request., HTTP 500, testpreset SMART returns a response). This PR does not touch that job, and the same SHA passed it in run 2.Test counts
npm run test:unitvs 3 shards)unit-test-shard.test.mjs)Per workspace, the shards match a plain
npm run test:unitof the same tree exactly: 63 workspaces, each run once. The +50 is@aws-blocks/core(1546 -> 1596) from #791, which merged after the baseline.Red check proof
A throwaway commit with a deliberately failing unit test in
packages/bb-logger(shard 2) ran in 39872287962. Shard 2 failed. Build, Unit Tests, E2E Local failed (local-unit: failure, "Every part of Build, Unit Tests, E2E Local must succeed."), every E2E job was skipped, and Build and Test failed. The commit was then dropped (force-push back to dff18e9).Overlaps
Merges clean with #941, #950, #951, #957, #962, #964 and #965: their new steps after "Test the E2E job selection" land in
local-build. #966 and #967 insert a step next to the movedcheck:api/Unit Testssteps, which is a one-line conflict for whichever lands second (put the step inlocal-build).The measured runs above were on dff18e9 with
E2E: all. The head no longer carries a trailer, so a CI-only push selects no AWS E2E job; the review follow-ups below change only wherecheck:apiruns and a test.Review follow-ups (2026-10-23)
check:apiruns in Local Build and Checks, and the Local API Check job is gone (d0b96d81).needsand does not skip in CI when jq is missing (d0b96d81, 53166632). Withexit 1turned intoexit 0, or the failure block deleted, the old test still passed 28/28 and the new one fails.