Skip to content

Commit acb4c25

Browse files
beinanclaude
andauthored
ci: enable Rust build artifact caching in Python tests (#143)
## Summary Optimize CI workflows to dramatically reduce build times through improved caching and build configuration. ## Changes ### 1. Shared Rust Dependency Cache - Added `shared-key: "lance-graph-deps"` to all workflows - Cache is shared across Python, Rust, Build, and Style workflows - Include both `crates/lance-graph` and `crates/lance-graph-python` workspaces - Prevents duplicate compilation across different workflows ### 2. Fix Double Rust Build in Python Tests - Removed `uv pip install -e .[tests]` which was triggering Rust compilation - Now only `maturin develop` builds the extension once - **Result: 24 min → 6 min (74% faster!)** ### 3. Remove Nightly from Rust Test Matrix - Only test on stable toolchain (matches upstream lance project) - Prevents nightly breakage from blocking PRs - Stable is the primary deployment target ### 4. Explicit CARGO_INCREMENTAL=0 - Set explicitly for CI (rust-cache overrides to 0 anyway) - Makes intention clear: incremental artifacts not useful in CI ## Performance Impact **Before:** - Python Tests: ~24 minutes - Rust compiled twice (18min + 5min) - No cache sharing across workflows **After:** - Python Tests: **6 minutes (74% faster)** ✅ - Rust compiled once (5min) - Shared cache across all workflows ## Test Results All CI checks passing: - ✅ Python Tests (test 3.11) - 6 minutes - ✅ Rust Tests (stable) - ✅ Rust Coverage - ✅ Build (stable) - ✅ All Linters (clippy, format, Python lint, spell check) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7f46f8c commit acb4c25

4 files changed

Lines changed: 23 additions & 11 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ jobs:
3636
rustup default ${{ matrix.toolchain }}
3737
- uses: Swatinem/rust-cache@v2
3838
with:
39-
workspaces: crates/lance-graph
40-
cache-targets: false
39+
shared-key: "lance-graph-deps"
40+
workspaces: |
41+
crates/lance-graph
42+
crates/lance-graph-python
4143
- name: Install dependencies
4244
run: |
4345
sudo apt update

.github/workflows/python-test.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ concurrency:
1818
env:
1919
CARGO_TERM_COLOR: always
2020
RUSTFLAGS: "-C debuginfo=1"
21+
CARGO_INCREMENTAL: "0"
2122

2223
jobs:
2324
test:
@@ -36,8 +37,10 @@ jobs:
3637
uses: actions-rust-lang/setup-rust-toolchain@v1
3738
- uses: Swatinem/rust-cache@v2
3839
with:
39-
workspaces: python
40-
cache-targets: false
40+
shared-key: "lance-graph-deps"
41+
workspaces: |
42+
crates/lance-graph
43+
crates/lance-graph-python
4144
- name: Install dependencies
4245
run: |
4346
sudo apt update
@@ -50,7 +53,8 @@ jobs:
5053
uv venv
5154
source .venv/bin/activate
5255
uv pip install maturin[patchelf]
53-
uv pip install -e .[tests]
56+
# Install test dependencies only (skip editable install to avoid double-building Rust)
57+
uv pip install pytest pyarrow pandas ruff
5458
- name: Build Python extension
5559
working-directory: python
5660
run: |

.github/workflows/rust-test.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
matrix:
2929
toolchain:
3030
- stable
31-
- nightly
3231
steps:
3332
- uses: actions/checkout@v4
3433
- name: Setup rust toolchain
@@ -37,8 +36,10 @@ jobs:
3736
rustup default ${{ matrix.toolchain }}
3837
- uses: Swatinem/rust-cache@v2
3938
with:
40-
workspaces: crates/lance-graph
41-
cache-targets: false
39+
shared-key: "lance-graph-deps"
40+
workspaces: |
41+
crates/lance-graph
42+
crates/lance-graph-python
4243
- name: Install dependencies
4344
run: |
4445
sudo apt update
@@ -61,8 +62,10 @@ jobs:
6162
rustup default stable
6263
- uses: Swatinem/rust-cache@v2
6364
with:
64-
workspaces: crates/lance-graph
65-
cache-targets: false
65+
shared-key: "lance-graph-deps"
66+
workspaces: |
67+
crates/lance-graph
68+
crates/lance-graph-python
6669
- name: Install dependencies
6770
run: |
6871
sudo apt update

.github/workflows/style.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ jobs:
3737
- uses: actions/checkout@v4
3838
- uses: Swatinem/rust-cache@v2
3939
with:
40-
workspaces: crates/lance-graph
40+
shared-key: "lance-graph-deps"
41+
workspaces: |
42+
crates/lance-graph
43+
crates/lance-graph-python
4144
- name: Install dependencies
4245
run: |
4346
sudo apt update

0 commit comments

Comments
 (0)