Skip to content

Add caching to workflows#620

Open
sfc-gh-pbulawa wants to merge 5 commits intomainfrom
pbulawa/test-speedup
Open

Add caching to workflows#620
sfc-gh-pbulawa wants to merge 5 commits intomainfrom
pbulawa/test-speedup

Conversation

@sfc-gh-pbulawa
Copy link
Contributor

@sfc-gh-pbulawa sfc-gh-pbulawa commented Mar 19, 2026

TL;DR

Upgraded GitHub Actions cache to v5 and added comprehensive Rust build artifact caching across all CI workflows to improve build performance, plus introduced a new build_sf_core job to eliminate redundant Rust compilation in Python wheel builds.

What changed?

Cache Action Upgrades:

  • Upgraded actions/cache@v4 to actions/cache@v5 across pre-commit.yml, test-python.yml workflows and documentation

New Rust Build Caching:

  • test-jdbc.yml: Added Cargo registry and target directory caching with rust-jdbc-target key
  • test-odbc.yml: Added caching for unit tests (rust-odbc-unit-target), integration tests (rust-odbc-target), and C++ ODBC test builds (cpp-odbc-tests)
  • test-rust-core.yml: Added specialized caching for clippy (rust-clippy-target), no-protobuf builds (rust-no-protobuf-target), core tests (rust-core-test-target), and ARM64 builds (rust-arm64-nonfips-target)

Python Workflow Optimization:

  • Added new build_sf_core job that builds the Rust library once per platform and shares it via artifacts
  • Modified build_wheel job to download pre-built sf_core instead of compiling it for each Python version
  • Added SKIP_CORE_BUILD=true environment variable and proto generator target caching
  • Updated Python build script to support CORE_CARGO_TARGET_DIR for stable target directories

Build Script Enhancement:

  • Modified python/hatch_build.py to use stable target directories when CORE_CARGO_TARGET_DIR is set, enabling incremental compilation and CI caching

Each cache configuration stores ~/.cargo/registry, ~/.cargo/git, and target directories with OS-specific keys based on Cargo.lock hash and includes fallback restore keys for broader cache reuse.

How to test?

Run the existing CI workflows and verify:

  1. Cache creation occurs on first workflow run
  2. Subsequent runs show cache hits and significantly faster build times
  3. The new build_sf_core job successfully builds and uploads artifacts
  4. Python wheel builds download and use pre-built sf_core libraries
  5. All existing tests continue to pass without issues
  6. Cache keys are properly differentiated between different job types

Why make this change?

Caching Rust build artifacts dramatically reduces CI build times by avoiding recompilation of dependencies and previously built code. The new build_sf_core job eliminates ~12-17 minutes of redundant Rust compilation per Python version in the build matrix. This leads to faster feedback cycles, reduced resource usage, and improved developer productivity. The upgrade to cache v5 provides better performance and reliability.

Copilot AI review requested due to automatic review settings March 19, 2026 11:37
Copy link
Contributor Author

sfc-gh-pbulawa commented Mar 19, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge_queue - adds this PR to the back of the merge queue
  • priority_merge_queue - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sfc-gh-pbulawa sfc-gh-pbulawa changed the title Add cache Add Rust build artifact caching to CI workflows Mar 19, 2026
@sfc-gh-pbulawa sfc-gh-pbulawa marked this pull request as ready for review March 19, 2026 11:37
@sfc-gh-pbulawa sfc-gh-pbulawa requested a review from a team as a code owner March 19, 2026 11:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Rust build caching to multiple CI workflows to reduce repeated dependency downloads and rebuild time across runs.

Changes:

  • Add actions/cache@v4 steps caching Cargo registries (~/.cargo/registry, ~/.cargo/git) and the workspace target/ directory in Rust core, ODBC, and JDBC workflows.
  • Standardize cache step naming and update cache keys for Rust core test lanes (including Windows ARM64).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
.github/workflows/test-rust-core.yml Adds per-job Rust caches for clippy, feature-variant builds, coverage tests, and Windows ARM64 lane.
.github/workflows/test-odbc.yml Adds Rust caches to ODBC unit tests and multi-OS ODBC test matrix jobs.
.github/workflows/test-jdbc.yml Adds a Rust cache to the JDBC full-suite test job.

You can also share your feedback on Copilot code review. Take the survey.

Copilot AI review requested due to automatic review settings March 19, 2026 12:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds GitHub Actions caching to speed up CI by reusing Rust build artifacts (and, for ODBC, C++ test build outputs) across workflow runs.

Changes:

  • Added actions/cache@v4 steps to cache Rust Cargo registries (~/.cargo/registry, ~/.cargo/git) and build outputs (target) in Rust core, JDBC, and ODBC workflows.
  • Replaced/standardized existing Rust cache steps in test-rust-core.yml with lane-specific cache keys and restore keys.
  • Added caching for odbc_tests/cmake-build in ODBC test workflows.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
.github/workflows/test-rust-core.yml Adds/updates Rust build artifact caching across clippy, build-without-protobuf, core tests, and Windows ARM64 non-FIPS lanes.
.github/workflows/test-odbc.yml Adds Rust build artifact caching to ODBC unit/integration lanes and caches C++ ODBC test build directory.
.github/workflows/test-jdbc.yml Adds Rust build artifact caching for JDBC CI lane.

