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(repair broken cached-checkout-install step) #1454

Merged
merged 8 commits into from
Nov 21, 2024

Conversation

Spencer6497
Copy link
Contributor

This PR fixes a bug where npm ci was being called every time cached-checkout-install was being called, regardless if node_modules was found in the cache or not. This should reduce our pipeline times by a considerable amount :)

@@ -14,16 +14,14 @@ runs:
env:
cache-name: cache-node-modules
with:
path: ~/.npm
path: ./node_modules
Copy link
Member

Choose a reason for hiding this comment

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

fyi https://github.com/actions/cache/blob/main/examples.md#node---npm

Note It is not recommended to cache node_modules, as it can break across Node versions and won't work with npm ci

Copy link
Contributor Author

Choose a reason for hiding this comment

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

saw that; two thoughts:

  1. to avoid this breaking across Node versions, we could hash the node version and add it to the key
  2. npm ci only runs on a cache miss, so node_modules won't exist in that case

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for the explanation. I checked the build time for all previous pull requests and didn't see any significant improvement. Am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's a slight speedup for pull requests, but PRs only trigger the first 3 steps of the CI flow; every other step also uses cached-checkout-install, so full deployments should be faster by a few minutes, maybe 3 or so

Copy link
Contributor

@aaschlote aaschlote left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

sonarcloud bot commented Nov 21, 2024

@Spencer6497 Spencer6497 merged commit 4231a98 into main Nov 21, 2024
21 checks passed
@Spencer6497 Spencer6497 deleted the fix-gha-cached-install branch November 21, 2024 07: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.

3 participants