Skip to content

CI: Optimize builds and cancel in flight builds#768

Merged
ktoso merged 4 commits into
swiftlang:mainfrom
ktoso:wip-actions-cancel
May 26, 2026
Merged

CI: Optimize builds and cancel in flight builds#768
ktoso merged 4 commits into
swiftlang:mainfrom
ktoso:wip-actions-cancel

Conversation

@ktoso
Copy link
Copy Markdown
Collaborator

@ktoso ktoso commented May 26, 2026

We have too many builds now, because we test every sample and on many platforms and swift versions. This is too extreme since they don't really differ much.

  • macOS only tests 6.3 Swift now
  • total saved 32 jobs (53 matrix-driven jobs -> 21)

We want to cancel in progress jobs since we dont really need them; just always run on the latest pushed code immediately, freeing up resources more eagerly

We also improve build caching for the samples

We want to cancel in progress jobs since we dont really need them; just
always run on the latest pushed code immediately, freeing up resources
more eagerly
@ktoso ktoso marked this pull request as ready for review May 26, 2026 03:29
Drop Swift 6.2 from Linux jobs and reduce macOS jobs to Swift 6.3 only.
verify-samples is now 6.3 only on both platforms since the 7-sample
fan-out was the largest contributor (was 28 Linux + 14 macOS = 42 jobs;
now 7 + 7 = 14). Linux still covers 6.1.3 and nightly via test-swift.

Saves ~32 jobs per PR.
@ktoso ktoso changed the title Actions: change cancel-in-progress CI: less jobs and cancel in flight builds May 26, 2026
@ktoso
Copy link
Copy Markdown
Collaborator Author

ktoso commented May 26, 2026

Trying to improve caching to speed up the samples builds as well

Each Samples/<name>/Package.swift declares swift-java as a path: "../../"
dependency, so every sample's `swift build` recompiles the entire
swift-java tree (including swift-syntax) into its own .build dir. With
seven samples this is ~7x duplicated work and dominates CI time.

Add an actions/cache step to verify-samples and verify-samples-macos
that caches Samples/<sample>/.build keyed on swift-java sources +
sample sources + Swift toolchain version, with restore-keys so partial
reuse kicks in even when swift-java sources change. SwiftPM's
incremental build then rebuilds only what actually changed.

The bigger structural win (re-enabling --experimental-prebuilts to skip
swift-syntax entirely) is still blocked on swiftlang#418 and tracked separately.
@ktoso ktoso force-pushed the wip-actions-cancel branch from 3ddacc8 to e658f7f Compare May 26, 2026 04:21
@ktoso ktoso changed the title CI: less jobs and cancel in flight builds CI: Optimize builds and cancel in flight builds May 26, 2026
@ktoso ktoso merged commit b600c61 into swiftlang:main May 26, 2026
41 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