Repository navigation
Description
Context
.github/workflows/ci.yml currently runs with no build caching of any kind — no actions/cache, no Swatinem/rust-cache, no soldr. CARGO_COMMAND is bare (env.CARGO_COMMAND, ci.yml:18), so every job recompiles the workspace and its dependency graph from a cold target/ on every run.
On top of that, every phase1-native matrix leg re-fetches and re-installs its system linkers from scratch on every run, with no persistence between runs:
- linux-gnu — adds the apt.llvm.org repo and installs
clang-22/llvm-22-linker-tools, downloads thelibtinfo5.deb, and pulls themoldandwildrelease tarballs (ci.yml:124–153). - windows-gnu —
msys2/setup-msys2installsmingw-w64-ucrt-x86_64-clang, then downloads the pinnedbinutils.pkg.tar.zst(ci.yml:79–85, 187–189). - windows-msvc / linux / macOS —
KyleMayes/install-llvm-action(LLVM 18.1.8) on non-macOS legs (ci.yml:92–95);brew install llvm@18on macOS (ci.yml:216–221).
These downloads (LLVM, mold, wild, binutils, brew formulae) are the "heavy price" paid on every single CI run. All versions are already pinned via env: (ci.yml:19–29) and checksum-verified, which makes them ideal cache keys.
Separately, the four build targets each compile natively on their own OS runner (ubuntu-24.04, windows-2022 ×2, macos-14). Windows and macOS GitHub-hosted runners bill at a higher minute multiplier than Linux, and there are fewer of them, so they dominate wall-clock and cost.
There is a first-party action for the caching half of this: zackees/setup-soldr (@v0, default soldr 0.8.43) installs one soldr binary, provisions the resolved Rust toolchain, and restores content-addressed Soldr/zccache build state — advertised as ~2× faster cross-PR builds vs. per-key caches. Usage is soldr cargo build .... reld already namechecks soldr in the README ("soldr makes the compile fast; reld is the other half of the loop").
Proposal
Three related CI improvements:
-
Adopt
setup-soldrfor compiler/build caching. Addzackees/setup-soldr@v0withcache: truetohygiene,phase1-native, andpython(if it builds), and route cargo throughsoldr. The cleanest lever is settingenv.CARGO_COMMANDtosoldr cargo(the workflow already invokes$CARGO_COMMANDeverywhere, so most steps need no change) — but confirm quoting/interpolation works inbash,pwsh, andmsys2 {0}shells; a per-step wrapper may be needed where& $env:CARGO_COMMANDis used (ci.yml:332+). Usesetup-soldr/cleanup@v0between build and cache-lifecycle-sensitive test phases if self-build cache daemon interference appears. -
Cache the system linkers behind cache-gated Python setup scripts. Replace the inline shell linker-provisioning blocks with Python setup scripts (consistent with the existing
ci/*.pytooling such asphase1_summary.pyandci/tests). Each script:- Checks whether the required linker/toolchain is already present in the GHA cache (restored earlier in the job); if present, it does nothing (no download, no apt/brew/msys2/tarball fetch).
- Only on a cache miss does it perform the heavy install/download and checksum-verify, then lay the artifacts down in a stable, cacheable location.
- After the script runs, the populated location is saved back to the GHA cache (via
actions/cacherestore-before / save-after, orcache/restore+cache/save) so subsequent runs skip the work entirely.
Cache keys are derived from the already-pinnedenv:versions (CLANG_PACKAGE_VERSION,LLD_VERSION,MOLD_VERSION,WILD_VERSION,MSYS2_BINUTILS_VERSION,LIBTINFO5_VERSION,APPLE_LD_VERSION), so a version bump invalidates exactly the affected linker's cache. The existing "Verify and smoke" steps remain the correctness gate on both cache-hit and cache-miss paths.
-
Cross-compile release builds on parallel Linux runners. Add a release cross-compilation path that builds the Windows/macOS targets from
ubuntu-24.04(e.g.--release --target x86_64-pc-windows-msvc/aarch64-apple-darwinvia cross toolchains), exploiting cheaper, more-plentiful Linux runners for the compile+link phases and producing release artifacts. See Decisions for the important scoping constraint about native test execution.
Acceptance criteria
-
ci.ymluseszackees/setup-soldr@v0with caching enabled on the build jobs, and cargo invocations route throughsoldr. - Linker provisioning is driven by Python setup scripts (under
ci/) that are no-ops on a cache hit and only download/install on a miss; the populated linker location is saved to the GHA cache for reuse. - A cold run populates caches; a subsequent warm run on the same pinned versions shows a measurable reduction in (a) dependency/workspace compile time and (b) linker-provisioning time (the LLVM/mold/wild/binutils/brew steps hit cache instead of re-downloading). Capture before/after timings from two consecutive Actions runs in the PR.
- Linker version-drift guards (the
grep -q "${VERSION}"checks in the smoke steps) still pass on a cache hit — a stale cache must fail loudly, never silently serve a wrong linker. - A Linux-hosted release cross-compile produces linked Windows and macOS target binaries (artifacts uploaded), running green.
- No reduction in test coverage: all native/self-host/e2e steps that must run on-target still run on their native runners (see Decisions).
- RED -> GREEN evidence: land a minimal workflow change first that demonstrates the cache miss -> hit transition (e.g. a run showing "cache not found" / script performing the install, followed by a run showing "cache restored" / script skipping the install), then the timing-improvement change on top.
Decisions
- Priority: P2. Pure CI cost/speed optimization; no user-facing behavior change and nothing is broken today. Upgrade to P1 if CI minutes/queue time become a shipping bottleneck.
- Linker setup is Python, cache-gated. Per the requesting note, the linker provisioning is reimplemented as Python scripts that only execute the heavy download/install path on a cache miss and are otherwise no-ops, with the result cached in GHA. This matches the repo's existing
ci/*.pyconvention and keeps the miss/hit logic testable outside the YAML. - Native tests stay on native runners. reld's CI is dominated by executing linked binaries on-target: Linux acceptance/difftest/mold-corpus, the windows-msvc self-host + sqlite-bridge e2e + reld-bench, and the macOS self-host + e2e + bench. Cross-compilation from Linux can move the compile+link phases (and release-artifact production) to cheap parallel Linux runners, but on-target test execution cannot move to Linux without emulation. Scope item docs: phased implementation plan for GPT-5.6 handoff #3 to the build/link/artifact phases and keep the native test matrix where it is. This is the honest reading of the request — "take advantage of parallel Linux runners to build the software" is achievable; relocating the whole test suite is not.
- Release mode noted despite the non-goal. The README lists "Release / shipping builds" as an explicit non-goal for reld's own linker output, but the request here is about CI build configuration (
--releaseof reld itself for cross-compiled artifacts / faster optimized self-host), which is unrelated to that non-goal. Proceeding on that reading. - Cache keys reuse existing pins. Every linker version is already an
env:constant with a checksum, so cache keys are derived from those constants — no new source of version truth is introduced. CARGO_COMMANDas the soldr seam. Reusing the existing$CARGO_COMMANDindirection minimizes diff surface; fall back to per-step wrappers only where shell interpolation of a two-word command breaks (notably thepwsh& $env:CARGO_COMMANDcall sites).
Open questions
- Does
setup-soldr@v0(soldr 0.8.43) support themsys2 {0}shell and the Windows GNU/MSVC toolchains used here, or is its caching Linux/native-cargo focused? Verify on a spike before wiring all four legs. - For the macOS cross-compile from Linux, is an Apple SDK/sysroot lawfully and practically available in CI (osxcross-style), or should the macOS leg keep native compilation and only Windows cross-compile from Linux? Determine during implementation.
- Does
soldr cargocompose with theCARGO_TARGET_*_LINKER=reldoverrides used in the self-host/e2e steps, or should those steps bypass soldr? Confirm no interference with the linker-override env vars. - Per-OS cache scoping: GHA caches are branch/OS-scoped — confirm the Python-script cache keys include the runner OS/arch so a macOS linker cache never restores onto a Linux leg.
Activity
ci: cache-gated Python linker setup + Linux cross-compile release job (…