Skip to content

ci: cache pip wheels across all test jobs#117

Merged
TrevorBasinger merged 1 commit into
mainfrom
cg/ci-pip-cache
May 19, 2026
Merged

ci: cache pip wheels across all test jobs#117
TrevorBasinger merged 1 commit into
mainfrom
cg/ci-pip-cache

Conversation

@TrevorBasinger
Copy link
Copy Markdown
Member

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.

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>
@TrevorBasinger TrevorBasinger marked this pull request as ready for review May 19, 2026 16:36
@TrevorBasinger TrevorBasinger merged commit 3c7ea33 into main May 19, 2026
12 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