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

Sccache doesn't seem to work in CI #935

Closed
Kailai-Wang opened this issue Nov 6, 2022 · 3 comments · Fixed by #937
Closed

Sccache doesn't seem to work in CI #935

Kailai-Wang opened this issue Nov 6, 2022 · 3 comments · Fixed by #937
Assignees
Labels
D2-bug Something isn't working I3-high should be completed within 5 working days

Comments

@Kailai-Wang
Copy link
Collaborator

Context

I notice that sccache doesn't seem to take effect, an example: https://github.com/litentry/litentry-parachain/actions/runs/3405980852

Even if I re-run the job without changing anything, where I expect the run-cargo-runtime-tests to complete quickly, it still did a full compilation.

Strangely, the cargo registry and sccache cache were restored successfully:

Cache restored successfully
Cache restored from key: cargo-7cca616f672081f386280a7525ace5640c511a4aebda45281f073c7e8c5e3007
Cache restored successfully
Cache restored from key: sccache-7cca616f672081f386280a7525ace5640c511a4aebda45281f073c7e8c5e3007

It just didn't get applied.

In the sccache stat, it showed:
image

Note the cache hit were all C/C++.

Once it's solved, the next step is to try to use sccache inside docker


✔️ Please set appropriate labels and assignees if applicable.

@Kailai-Wang Kailai-Wang added D2-bug Something isn't working I3-high should be completed within 5 working days labels Nov 6, 2022
@Kailai-Wang Kailai-Wang self-assigned this Nov 6, 2022
@Kailai-Wang
Copy link
Collaborator Author

Seemingly it's due to the hashing key of sccache for the cargo-unittest: hash of Cargo.lock files are not enough, especially for the incremental building of the same feature branch.

We can have finer control over it by adjusting the cache key: including the branch/tag name looks helpful: https://github.com/litentry/litentry-parachain/actions/runs/3409984123/jobs/5672416950#step:9:16

For PRs we use the github.base_ref as part of the key trying to increase the accuracy of the cache

@Kailai-Wang
Copy link
Collaborator Author

sccache inside docker looks not bad:
image

@Kailai-Wang
Copy link
Collaborator Author

but please note it only works with the consistent runner (self-hosted).

Conclusion so far regarding caching:

  • sccache inside docker for self-hosted runner
  • cargo-chef + GHA gha/local cache for github runner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D2-bug Something isn't working I3-high should be completed within 5 working days
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant