Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): add rust dependency caching with rust-cache action #265

Merged
merged 1 commit into from
Jan 26, 2025

Conversation

K-dash
Copy link
Contributor

@K-dash K-dash commented Jan 26, 2025

Description

I made some changes to reduce the ci.yml time for Rust tests.

Closes #218

How are the changes test-covered

  • N/A
  • Automated tests (unit and/or integration tests)
  • Manual tests
    • Details are described below

The changes made are as follows:

  1. Added the Swatinem/rust-cache action.
    This allows us to cache dependencies and build artifacts so repeated builds can skip redownloading or recompiling crates that are unchanged.

  2. Added the --skip-clean argument to tarpaulin.
    By default, tarpaulin behaves as if --force-clean is set, which deletes existing build artifacts and prevents reuse of cached builds.
    With --skip-clean, the cached artifacts from Swatinem/rust-cache can be used before running tests.
    (See Tarpaulin documentation on recompilation for details.)

Below are some CI logs from my fork that demonstrate how the caching works under different conditions:

  • First CI run
    Full build is required since there is no cache yet.
    Once complete, a cache is stored.
    1. Link to the GitHub Actions log

  • Second CI run (minor code changes in crates/core/src/config/error.rs but no new dependencies)
    We only added a comment in the source code, so no dependencies were modified.
    This means the cached artifacts are still valid and the test build is fast.
    2. Link to the GitHub Actions log

  • Third CI run (added a new dependency in python/Cargo.toml)
    The python crate is rebuilt, but other crates (core, hudi, etc.) remain cached.
    3. Link to the GitHub Actions log

Please review these changes and let me know if you have any questions.

@xushiyan xushiyan added the ci label Jan 26, 2025
@xushiyan xushiyan added this to the release-0.3.0 milestone Jan 26, 2025
@xushiyan xushiyan changed the title feat: adding rust dependency caching with rust-cache action chore(ci): add rust dependency caching with rust-cache action Jan 26, 2025
Copy link

codecov bot commented Jan 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.26%. Comparing base (04fe00d) to head (4ae1e7b).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #265      +/-   ##
==========================================
+ Coverage   91.20%   91.26%   +0.06%     
==========================================
  Files          40       41       +1     
  Lines        1967     2015      +48     
==========================================
+ Hits         1794     1839      +45     
- Misses        173      176       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@xushiyan xushiyan left a comment

Choose a reason for hiding this comment

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

LGTM!

@xushiyan xushiyan merged commit 1d08d14 into apache:main Jan 26, 2025
11 checks passed
@K-dash K-dash deleted the feat/optimize-ci-build-for-rust branch January 27, 2025 04:13
@xushiyan xushiyan mentioned this pull request Jan 30, 2025
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce CI build time for rust test
2 participants