You can also share your feedback on Copilot code review. Take the survey.

Copilot AI review requested due to automatic review settings March 19, 2026 12:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR speeds up CI by introducing (and updating) GitHub Actions caching for build artifacts—primarily for Rust workflows—so repeated runs can reuse the Cargo registry and target/ outputs instead of rebuilding everything from scratch.

Changes:

  • Added caching of Cargo registry (~/.cargo/registry, ~/.cargo/git) and Rust target/ outputs in Rust-heavy CI workflows (test-rust-core.yml, test-odbc.yml, test-jdbc.yml) with job-specific cache keys.
  • Added caching for the C++ ODBC test build directory (odbc_tests/cmake-build) in test-odbc.yml.
  • Updated actions/cache usage from @v4 to @v5 in multiple workflows/docs (including Python and pre-commit workflows).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
doc/woa64/ADR-woa64.md Updates the (stale) example snippet to reference actions/cache@v5.
.github/workflows/test-rust-core.yml Adds separate caches for Cargo registry and target/ across Rust core lanes; updates tarpaulin cache action version.
.github/workflows/test-python.yml Updates uv cache restore steps to use actions/cache@v5.
.github/workflows/test-odbc.yml Adds Cargo registry + target/ caching for Rust ODBC builds and caches odbc_tests/cmake-build for C++ ODBC tests.
.github/workflows/test-jdbc.yml Adds Cargo registry + target/ caching ahead of Rust builds for JDBC CI.
.github/workflows/pre-commit.yml Updates Rust and pre-commit hook caching steps to use actions/cache@v5.

You can also share your feedback on Copilot code review. Take the survey.

@sfc-gh-pbulawa sfc-gh-pbulawa changed the base branch from main to graphite-base/620 March 19, 2026 13:29
@sfc-gh-pbulawa sfc-gh-pbulawa changed the base branch from graphite-base/620 to pbulawa/fix-does-not-exist March 19, 2026 13:29
@sfc-gh-pbulawa sfc-gh-pbulawa mentioned this pull request Mar 19, 2026
@sfc-gh-pbulawa sfc-gh-pbulawa changed the base branch from pbulawa/fix-does-not-exist to graphite-base/620 March 19, 2026 13:53
@sfc-gh-pbulawa sfc-gh-pbulawa force-pushed the graphite-base/620 branch 2 times, most recently from 7d47d9e to dea4ea0 Compare March 19, 2026 15:30
@sfc-gh-pbulawa sfc-gh-pbulawa force-pushed the pbulawa/test-speedup branch 5 times, most recently from b4bf252 to 4ea309a Compare March 20, 2026 10:37
@sfc-gh-pbulawa sfc-gh-pbulawa force-pushed the pbulawa/test-speedup branch 2 times, most recently from f960b42 to e25b266 Compare March 20, 2026 12:08
@graphite-app graphite-app bot force-pushed the pbulawa/test-speedup branch from 3a45dc7 to b2517bb Compare March 20, 2026 13:38
@graphite-app graphite-app bot force-pushed the graphite-base/620 branch from 74cd987 to 61b43b1 Compare March 20, 2026 13:38
@graphite-app graphite-app bot changed the base branch from graphite-base/620 to main March 20, 2026 13:39
@graphite-app graphite-app bot force-pushed the pbulawa/test-speedup branch from b2517bb to 0d2fa64 Compare March 20, 2026 13:39
Copilot AI review requested due to automatic review settings March 20, 2026 14:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves CI performance by adding/standardizing caching for Rust build artifacts in GitHub Actions workflows and by allowing the Python build hook to use a stable Cargo target directory (enabling incremental compilation and CI cache reuse).

Changes:

  • Added Cargo registry (~/.cargo/registry, ~/.cargo/git) and Rust target directory caching to Rust-heavy CI workflows.
  • Updated multiple workflows/docs to use actions/cache@v5.
  • Updated python/hatch_build.py to optionally use CORE_CARGO_TARGET_DIR for a stable Rust build output directory (instead of always using a temporary directory).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
python/hatch_build.py Adds support for stable Cargo target dir (CORE_CARGO_TARGET_DIR) to enable incremental builds/caching.
doc/woa64/ADR-woa64.md Updates cache action reference from @v4 to @v5 in documentation snippet.
.github/workflows/test-rust-core.yml Introduces separate caches for Cargo registry and target across core Rust jobs, using actions/cache@v5.
.github/workflows/test-python.yml Adds a shared sf_core build job and proto/vcpkg caching; also upgrades uv cache steps to actions/cache@v5.
.github/workflows/test-odbc.yml Adds Cargo registry and target caching plus caching for C++ ODBC test build outputs.
.github/workflows/test-jdbc.yml Adds Cargo registry and target caching for JDBC workflow runs.
.github/workflows/pre-commit.yml Upgrades cache steps to actions/cache@v5.

Copilot AI review requested due to automatic review settings March 20, 2026 14:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

@sfc-gh-pbulawa sfc-gh-pbulawa changed the title Add Rust build artifact caching to CI workflows Add caching to workflows Mar 20, 2026
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