Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Linux failure paths can leave background package installation running after the action exits, potentially causing lock conflicts in subsequent steps.
1 open issue
What changed in this PR
Reduces Swift setup time by overlapping Linux dependency installation with toolchain preparation and caching verified installers on macOS and Windows.
Changes:
- Installs Linux runtime dependencies in the background, refreshes package lists only after failure, and uses
pigzwhen available. - Caches macOS and Windows installers while re-verifying signatures on every run.
- Adds an opt-in minimal Windows installation and installer cache-hit CI coverage.
| File | Description |
|---|---|
| README.md | Documents caching, Linux optimizations, and minimal Windows installs. |
| install-windows.ps1 | Adds verified installer reuse and minimal-install options. |
| install-macos.sh | Adds verified package reuse and cache source reporting. |
| install-linux.sh | Overlaps dependency installation and optimizes extraction. |
| action.yml | Defines the new input and wires installer caching. |
| .github/workflows/ci.yml | Tests installer cache hits and minimal Windows installs. |
Review effort: Balanced
| fi | ||
|
|
||
| scratch="$(mktemp -d "${RUNNER_TEMP:-/tmp}/setup-swift.XXXXXX")" | ||
| trap 'rm -r -f "$scratch"' EXIT |
Measured on main (run 39647073752): a Linux cache hit took as long as a download, because 9-12 s went to apt-get (most of it the list refresh) and 18-25 s to extracting the archive; Windows spent 23 s downloading and 70 s in the installer, macOS 33 s downloading. - Linux: the packages needed only to run the toolchain install in the background while the archive is fetched, verified and extracted, from the image's package lists first; curl and gnupg2 still come first. The archive is extracted with pigz when the runner has it. - macOS and Windows: the .pkg and the installer are cached. A cached copy is copied to a private directory and verified there on every run, and only bytes that just passed go into the cache; the source output says cache. - Windows: windows-minimal leaves out the debugger, its Python, the IDE support and the Android platform.
…ache them Measured on this PR's run: restoring them from the Actions cache took 22-35 s, against 23-33 s downloading them from swift.org, and on Windows the copy and Authenticode check of the restored installer added 28 s more.
Left out on its own, each feature was measured on 6.4.1: without the IDE feature swift.exe fails with ERROR_SXS_CANT_GEN_ACTCTX (14001), and without the debugger, its Python or the Android platform hello world still builds. Those three cut the installer from 71-83 s to about 57 s.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Stacked on #3 (same files).
Why
Measured on
main(run 39647073752), inside the action:apt-get9–12 s (mostlyapt-get update), GPG ~3 s,tar -xzf18–25 s — a cache hit was no faster than a downloadinstaller~33 sWhat
libcurl4-openssl-dev,uuid-dev, …) are installed in the background while the archive is fetched, verified and extracted, and waited for before the step ends;curlandgnupg2are still installed first because they do the fetching and verifying.apt-get installis tried against the image's package lists first andapt-get updateruns only if that fails.pigzwhen the runner has it..pkgand the installer are cached (cache: true, as on Linux). The verification model does not change: a cached copy is copied to a private directory and its signature checked there on every run, only bytes that just passed are written to the cache, and a cached copy that fails fails the job.sourcereportscache.windows-minimal: trueleaves outOptionsInstallDBG,OptionsInstallPy,OptionsInstallIDEandOptionsInstallAndroidPlatform. Defaultfalse, so nothing changes for existing users.installer-cache-hitjob (macOS, Windows) afterinstall; thewindows-noassertsjob also useswindows-minimal.Checked locally: shellcheck (as CI runs it), actionlint 1.7.12, PowerShell parse. The timings come from this PR's CI run.
🤖 Generated with Claude Code