ci: cache pip wheels across all test jobs#117
Merged
Conversation
macos-15-intel test job takes 15 minutes. ~6.5 of those are "Install dependencies" — and the dominant chunk inside that is ~3.5 minutes spent compiling `dependency-injector` from source because PyPI doesn't ship a macosx_*_x86_64 wheel for it at the versions we depend on. Compare: Linux (ubuntu-latest): install ~33s macOS arm64 (macos-latest): install ~42s macOS x86_64 (macos-15-intel): install ~388s ← 6.5 minutes The macOS x86_64 lane is just slower at test execution too (older Intel hardware), so the test step alone is ~8 min. Not much we can do about that without trimming the macOS test set. The install side is fixable. actions/setup-python@v5 has a built-in pip wheel cache that backs onto GitHub-hosted cache storage (per-repo, ~10 GB, keyed automatically by OS + arch + Python version + the contents of `cache-dependency-path`). Once a wheel is built or downloaded once, subsequent runs reuse it. Adds `cache: pip` + `cache-dependency-path: pyproject.toml` to every actions/setup-python step: - lint - typecheck - test (Python 3.10/3.11/3.12/3.13 matrix) - test-macos (arm64 + x86_64 matrix) - test-tracer-privileged Each (OS, arch, Python version) combination gets its own cache entry — no collisions across the matrix. The key invalidates on `pyproject.toml` changes, so a dep version bump correctly forces a fresh resolve. Expected impact on cached runs: - macos-15-intel install: 388s → ~30-60s - macos-15-intel total: 15m → ~10-11m - Linux install: 33s → ~5-10s - Linux total: 4-5m → ~3-4m First run after this PR merges (or after any pyproject.toml change) still pays the full install cost. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
macos-15-intel test job takes 15 minutes. ~6.5 of those are "Install dependencies" — and the dominant chunk inside that is ~3.5 minutes spent compiling
dependency-injectorfrom source because PyPI doesn't ship a macosx_*_x86_64 wheel for it at the versions we depend on.Compare:
Linux (ubuntu-latest): install ~33s
macOS arm64 (macos-latest): install ~42s
macOS x86_64 (macos-15-intel): install ~388s ← 6.5 minutes
The macOS x86_64 lane is just slower at test execution too (older Intel hardware), so the test step alone is ~8 min. Not much we can do about that without trimming the macOS test set. The install side is fixable.
actions/setup-python@v5 has a built-in pip wheel cache that backs onto GitHub-hosted cache storage (per-repo, ~10 GB, keyed automatically by OS + arch + Python version + the contents of
cache-dependency-path). Once a wheel is built or downloaded once, subsequent runs reuse it.Adds
cache: pip+cache-dependency-path: pyproject.tomlto every actions/setup-python step:Each (OS, arch, Python version) combination gets its own cache entry — no collisions across the matrix. The key invalidates on
pyproject.tomlchanges, so a dep version bump correctly forces a fresh resolve.Expected impact on cached runs:
First run after this PR merges (or after any pyproject.toml change) still pays the full install cost.