Skip to content

Commit

Permalink
add github actions caching
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/sapling#1005

Speed up github builds with github actions CI caching based on the cache-key mechanism already present in getdeps.

Cached fizz windows build completed in 22% of original time,  linux build in 54% of the original time,  and mac in 72% of original time.  This saves a lot of waiting around for PR builds on OSS changes as windows signal is usually the lagging one.  Speed ups will vary across the different Meta OSS projects.

Windows benefits most from caching dependencies as we don't use system packages there at all,  linux next as its default runner is slower than mac, and then finaly mac (the strongest hardware of the default github runners).

Github allows [up to 10GB cache per repo](https://github.blog/changelog/2021-11-23-github-actions-cache-size-is-now-increased-to-10gb-per-repository/), expiring data over capacity.  You can see the size of the caches generated in the [caches view of githhub actions UX](https://github.com/ahornby/fizz/actions/caches?query=sort%3Asize-desc),  looks like our usage is pretty small so far.

More background:
Github actions caching decides its own compression format (currently it prefers zstd), but they are free to change that in future, hence no .zstd suffix or similar on the cache keys.

Github actions caches from main are used from feature branches but not vice versa, hence a PR can't pollute cache for the trunk build.  This allows us to benefit from caching on main and PRs where dependency versions match.

The final item being built, and dependencies inside the same repo as the final are not cached.  A different mechanism would be necessary for those (e.g. using a tool like ccache/sccache or caching cargo/buck2 output).  This means that when building EdenFS, sapling could not be cached (its in the same repo), but folly could be as we have a key for it based on the folly-rev.txt file.

When there is a cache hit the build step is skipped using extension of the conditionals introduced in previous diff D67839708

Reviewed By: bigfootjon

Differential Revision: D67839730

fbshipit-source-id: c384a216eb27ccd3f816e3c31b167232bda571a6
  • Loading branch information
ahornby authored and facebook-github-bot committed Jan 6, 2025
1 parent 8b7a794 commit 10343e2
Show file tree
Hide file tree
Showing 5 changed files with 1,070 additions and 78 deletions.
Loading

0 comments on commit 10343e2

Please sign in to comment.