Skip to content

Commit 25197f4

Browse files
abnobdossAbanoub Doss
andauthored
ci: cache Python bindings Rust artifacts (#2679)
## Which issue does this PR close? - None. This is a CI maintenance change for the Python bindings test job. ## What changes are included in this PR? This adds a real Rust artifact cache to the Python bindings CI test job for host maturin builds on Windows and macOS. Concretely, this PR adds two steps before `PyO3/maturin-action`: - `Setup Rust toolchain` - `Cache Rust artifacts` Linux maturin builds may run inside the manylinux Docker container, where the host `target/` cache is not expected to help. Windows and macOS build on the host, so `swatinem/rust-cache` can restore Cargo artifacts for the expensive maturin compile. The cache uses a dedicated bindings key, and its `save-if` behavior matches the existing CI cache discipline: PRs may restore cache entries, but only `main` pushes create new ones. ## Are these changes tested? - Not run locally; this is a GitHub Actions workflow-only change. Co-authored-by: Abanoub Doss <abanoub.doss@gmail.com>
1 parent be6cc96 commit 25197f4

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/bindings_python_ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ jobs:
8282
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
8383
with:
8484
python-version: 3.12
85+
# Linux maturin builds may run inside manylinux Docker, so host Rust caches only help Windows/macOS.
86+
- name: Setup Rust toolchain
87+
if: runner.os != 'Linux'
88+
uses: ./.github/actions/setup-builder
89+
- name: Cache Rust artifacts
90+
if: runner.os != 'Linux'
91+
uses: swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
92+
with:
93+
key: bindings-python
94+
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
8595
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
8696
with:
8797
working-directory: "bindings/python"

0 commit comments

Comments
 (0)