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

fix(ci): share GitHub runner caches between branches #4149

Merged
merged 2 commits into from
Apr 21, 2022

Conversation

teor2345
Copy link
Contributor

Motivation

Our Linux and macOS builds using GitHub runners are very slow the first time we open a PR on a new branch, because they aren't using any caches.

We need to build the Zcash parameter and Rust caches on the main branch, if we want them to be available to newly
created branches.

This should give us a massive performance improvement the first time we open a PR for a new branch.

Specifications

A workflow can access and restore a cache created in the current branch, the base branch (including base branches of forked repositories), or the default branch (usually main). For example, a cache created on the default branch would be accessible from any pull request. Also, if the branch feature-b has the base branch feature-a, a workflow triggered on feature-b would have access to caches created in the default branch (main), feature-a, and feature-b.

Access restrictions provide cache isolation and security by creating a logical boundary between different branches. For example, a cache created for the branch feature-a (with the base main) would not be accessible to a pull request for the branch feature-b (with the base main).

https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache

Solution

  • Run the CI and lint jobs on the main branch
  • Cache the clippy job Rust dependencies

This is a quick fix, we can probably do better later.

Review

Anyone can review this PR.

I'd like @gustavovalverde to check that I got this right.

Reviewer Checklist

  • CI passes
  • Configs match specs

@teor2345 teor2345 added A-devops Area: Pipelines, CI/CD and Dockerfiles C-enhancement Category: This is an improvement P-High 🔥 I-slow Problems with performance or responsiveness labels Apr 19, 2022
@teor2345 teor2345 requested a review from a team as a code owner April 19, 2022 23:25
@teor2345 teor2345 self-assigned this Apr 19, 2022
@teor2345 teor2345 changed the title Fix shared GitHub caches fix(ci): share GitHub runner caches between branches Apr 19, 2022
@teor2345 teor2345 removed the request for review from a team April 19, 2022 23:27
Copy link
Member

@gustavovalverde gustavovalverde left a comment

Choose a reason for hiding this comment

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

LGTM!

mergify bot added a commit that referenced this pull request Apr 21, 2022
@mergify mergify bot merged commit 5575b7a into main Apr 21, 2022
@mergify mergify bot deleted the fix-shared-github-caches branch April 21, 2022 00:33
@teor2345 teor2345 mentioned this pull request Apr 21, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-devops Area: Pipelines, CI/CD and Dockerfiles C-enhancement Category: This is an improvement I-slow Problems with performance or responsiveness
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants