ci(ios): shallow checkout and zig only on fallback for TestFlight uploads

Merged
TE
2mo ago
+801-19

Measured waste

Official upload run 35747417664 on blacksmith-6vcpu-macos-26: Checkout 12 min (fetch-depth: 0 + submodules: recursive) and Install zig 6 min, even though ensure-ghosttykit.sh then just downloaded the pinned prebuilt. That is ~18 macOS-min per upload before any build, on the Blacksmith macOS pool that PR CI also waits on. Both upload jobs had this pattern: ios-testflight.yml (CMUX INTERNAL) and ios-appstore-upload.yml (cmux.app, hourly).

Local timing for the same repo: clone --depth 1 took 41 s (625 MB). A full clone plus submodule update --init --recursive took 598 s (2.9 GB).

What changed

  • Checkout: fetch-depth: 1, no submodules, no tags, in both macOS upload jobs. The iOS workspace's local-package closure (ios/cmuxPackage, Packages/iOS/*, Packages/Shared/*, CmuxPhonePush, and the in-tree vendor/stack-auth-swift-sdk-prerelease) needs only GhosttyKit.xcframework from outside the repo. It does not use vendor/bonsplit or homebrew-cmux. It also does not need the ghostty source unless GhosttyKit has to be built from source.
  • GhosttyKit/zig: this follows the pattern reload-build.yml already uses. download-prebuilt-ghosttykit.sh runs first, keyed by the gitlink (git rev-parse HEAD:ghostty) so ghostty is never checked out. It uses the same bounded budget ensure-ghosttykit.sh had: 3 retries and 300 s per attempt. The fallback steps run only when that download fails. They fetch ghostty at depth 1 (it has no nested submodules, and the pinned SHA is fetchable), run install-zig-ci.sh, and then run ensure-ghosttykit.sh with CMUX_GHOSTTYKIT_NO_PREBUILT=1. When the prebuilt is missing, the result is the same from-source build as before.
  • History: the only history the upload path reads is generate-testflight-notes.sh walking last_uploaded_sha..HEAD (CMUX INTERNAL, --notes-from-range). The new ios/scripts/fetch-testflight-notes-history.sh does this in three steps. It fetches the base at depth 1, then fetches --shallow-since one day before the base's committer date. If the base is still not an ancestor, it deepens in bounded steps (2000 commits max). It never fails the upload. An unknown or unreachable base falls back to the generator's generic line, as it did in a full clone. The step is skipped for the marketing_version_override path, which uses --skip-notes.
  • The official cmux.app lane reads no history: its notes come from ios/CHANGELOG.md (#13468), and its build number is a UTC timestamp. The ios-v* tag lookup is only reached with --auto-version, which neither workflow passes, so tags are dropped too.
  • The decide / skip logic (#13660) and the Linux jobs are unchanged.

Expected savings

About 16–17 macOS-min per upload run. The checkout drops from ~12 min to about 1 min, and zig is skipped whenever the pinned prebuilt exists, which is the normal case. The hourly cmux.app lane alone uploads up to 24×/day, so that lane can save up to ~6.5 macOS-hours/day. Each CMUX INTERNAL upload saves the same amount on top.

Release/changelog behavior

On the real repo, a shallow clone plus the fetch script with a base 30 commits back took 12 s and fetched 150 commits. It produced byte-identical "What to Test" notes to a full clone. The official lane's changelog notes and build numbering are untouched.

Tests

  • New tests/test_ios_upload_lean_checkout.py (wired into ci-guards, release-ios). It pins the checkout depth and submodule policy for the macOS jobs, and pins that zig, the ghostty init and ensure-ghosttykit.sh run only behind ghosttykit_prebuilt.outputs.available != 'true'. It also runs the download step's script with a stub and checks both outputs. It runs the fetch script against real shallow clones in five cases: the normal range with notes equal to a full clone, non-monotonic dates that need the deepen fallback, the deepen bound, empty and unknown bases, and a full clone.
  • Pass: tests/test_ios_*.py, tests/test_ci_linux_guard_routing.py, tests/test_ci_release_guard_structure.py, tests/test_ci_guard_workflow_structure.py, tests/test_check_ghostty_zig_workflows.py + tests/check_ghostty_zig_workflows.py .github/workflows, tests/test_install_zig_ci_*.sh, tests/test_ci_ghosttykit_checksum_verification.sh, and actionlint 1.7.7.
  • tests/test_ci_change_areas.py fails locally in test_router_change_with_app_source_uses_trusted_base_product_routing. It fails the same way on unmodified main, so the cause is the local environment, not this change.

Note: scripts/download-prebuilt-ghosttykit.sh is not in the decide job's iOS path filter. I left it out on purpose so the #13660 logic stays untouched.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Speeds up both iOS upload workflows (ios-testflight.yml, ios-appstore-upload.yml) by replacing the full recursive checkout (~12 min) and unconditional zig install (~6 min) with a shallow checkout plus a prebuilt-GhosttyKit-first flow, saving ~16–17 macOS-min per run.

  • Both upload jobs now check out with fetch-depth: 1 and no submodules or tags; zig and the ghostty source (depth 1) are fetched, and the from-source build run, only when the pinned prebuilt GhosttyKit download fails.
  • The cmux.app lane reads no git history, so its changelog notes and UTC-timestamp build numbers are unchanged.
  • The new ios/scripts/fetch-testflight-notes-history.sh fetches only the last_uploaded_sha..HEAD range the CMUX INTERNAL notes need, using blobless fetches, a --shallow-since cut one day before the base, and bounded deepening that also covers non-monotonic merge histories; it repairs .git/shallow after every fetch.
  • A force-pushed-away or unknown base falls back to the generator's generic line, and the step is best-effort (timeout-minutes: 5, continue-on-error: true); every script path exits 0.
  • Adds tests/test_ios_upload_lean_checkout.py (wired into ci-guards and test-execution.toml) pinning the checkout and fallback policy and exercising the fetch script against real shallow clones, including a merge whose side branch predates the cutoff and a force-pushed base.

Summary by CodeRabbit

  • Improvements
    • iOS release uploads can use prebuilt components first, with a source-build fallback when needed.
    • TestFlight release notes can include changes from earlier commits while keeping release preparation resilient when history is unavailable.
    • iOS upload workflows use leaner checkouts, reducing unnecessary download and setup work.