Skip to content

CI: parallelize wheel builds per Python version + sccache caching#117

Merged
ssmichael1 merged 2 commits into
mainfrom
ci-parallel-wheels-cache
Jun 3, 2026
Merged

CI: parallelize wheel builds per Python version + sccache caching#117
ssmichael1 merged 2 commits into
mainfrom
ci-parallel-wheels-cache

Conversation

@ssmichael1

Copy link
Copy Markdown
Owner

Summary

Speeds up the PyPI wheel build in the Release workflow two ways:

  1. Parallel matrix — split build_wheels so each CPython version (cp310–cp314) is its own job per architecture, instead of one runner serially looping through all five via cibuildwheel. Matrix is now 4 arch × 5 versions = 20 parallel jobs. Since the extension is not abi3, each version is a distinct wheel, so the split is a real ~5× wall-clock cut on the per-runner build.

  2. sccache caching — compiler-level cache (RUSTC_WRAPPER=sccache, SCCACHE_GHA_ENABLED) backed by the GitHub Actions cache, with CARGO_INCREMENTAL=0 so artifacts are cacheable. sccache keys on compiler inputs, so dependency crates (nalgebra, pyo3, …) are reused across runs and across the parallel per-version jobs — which is what pays back the redundant dependency compilation the matrix split would otherwise introduce.

Linux container plumbing

Linux wheels build inside the manylinux container, which shares neither the host filesystem nor host env, so:

  • mozilla-actions/sccache-action installs sccache on the host and exports the ACTIONS_* cache creds into the step env.
  • CIBW_BEFORE_ALL_LINUX installs the sccache binary inside the container (pinned to 0.15.0, which speaks the current GHA cache service v2 / ACTIONS_RESULTS_URL; older sccache only knows the retired v1 / ACTIONS_CACHE_URL and aborts with "environment variable not found").
  • CIBW_ENVIRONMENT_PASS_LINUX forwards the sccache config + GHA cache credentials into the container.

CIBW_BUILD pins each job to its one version; sdist is emitted once (ubuntu-latest + cp313); artifacts renamed to include the python tag.

Validation

Triggered via workflow_dispatch on this branch (run 26852358627) — all 20 wheel jobs green, sdist built, publish_pypi correctly skipped (gated on refs/tags/v*). sccache reported a 94% hit rate on a warm macOS job (deps + C/assembler fully cached; only satkit's own crates miss).

🤖 Generated with Claude Code

ssmichael1 and others added 2 commits June 2, 2026 18:30
Split the build_wheels matrix so each CPython version (cp310–cp314) is
its own job per architecture instead of one serial cibuildwheel loop per
runner — 4 arch × 5 versions = 20 parallel jobs. Since the extension is
not abi3, each version is a distinct wheel, so the split is a real ~5x
wall-clock cut on the per-runner build.

Add sccache (compiler-level cache) backed by the GitHub Actions cache so
the parallel jobs don't each recompile dependencies from scratch:

- RUSTC_WRAPPER=sccache + SCCACHE_GHA_ENABLED on all platforms; sccache
  keys on compiler inputs, so dependency crates are reused across runs
  and across the parallel per-version jobs.
- CARGO_INCREMENTAL=0 so artifacts are cacheable.
- Linux wheels build inside the manylinux container, which shares neither
  the host filesystem nor host env, so: install the sccache binary in the
  container via CIBW_BEFORE_ALL_LINUX, and forward the sccache config plus
  the GHA cache credentials (exported by sccache-action) into the
  container via CIBW_ENVIRONMENT_PASS_LINUX.

CIBW_BUILD pins each job to its one version; sdist is emitted once
(ubuntu-latest + cp313); artifacts renamed to include the python tag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Linux wheel jobs failed: sccache aborted with "environment variable
not found" on `rustc -vV`. GitHub runners now use the cache service v2
(ACTIONS_CACHE_SERVICE_V2=on, ACTIONS_RESULTS_URL), but the binary
installed inside the manylinux container was sccache 0.8.2, which only
speaks the retired v1 service (ACTIONS_CACHE_URL) and exits when it's
absent. macOS/Windows passed because they use the host's 0.15.0 from
sccache-action. Pin the container install to 0.15.0 to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ssmichael1 ssmichael1 merged commit bbc8fcc into main Jun 3, 2026
34 checks passed
@ssmichael1 ssmichael1 deleted the ci-parallel-wheels-cache branch June 3, 2026 00:32
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.

1 participant