From 2d17978bf70ca7139d5fedb6fb12405a3a0ee7df Mon Sep 17 00:00:00 2001 From: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:53:47 -0400 Subject: [PATCH] ci: run the test suite in five shards (#7303) One shard was cut by the 25-minute job limit twice on 2026-11-02, at 25m15s and 25m26s, and no test had failed in it either time: the reports it uploaded before the cut carried 13459 tests with no failures and no errors. The suite has grown into the budget rather than anything having broken, and a fifth shard is what gives it room. The partitioner needs no change. It takes the shard total as an argument and balances by class count with each @TestProfile group kept whole, and the completeness gate checks the shards it is handed against the commit's own class list rather than a count. So this is the matrix, the total beside it, and the comments that named four. Measured over the 3223 test classes on main today, with each class's time taken from the surefire reports of one four-shard run: four shards 13.8 13.3 17.1 13.8 minutes of tests five shards 12.6 12.1 12.4 10.7 10.2 The slowest shard loses 27 percent of its test time, 17.1 minutes down to 12.6, and the spread across shards narrows from 3.8 to 2.4. A shard pays about 2m15s before its first test, 1m52s of that the compile, so the fifth job costs that much runner time while the critical path drops by about four and a half minutes. What this does not do is balance by duration. The partitioner weighs classes and profile groups rather than seconds, which is how one shard of four came to carry 17.1 minutes against another's 13.3. Five shards leave more headroom over that imbalance; they do not remove it. --- .github/ci/prefetch-images.sh | 4 ++-- .github/workflows/ci.yml | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/ci/prefetch-images.sh b/.github/ci/prefetch-images.sh index fd7176ba89..76f1210858 100755 --- a/.github/ci/prefetch-images.sh +++ b/.github/ci/prefetch-images.sh @@ -112,7 +112,7 @@ GRAPHQL_IMAGE="$(grep -oE 'graphql-image: *"[^"]+"' src/main/resources/applicati grep -qE '/appsync/|AppSyncCfnIntegrationTest' "$SHARD_FILE" && [ -n "$GRAPHQL_IMAGE" ] && pull "$GRAPHQL_IMAGE" # The Node sidecar that evaluates APPSYNC_JS resolver code; the pin lives in application.yml too. # Matched on the one class that starts it rather than on /appsync/, since every other test in that -# package is a unit test: a path match would have all four shards pull an image one of them uses. +# package is a unit test: a path match would have every shard pull an image one of them uses. JS_RUNTIME_IMAGE="$(grep -oE 'image: *"node:[^"]+"' src/main/resources/application.yml | grep -oE '"[^"]+"' | tr -d '"')" grep -q 'AppSyncJsResolverDockerIntegrationTest' "$SHARD_FILE" && [ -n "$JS_RUNTIME_IMAGE" ] && pull "$JS_RUNTIME_IMAGE" # RdsAwsIntegrationTest is the one class that starts SQL Server (about 1.5 GB); the pin lives in @@ -121,7 +121,7 @@ SQLSERVER_IMAGE="$(grep -oE 'default-sql-server-image: *"[^"]+"' src/main/resour grep -q 'RdsAwsIntegrationTest' "$SHARD_FILE" && [ -n "$SQLSERVER_IMAGE" ] && pull "$SQLSERVER_IMAGE" # Postgres is the most-pulled image in CI: Redshift pins it in application.yml, RDS adapts # postgres:-alpine to the engine version its tests request (16.3), and the CloudFormation -# provisioner tests reach it through Redshift. It was pulled inline in all four shards. +# provisioner tests reach it through Redshift. It was pulled inline in every shard. REDSHIFT_PG_IMAGE="$(grep -oE 'image-version: *postgres:[^ ]+' src/main/resources/application.yml | awk '{print $2}')" grep -qE '/redshift/|/cloudformation/' "$SHARD_FILE" && [ -n "$REDSHIFT_PG_IMAGE" ] && pull "$REDSHIFT_PG_IMAGE" grep -qE '/rds/|/rdsdata/' "$SHARD_FILE" && pull postgres:16.3-alpine diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ec259f2c3..3d6d106960 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,15 +37,16 @@ env: # Hardcoded on purpose: strategy.job-total counts EVERY matrix job, so adding an # unrelated matrix entry later would change the modulus and silently leave part # of the suite running in no shard. Keep in sync with the matrix below. - SHARD_TOTAL: 4 + SHARD_TOTAL: 5 jobs: test: name: Build and Test (shard ${{ matrix.shard }}) runs-on: ubuntu-latest - # Shards now run up to 16m50s (about 15 min of it in "Run tests"), so 20 left little margin. - # This is a runaway-job kill switch, not a budget: Actions bills the minutes a job actually - # uses, so a higher ceiling costs nothing until something hangs. + # A runaway-job kill switch, not a budget: Actions bills the minutes a job actually uses, so a + # higher ceiling costs nothing until something hangs. It did stop being a kill switch once the + # suite grew into it: on 2026-11-02 one shard was cut here twice at 25m15s and 25m26s with no + # test having failed, which is why the suite runs in five shards rather than four. timeout-minutes: 25 # Drafts skip the suite to spare runners; it runs once the PR is ready for review. # Written on the job rather than as a gate job so it costs no runner. Pushes to main @@ -60,7 +61,7 @@ jobs: strategy: fail-fast: false matrix: - shard: [1, 2, 3, 4] + shard: [1, 2, 3, 4, 5] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -72,7 +73,7 @@ jobs: # fails with Path Validation Error); explicit cache steps below. # Restore on every shard; save from shard 1 only. With a combined cache step - # all four shards would race the same save key: one wins, three spend + # every shard would race the same save key: one wins, the rest spend # post-job time reserving-then-failing plus redundant multi-hundred-MB uploads. - uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: @@ -124,7 +125,8 @@ jobs: # surefire.timeout kills a fork whose test ignores JUnit's interrupt (deadlock, blocking # I/O). It caps the whole shard (one fork runs all its tests), so 20 min leaves room above - # the slowest shard's ~15 min and still lets surefire report before the 25-minute job limit. + # the slowest shard, about 12.5 min of tests across five, and still lets surefire report + # before the 25-minute job limit. - name: Run tests run: > ./mvnw surefire:test -B