Skip to content

ci: shard integration tests and matrix darwin on go 1.25/1.26#65

Merged
bilby91 merged 1 commit into
mainfrom
ci/parallelize-integration-and-matrix-darwin
May 16, 2026
Merged

ci: shard integration tests and matrix darwin on go 1.25/1.26#65
bilby91 merged 1 commit into
mainfrom
ci/parallelize-integration-and-matrix-darwin

Conversation

@bilby91
Copy link
Copy Markdown
Member

@bilby91 bilby91 commented May 16, 2026

Summary

  • Renames testtest-linux and test-integrationtest-integration-linux for symmetry with the darwin jobs.
  • Matrices test-darwin and test-integration-darwin over Go 1.25 and 1.26 (previously 1.25 only).
  • Shards both integration jobs into 3 parallel shards. Test names are enumerated via go test -list under the integration build tag and partitioned by sorted-index modulo SHARD_TOTAL, so adding a test only reshuffles which shard owns it. Apple-container tests are already build-tagged darwin/arm64, so they don't leak into linux shards; the darwin shard filters to ^TestAppleContainer_ before partitioning.

Wall-clock on the last successful run was ~5m27s for linux integration. With 3 shards we expect ~2m per shard (~3m saved). Critical path remains test-darwin at ~10m (SwiftPM build dominates) — now exercising both Go versions in parallel.

Test plan

  • CI run on this PR shows 6 test-integration-linux legs (go × shard) and 6 test-integration-darwin legs.
  • Linux shard logs print the partitioned test list and only run that subset.
  • Total of partitioned tests across the 3 linux shards equals the full integration suite (no test dropped, no duplicates).
  • test-darwin (1.26) passes alongside test-darwin (1.25).

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Chores
    • Improved CI infrastructure with better test organization and parallelization for faster feedback. Updated toolchain configuration for compatibility with multiple Go versions.

Note: These changes are internal infrastructure improvements with no direct impact on end-user functionality.

Review Change Stack

Splits the linux integration job into 3 shards × 2 Go versions and
mirrors the darwin jobs on both supported Go versions. Test names are
enumerated via `go test -list` under the integration build tag and
partitioned deterministically by sorted-index modulo SHARD_TOTAL, so
adding a test only reshuffles which shard owns it.

Renames `test` → `test-linux` and `test-integration` → `test-integration-linux`
for symmetry with the darwin jobs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

📝 Walkthrough

Walkthrough

The CI workflow is refactored to support flexible Go versions and parallel test execution. The Linux unit test job is renamed to test-linux with downstream dependencies updated accordingly. Both macOS test jobs now use Go versions from their strategy matrices. A new test-integration-linux job adds deterministic 3-shard test distribution using test enumeration and modulo-based selection. The apple-container test runner is similarly updated with sharding logic to distribute TestAppleContainer_* tests across shards.

Changes

CI workflow test sharding and Go version parameterization

Layer / File(s) Summary
Job renaming, dependencies, and Go version parameterization
.github/workflows/ci.yml
The Linux unit test job is renamed from test to test-linux. Downstream macOS jobs (build-darwin, test-integration-darwin, publish-macos) are updated to depend on test-linux. Both test-darwin and test-integration-darwin are updated to use ${{ matrix.go }} instead of hardcoded Go versions, allowing flexible Go version testing on macOS.
Integration test sharding for Linux and macOS
.github/workflows/ci.yml
A new test-integration-linux job executes integration tests across 3 shards; it enumerates integration tests using go test -tags=integration -list, deterministically selects the shard subset using test index modulo arithmetic, and runs only the selected tests with a 15m timeout. The apple-container integration test command in test-integration-darwin is replaced with a bash-based sharded runner that enumerates TestAppleContainer_* tests, validates discovery, selects the current shard's tests by index modulo, and exits early if the shard has no tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

  • crunchloop/devcontainer#63: Introduced the apple-container integration job (test-integration-darwin) that this PR extends with test sharding and shard-aware test selection logic.

Poem

🐰 Workflows in parallel, tests divide and run,
Go versions dance together on each platform's sun,
With shards that spread the burden wide and true,
Your CI pipeline now flexes something new!
✨🔄🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: sharding integration tests and expanding the darwin Go version matrix to 1.25/1.26.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/parallelize-integration-and-matrix-darwin

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

120-126: ⚡ Quick win

Handle empty linux shard before building -run regex.

If selected is empty, the generated pattern becomes ^()$, which is brittle and harder to reason about. Add an explicit empty-shard guard (as done in the darwin shard) for consistency and predictable behavior.

Suggested patch
           selected=$(echo "$tests" | awk -v s="$SHARD_INDEX" -v t="$SHARD_TOTAL" \
             '{ if ((NR - 1) % t == (s - 1)) print }')
           echo "Shard ${SHARD_INDEX}/${SHARD_TOTAL} will run:"
           echo "$selected"
+          if [ -z "$selected" ]; then
+            echo "shard is empty; nothing to run"
+            exit 0
+          fi
           pattern="^($(echo "$selected" | paste -sd '|' -))$"
           go test -race -count=1 -tags=integration -timeout=15m \
             -run "$pattern" ./test/integration/...
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 120 - 126, The linux shard can produce
an empty $selected which yields a brittle pattern "^()$"; add the same
empty-shard guard used in the darwin shard: after computing selected, check if
it is empty (test -z "$selected"), and if so print a message like "Shard X/Y has
no tests, skipping" and exit successfully before constructing pattern or
invoking go test -run; ensure you reference the existing variables $selected,
$SHARD_INDEX, $SHARD_TOTAL and keep the rest of the go test invocation
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 120-126: The linux shard can produce an empty $selected which
yields a brittle pattern "^()$"; add the same empty-shard guard used in the
darwin shard: after computing selected, check if it is empty (test -z
"$selected"), and if so print a message like "Shard X/Y has no tests, skipping"
and exit successfully before constructing pattern or invoking go test -run;
ensure you reference the existing variables $selected, $SHARD_INDEX,
$SHARD_TOTAL and keep the rest of the go test invocation unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d3e9e9b7-27dc-4d75-ba16-a5514c435e05

📥 Commits

Reviewing files that changed from the base of the PR and between 54f4126 and b0ea351.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

@bilby91 bilby91 merged commit a888f7e into main May 16, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant