chore(ci): add rust dependency caching with rust-cache action #265
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.
Description
I made some changes to reduce the
ci.yml
time for Rust tests.Closes #218
How are the changes test-covered
The changes made are as follows:
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.
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 fromSwatinem/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.