From e2e5f87b740433febcef7fb906b051bc1544f5dc Mon Sep 17 00:00:00 2001 From: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Date: Tue, 31 Mar 2026 04:36:19 -0700 Subject: [PATCH] Cache Zig package downloads in CI to prevent TLS flakes (#2423) * Cache Zig package downloads in CI to prevent TLS flakes The ui-regressions job fails intermittently with TlsInitializationFailed when xcodebuild's Zig build phase fetches dependencies from deps.files.ghostty.org. Unlike Swift packages (cached + retried), Zig package downloads had no caching. Add ~/.cache/zig cache steps to all four Zig-using jobs (tests, tests-build-and-lag, ui-regressions in ci.yml, and build-ghosttykit.yml) keyed on the ghostty build.zig.zon files. * Use shared Zig cache key prefix across all CI jobs Whichever job runs first warms the cache for all others, since all jobs fetch the same Zig packages. --------- Co-authored-by: Lawrence Chen --- .github/workflows/build-ghosttykit.yml | 8 ++++++++ .github/workflows/ci.yml | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/.github/workflows/build-ghosttykit.yml b/.github/workflows/build-ghosttykit.yml index bf89ae2d..7fd65884 100644 --- a/.github/workflows/build-ghosttykit.yml +++ b/.github/workflows/build-ghosttykit.yml @@ -60,6 +60,14 @@ jobs: export DEVELOPER_DIR="$XCODE_DIR" xcodebuild -version + - name: Cache Zig packages + if: steps.check-release.outputs.exists == 'false' + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 + with: + path: ~/.cache/zig + key: zig-packages-${{ hashFiles('ghostty/build.zig.zon', 'ghostty/build.zig.zon.json') }} + restore-keys: zig-packages- + - name: Build GhosttyKit.xcframework if: steps.check-release.outputs.exists == 'false' run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b7063f6..76c15434 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,6 +129,13 @@ jobs: zig version fi + - name: Cache Zig packages + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 + with: + path: ~/.cache/zig + key: zig-packages-${{ hashFiles('ghostty/build.zig.zon', 'ghostty/build.zig.zon.json') }} + restore-keys: zig-packages- + - name: Cache DerivedData uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 with: @@ -293,6 +300,13 @@ jobs: zig version fi + - name: Cache Zig packages + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 + with: + path: ~/.cache/zig + key: zig-packages-${{ hashFiles('ghostty/build.zig.zon', 'ghostty/build.zig.zon.json') }} + restore-keys: zig-packages- + - name: Cache DerivedData uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 with: @@ -447,6 +461,13 @@ jobs: zig version fi + - name: Cache Zig packages + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 + with: + path: ~/.cache/zig + key: zig-packages-${{ hashFiles('ghostty/build.zig.zon', 'ghostty/build.zig.zon.json') }} + restore-keys: zig-packages- + - name: Cache Swift packages uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 with: