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

Adjust cache for cargo #439

Merged
merged 11 commits into from
Jun 28, 2023
Merged

Adjust cache for cargo #439

merged 11 commits into from
Jun 28, 2023

Conversation

citizen-stig
Copy link
Member

@citizen-stig citizen-stig commented Jun 28, 2023

Short summary

  • Add Swatinem/rust-cache@v2 before sccache, so we can combine crates/target cache with recompilation.
  • Adjust macro tests to not require native flag
  • change assert!(matches!()) to assert_eq!()
  • Switch to use latest sccache instead of hard coded.

Description

Currently we use sccache for caching compilation. and it helps, especially with rocksdb, as it can cache not only rust compilation artifacts, but also C/C++.

But it looks like cargo download dependencies everytime and scacche does not handle it that well.

So idea is to put sccache on top of standard rust caching mechanism.

Iteration Check Test Coverage Features Check Prover
1 (empty cache) 13m 23m 23m 30m 45m
2 9 m 19m 20m 23m 22m
3 (add cache for target) 12m 26m 20m 25m 24m
4 2m 7m 20m 3m 10m
5 1m 9m 10m 4m 14m
6 (adjust macro test) 12m 15m 17m 28m 16m
7 1m 9m 7m 3m 10m

Macro tests

Current macro tests use native flag for testing compilation, which brings compilation of rocksdb second time inside macro test.
I've changed the tests to operate on ZK conteext and ZK storage, as it require less dependencies.

Future improvements

Things that can be done to make CI even smoother:

  1. Set check step to be the first and rest depend on it, so it doesn't waste runner's time if it fails
  2. Figure out why llvm-cov spends 10 minutes recompiling.
  3. tune SCCACHE_CACHE_SIZE to get best results
  4. Try cargo-nextest

@citizen-stig citizen-stig self-assigned this Jun 28, 2023
@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Merging #439 (d117eef) into main (524dd2a) will decrease coverage by 0.2%.
The diff coverage is 98.2%.

❗ Current head d117eef differs from pull request most recent head e8f2f1e. Consider uploading reports for the commit e8f2f1e to get more accurate results

Impacted Files Coverage Δ
...implementations/sov-sequencer-registry/src/call.rs 94.2% <94.2%> (ø)
...m/module-implementations/sov-accounts/src/hooks.rs 92.5% <100.0%> (ø)
...lementations/sov-sequencer-registry/src/genesis.rs 100.0% <100.0%> (ø)
...mplementations/sov-sequencer-registry/src/hooks.rs 100.0% <100.0%> (+6.2%) ⬆️
...-implementations/sov-sequencer-registry/src/lib.rs 97.9% <100.0%> (+9.0%) ⬆️
...mplementations/sov-sequencer-registry/src/query.rs 75.0% <100.0%> (-7.7%) ⬇️
...ystem/sov-modules-stf-template/src/app_template.rs 82.6% <100.0%> (+1.0%) ⬆️
module-system/sov-modules-stf-template/src/lib.rs 97.4% <100.0%> (ø)

... and 3 files with indirect coverage changes

@citizen-stig citizen-stig changed the title Check cache for cargo? Adjust cache for cargo Jun 28, 2023
@citizen-stig citizen-stig marked this pull request as ready for review June 28, 2023 13:49
Copy link
Member

@neysofu neysofu left a comment

Choose a reason for hiding this comment

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

The benchmarks are very impressive and all changes make sense to me. It would be nice to include a timeout (1h?) for our GH jobs, to save compute in case the CI gets stuck (it doesn't look like it happens at all by glancing at our Actions history but it's a good fail-safe to have, especially since we're doing proptests).

@citizen-stig
Copy link
Member Author

The benchmarks are very impressive and all changes make sense to me. It would be nice to include a timeout (1h?) for our GH jobs, to save compute in case the CI gets stuck (it doesn't look like it happens at all by glancing at our Actions history but it's a good fail-safe to have, especially since we're doing proptests).

Agree, done!

@citizen-stig citizen-stig merged commit e76f442 into main Jun 28, 2023
@citizen-stig citizen-stig deleted the ci/try_to_speed_up_cache branch June 28, 2023 15:23
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.

3 participants