Skip to content

Use the CI toolkit's Swift package cache, and name the test simulator once - #26298

Merged
jkmassel merged 4 commits into
trunkfrom
jkmassel/faster-ci-setup-v1
Oct 30, 2026
Merged

jkmassel merged 4 commits into
trunkfrom
jkmassel/faster-ci-setup-v1

Conversation

@jkmassel

@jkmassel jkmassel commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #26286 that applies its three review suggestions, with no loss of CI performance. The new cache commands come from Automattic/a8c-ci-toolkit-buildkite-plugin#239, released in 7.1.0.

Changes

  • Swift package caching moves to the CI toolkit (suggested by @AliSoftware). The toolkit's new restore_swiftpm_cache and save_swiftpm_cache replace swiftpm-cache.sh and swiftpm-artifacts-cache.sh, using the same cache keys, so existing cache entries still hit. The toolkit's install_swiftpm_dependencies couldn't be used as it stands:
  • One CI simulator constant (AINFRA-3527). CI_SIMULATOR_DEVICE in the Fastfile replaces the three hard-coded names in the CI lanes.
  • Deployment target read from Config/Common.xcconfig (AINFRA-3528), using the existing XcconfigHelper. It parses the file, so it doesn't bring back the xcodebuild -showBuildSettings call that Cut PR CI time by a third: resolve Swift packages once and cache binary frameworks #26286 removed.
  • The CI toolkit goes from 6.3.0 to 7.1.0. 7.0.0 only removed the CocoaPods and git-conceal commands, and this repo uses neither. 7.1.0 adds the cache commands.

One small behaviour change: Swift Package Tests now keys its shared SwiftPM cache on the root Package.resolved, which is the file swift test resolves. It used to restore the app's cache and never saved one.

Why the CI simulator stays the iPhone 17 Pro

The first run used iPhone 18 Pro, as suggested. That made Unit Tests about 50 s slower in every run: 5:15 against 4:25, the mean of 3 paired runs. The other jobs didn't change. The time goes into launching the test bundles:

Unit Tests phase iPhone 17 Pro iPhone 18 Pro
Testing started → first suite 8 s 21 s
First 6 test bundles 5 s 21 s
Main test bundle 72.6 s 79.6 s

So the CI lanes keep the 17 Pro, with the reason in a comment. The local test lane still defaults to the 18 Pro. Switching CI over needs the CI image to have the 18 Pro ready, and that's a separate change.

Results

We ran 3 builds of this branch and 3 trunk control builds at the same time. Each control is trunk's tree plus a comment in shared-pipeline-vars. These runs used the #239 commit before release; the only changes in 7.1.0 since then are comments. The figures are means of job durations. Wall clock isn't compared, because 7 builds shared the Mac queue and jobs waited up to 18 minutes for an agent.

Job Trunk This branch Change
WordPress Build for Testing 5:45 5:41 −0:04
Jetpack Build for Testing 5:03 5:04 +0:01
Swift Package Tests 3:23 3:20 −0:03
Unit Tests 4:10 4:15 +0:05
Critical path (WordPress build + Unit Tests) 9:56 9:56 0:00
Mac time per build 18:22 18:21 −0:01

The Unit Tests runs ranged from 4:04 to 4:24 on both sides, so the 5 s difference is noise.

Test plan

  • All PR jobs green on this branch (#35574), and in all 6 experiment builds.
  • No loss of performance: see Results above. Trunk #35575, #35577, #35579. This branch #35576, #35578, #35580. The iPhone 18 Pro round was #35564–#35569.
  • Same cache entries as trunk: the WordPress build log shows Restoring cache entry wordpress-ios-spm-cache-551d37… and wordpress-ios-spm-artifacts-v1-551d37…, the keys trunk already saved.
  • bundle exec fastlane lanes loads, and XcconfigHelper reads 17.0 from Common.xcconfig. rubocop is clean.
  • TestFlight jobs: these run only on trunk, so they first run after merge. They use the same shared-set-up.sh --artifacts path as the build-for-testing jobs.

@jkmassel jkmassel self-assigned this Oct 29, 2026
@jkmassel jkmassel added this to the 27.5 milestone Oct 29, 2026
@jkmassel
jkmassel marked this pull request as ready for review October 29, 2026 22:53
@jkmassel
jkmassel requested a review from a team as a code owner October 29, 2026 22:53
…simulator once

The local swiftpm-cache.sh and swiftpm-artifacts-cache.sh scripts move to the
a8c-ci-toolkit as restore_swiftpm_cache and save_swiftpm_cache, with the same
cache keys. The test lanes read the deployment target from Common.xcconfig,
and build and test on the iPhone 18 Pro used by the rest of the repo.
On the CI image the unit tests take about 50 s longer on the iPhone 18 Pro,
mostly while the test bundles launch.
@jkmassel
jkmassel force-pushed the jkmassel/faster-ci-setup-v1 branch from 607be3b to f84907e Compare October 30, 2026 00:39
APP="${1:?Usage: build-and-upload-testflight.sh <wordpress|jetpack|reader>}"

"$(dirname "${BASH_SOURCE[0]}")/shared-set-up.sh"
# The build-for-testing jobs save the Swift Package binaries cache, so it's only restored here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd remove the comment from here.

Suggested change
# The build-for-testing jobs save the Swift Package binaries cache, so it's only restored here

If we want to mention that we don't need to save the cache, which makes sense, we could move it where the save call ought to be.

"$(dirname "${BASH_SOURCE[0]}")/swiftpm-artifacts-cache.sh" restore DerivedData/SourcePackages Modules/Package.resolved

echo "--- :testflight: Building and uploading ${APP} to TestFlight"
bundle exec fastlane build_and_upload_app_for_testflight app:"${APP}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
bundle exec fastlane build_and_upload_app_for_testflight app:"${APP}"
bundle exec fastlane build_and_upload_app_for_testflight app:"${APP}"
# No call to save the Swift cache here.
# The build-for-testing jobs already did that and here it was only restored.

@jkmassel
jkmassel added this pull request to the merge queue Oct 30, 2026
@jkmassel
jkmassel removed this pull request from the merge queue due to a manual request Oct 30, 2026
@jkmassel
jkmassel added this pull request to the merge queue Oct 30, 2026
Merged via the queue into trunk with commit e64c851 Oct 30, 2026
21 checks passed
@jkmassel
jkmassel deleted the jkmassel/faster-ci-setup-v1 branch October 30, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants