Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

setup sccache action #19

Open
lopopolo opened this issue Nov 25, 2019 · 3 comments
Open

setup sccache action #19

lopopolo opened this issue Nov 25, 2019 · 3 comments

Comments

@lopopolo
Copy link

On CircleCI I make use of sccache on Debian and Windows and it speeds up my builds significantly.

sccache is a RUSTC_WRAPPER that supports caching crates across builds to a on-disk cache that can be limited in size.

I install it on Linux like: https://github.com/artichoke/artichoke/blob/95a94f82326561914e27aac9c14f606aed01c8b1/.circleci/config.yml#L18-L26

and on Windows like: https://github.com/artichoke/artichoke/blob/95a94f82326561914e27aac9c14f606aed01c8b1/.circleci/config.yml#L56-L63

The cache is restored at the beginning of a build like: https://github.com/artichoke/artichoke/blob/95a94f82326561914e27aac9c14f606aed01c8b1/.circleci/config.yml#L137-L139

and saved at the end of a build like: https://github.com/artichoke/artichoke/blob/95a94f82326561914e27aac9c14f606aed01c8b1/.circleci/config.yml#L158-L162

@svartalf
Copy link
Member

svartalf commented Nov 27, 2019

I feel like at this point it would be easier to use https://github.com/actions/cache (see an example), but yes, adding the sccache support would be nice.

But, same to #15, this thing is blocked by #21.

@chris13524
Copy link

actions/cache doesn't support sharing build cache between multiple Cargo workspaces: https://doc.rust-lang.org/cargo/guide/build-cache.html#shared-cache

@luser
Copy link

luser commented Oct 26, 2022

Persisting an on-disk sccache cache directory via GitHub Actions' caching mechanism mostly defeats the purpose of using sccache. For CI, sccache can be pointed at a cloud storage bucket as the cache location, and it will fetch cached outputs as needed, as well as upload build outputs for cache misses. This bucket can be shared across branches and build configurations, since sccache is careful to include all build inputs when calculating a cache key.

An on-disk cache directory can be size-limited, but to get a reasonable hit rate that still means you're likely to accumulate a large number of object files which your CI will waste time downloading and uploading, instead of allowing sccache to fetch and store only the build outputs required for the current build.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants