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

Apply caching for enclave CI build #2156

Merged
merged 85 commits into from
Sep 25, 2023
Merged

Apply caching for enclave CI build #2156

merged 85 commits into from
Sep 25, 2023

Conversation

Kailai-Wang
Copy link
Collaborator

@Kailai-Wang Kailai-Wang commented Sep 22, 2023

Context

resolves #2140

This PR applies the caching mechanism to the enclave builds in CI after some research:

  • as written in the issue, buildx GHA cache + cache mount won't work, as the cache mount won't be considered as docker layers and thus can't be persisted via buildx cache
  • buildkit-cache-dance doesn't work reliably, sometimes I get empty sccache folder - see the comments in ci.yml
  • cargo-chef is proven to be unsuitable for all cases

Here's an informative summary of the problem and its background, including possible solutions(workarounds): https://hackmd.io/@kobzol/S17NS71bh

In this PR, a plain copy in/out of cached data to/from docker image is performed and persisted via the official action/cache GHA. Things that are cached:

  • $CARGO_HOME/registry/index
  • $CARGO_HOME/registry/cache
  • $CARGO_HOME/git/db
  • sccache artifacts

Apart from that, this PR uses a few more techs to make it possible/more efficient:

  • free up disk space
  • a local-stash to store the caching only
  • local registry pushing
  • compressed docker export

Working example: this is a re-run with small changes to the original code:
https://github.com/litentry/litentry-parachain/actions/runs/6274181997/job/17039285320

Compilation was done within 15min, and this is the sccache stats:
image

There are still a few TODOs, I'll create follow-up issues.

Copy link
Member

@kziemianek kziemianek left a comment

Choose a reason for hiding this comment

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

Great work. In general it looks fine to me, just one small comment which can be resolved in separate PR if really needed..

.github/workflows/ci.yml Show resolved Hide resolved
Copy link
Collaborator

@BillyWooo BillyWooo left a comment

Choose a reason for hiding this comment

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

👍 great work.

@Kailai-Wang Kailai-Wang merged commit c4e4db0 into dev Sep 25, 2023
28 checks passed
@Kailai-Wang Kailai-Wang deleted the 2140-cache-in-ci branch September 25, 2023 13:24
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.

(Re-)Apply cache in CI builds
3 participants