ci: enable Rust build artifact caching in Python tests#143
Merged
Conversation
Fix Rust cache configuration to properly cache compiled artifacts. This should significantly reduce the maturin develop step time in CI by reusing cached builds when Rust code hasn't changed. Changes: - Set correct workspace path to crates/lance-graph-python - Remove cache-targets: false to enable artifact caching (defaults to true) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configure all workflows to share a single Rust dependency cache using shared-key. This allows different workflows to reuse compiled artifacts for dependencies like Arrow, DataFusion, Tokio, and aws-lc-sys. Changes: - Add shared-key: "lance-graph-deps" to all rust-cache configurations - Include both crates/lance-graph and crates/lance-graph-python workspaces - Remove cache-targets: false to enable target directory caching - Apply to: python-test.yml, build.yml, rust-test.yml, style.yml Expected impact: - First workflow run compiles dependencies and populates shared cache - Subsequent workflows (even different ones) reuse cached dependencies - Massive time savings: 5+ min build → <1 min for unchanged dependencies Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This trivial change will test if the shared Rust cache is working. Expected: Build time should drop from 23min to <2min.
Root cause: CARGO_INCREMENTAL=0 was preventing cargo from reusing any cached compilation artifacts, making rust-cache ineffective. Setting CARGO_INCREMENTAL=1 allows cargo to: - Reuse compiled .rlib files from cache - Skip recompiling unchanged dependencies - Dramatically reduce build times (5min -> <1min expected) Applied to: python-test.yml, build.yml, rust-test.yml Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Skip editable install during dependency setup to avoid building Rust extension twice. The workflow was: 1. uv pip install -e .[tests] → builds Rust (18 min) 2. maturin develop → builds Rust again (5 min) Now only maturin develop builds once, reducing CI time from 24min to ~6min. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove nightly toolchain testing to prevent upstream dependency breakage from blocking PRs. This matches the upstream lance project's approach, which only uses nightly for specific jobs (coverage). Current issue: shellexpand v3.1.1 fails to compile on nightly Rust with type mismatch errors. Since this is a transitive dependency, we cannot fix it directly. Benefits: - Prevents nightly breakage from blocking PRs - Follows upstream lance pattern - Stable toolchain is the primary target anyway Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Set CARGO_INCREMENTAL=0 explicitly since rust-cache overrides it to 0 anyway. This makes the intention clear and matches the CI convention. Incremental compilation artifacts are not useful in CI because: - They're workspace-specific (only help with unchanged code) - rust-cache only caches dependencies, not workspace code - Workspace code changes every commit - Creating incremental artifacts wastes time/space Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ChunxuTang
approved these changes
Feb 24, 2026
beinan
added a commit
to lance-format/lance-context
that referenced
this pull request
Mar 4, 2026
#43) ## Summary Apply learnings from [lance-graph#143](lance-format/lance-graph#143) to dramatically improve CI performance. That PR achieved a **74% speedup (24min → 6min)** in Python tests through better caching and eliminating duplicate builds. ## Changes ### 1. Shared Rust Cache Across All Workflows ⭐ - Switched from manual `cache@v4` to `Swatinem/rust-cache@v2` - Added `shared-key: "lance-context-deps"` to all workflows - **Impact**: Prevents duplicate compilation of Rust dependencies across Python, Rust, and Style workflows - Cache is now shared across all jobs instead of being isolated ### 2. Remove Nightly from Test Matrix - Only test on `stable` toolchain (matches upstream lance project) - **Impact**: ~50% reduction in Rust test time, prevents nightly breakage from blocking PRs - Stable is the primary deployment target ### 3. Standardize CARGO_INCREMENTAL=0 - Added to `python-test.yml` (was missing) - Added to `style.yml` (was missing) - Already present in `rust-test.yml` - **Impact**: Consistent CI environment, no wasted incremental compilation artifacts ### 4. Optimized Cache Configuration - Removed `CARGO_TARGET_DIR` override (rust-cache handles this better) - Standardized workspaces across all workflows to include both `crates/lance-context-core` and `python` - **Impact**: Better cache hit rates and management ## Expected Performance Impact Based on the improvements seen in lance-graph: - ✅ Reduced duplicate Rust compilations via shared cache key - ✅ Faster CI runs with streamlined test matrix - ✅ Better cache efficiency with rust-cache action - ✅ Consistent build environment across all workflows ## Test Plan - [x] All workflow files updated consistently - [ ] Verify CI passes with new caching strategy - [ ] Monitor CI times to confirm performance improvement 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <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.
Summary
Optimize CI workflows to dramatically reduce build times through improved caching and build configuration.
Changes
1. Shared Rust Dependency Cache
shared-key: "lance-graph-deps"to all workflowscrates/lance-graphandcrates/lance-graph-pythonworkspaces2. Fix Double Rust Build in Python Tests
uv pip install -e .[tests]which was triggering Rust compilationmaturin developbuilds the extension once3. Remove Nightly from Rust Test Matrix
4. Explicit CARGO_INCREMENTAL=0
Performance Impact
Before:
After:
Test Results
All CI checks passing:
🤖 Generated with Claude Code