Skip to content

CI: give Windows a persistent Cargo target and enable sccache - #5946

Merged
jdetter merged 10 commits into
masterfrom
tars/windows-cache-parity
Sep 24, 2026
Merged

jdetter merged 10 commits into
masterfrom
tars/windows-cache-parity

Conversation

@jdetter

@jdetter jdetter commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

This pull request and its description were written by AI.

Description of Changes

Make Windows self-hosted runners reuse the warmed Cargo target baked into the runner image:

  • use C:/actions-runner/_work/target, outside the checkout directory;
  • enable Windows sccache and report its statistics;
  • keep GitHub-hosted windows-latest, Linux, and macOS behavior unchanged.

The image-warming implementation remains in infra PR 1349 for now and is expected to move into a shared cross-platform Cargo command. This PR only consumes the resulting cache layout, so that implementation change will not require another workflow change.

This is the Windows version of #5848.

Performance

A fresh vm27 image warmed from master commit 190670675f8a26849d15670faac598764cd468eb produced these results in staging run 36007072082:

  • Upload build artifacts: 5m48s master median → 2m38s (54.6% faster); sccache 84.38% (27 hits, 5 misses), up from vm26's 2.63%.
  • Build smoketests: 3m33s master median → 1m31s (57.3% faster); sccache 83.78% (31 hits, 6 misses), up from vm26's 0.23%.

This confirms the low vm26 hit rates were primarily cache-age/source-drift rather than a Windows-specific sccache problem. Results are from one staging run, so timings remain subject to runner variance.

API and ABI breaking changes

None.

Rollback safety impact

n/a

Expected complexity level and risk

1 — low risk. CI configuration only; an image without the warm cache falls back to a cold but working build.

Testing

  • .github/workflows/ci.yml parses successfully
  • Both cache-consuming Windows build jobs passed against vm27 in Actions run 36007072082
  • Temporary staging labels removed; final jobs target spacetimedb-windows-runner

Windows CI rebuilds everything from scratch on every run for one reason: the
set-cargo-target-dir anchor sends Linux to $HOME/actions-runner/_work/target,
outside the workspace, and everything else to $GITHUB_WORKSPACE/target --
which checkout wipes each run. Windows also never had sccache enabled at all.

Point Windows at C:/actions-runner/_work/target and enable sccache there,
mirroring the Linux setup already on master. The Windows branch is gated on
the runner work directory existing, so GitHub-hosted windows-latest jobs keep
their current workspace-local behaviour.

RUSTC_WRAPPER is set to an explicit C:/sccache/sccache.exe rather than the
result of `command -v`: these steps run under Git Bash, whose `command -v`
returns an MSYS path (/c/sccache/sccache.exe) that Cargo, a native Windows
process, cannot execute. The `command -v` guard is kept only to detect
whether the runner image was warmed, so an unwarmed image degrades to a cold
but working build instead of failing.

The Windows-only actions/cache entries for rusty_v8 and vendored OpenSSL are
deliberately left in place for this iteration.

Requires a runner image warmed by warm-cache-windows.ps1 in
clockworklabs/infra. Without it these paths are simply empty and builds
behave as they do today.
@jdetter
jdetter marked this pull request as draft September 16, 2026 04:35
Points upload-build-artifacts-windows, smoketest_build_windows and
smoketest_partitions_windows at spacetimedb-windows-runner-staging so this PR
can be qualified against runner image vm26, which carries the warmed sccache
store and dependency-only Cargo target.

This commit exists only to measure the effect and MUST be reverted before
merge. Leaving it in would send all production Windows CI to the staging pool.

The windows-latest matrix in the update-flow job is deliberately untouched --
it runs on GitHub-hosted runners and has no warmed image.

Revert with:
  git revert <this commit>
@jdetter
jdetter marked this pull request as ready for review September 22, 2026 03:38
@jdetter
jdetter requested a review from rekhoff September 22, 2026 03:40
@bfops

bfops commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Do you know why the sccache hit rates were so low?

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated

@bfops bfops left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

Route the three self-hosted Windows CI jobs to the staging pool so runner image vm27 can be measured against the prior vm26 qualification.\n\nThis commit is temporary and will be reverted after collecting sccache statistics and job timings.
@jdetter
jdetter disabled auto-merge September 24, 2026 14:05
@jdetter
jdetter enabled auto-merge September 24, 2026 14:19
@jdetter
jdetter added this pull request to the merge queue Sep 24, 2026
Merged via the queue into master with commit 3cb3feb Sep 24, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants