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

Add cache action to lint workflow #4517

Merged
merged 3 commits into from
Nov 21, 2023
Merged

Add cache action to lint workflow #4517

merged 3 commits into from
Nov 21, 2023

Conversation

JKarlavige
Copy link
Collaborator

@JKarlavige JKarlavige commented Nov 20, 2023

What are you changing in this pull request and why?

Adds caching to lint workflow to attempt to reduce bandwidth usage in Vercel. This also speeds up the workflow checks for Docs PRs as it no longer needs to wait to install all packages on each run.

Initial run where node mods was cached (Under Post Cache Node Modules)
https://github.com/dbt-labs/docs.getdbt.com/actions/runs/6936641309/job/18869155154

2nd run where lint workflow detects and uses cache (Under Cache Node Modules)
https://github.com/dbt-labs/docs.getdbt.com/actions/runs/6936659386/job/18869211562

Ensure site is not nuked:
https://docs-getdbt-com-git-cache-node-mods-ci-dbt-labs.vercel.app/

Copy link

vercel bot commented Nov 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-getdbt-com ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 20, 2023 10:49pm

@github-actions github-actions bot added the size: x-small This change will take under 3 hours to fix. label Nov 20, 2023
@github-actions github-actions bot added size: small This change will take 1 to 2 days to address and removed size: x-small This change will take under 3 hours to fix. labels Nov 20, 2023
@JKarlavige JKarlavige marked this pull request as ready for review November 20, 2023 22:43
@JKarlavige JKarlavige requested a review from a team as a code owner November 20, 2023 22:43
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was in the root and was likely added by accident by running npm i in the root.

@JKarlavige JKarlavige requested review from a team, breezyfasano and john-rock and removed request for a team November 20, 2023 22:51
Copy link
Contributor

@john-rock john-rock left a comment

Choose a reason for hiding this comment

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

This is awesome and lgtm!

Quick Q: How does it know when to hit the cache vs. when to not? Is it based off what packages get installed?

@JKarlavige
Copy link
Collaborator Author

This is awesome and lgtm!

Quick Q: How does it know when to hit the cache vs. when to not? Is it based off what packages get installed?

Yeah that's correct, the line key: node-modules-cache-v3-${{ hashFiles('**/package.json', '**/package-lock.json') }} hashes everything in package.json and package-lock.json. When a package is added/removed/updated it will detect these files have changed and will invalidate the cache to do a fresh install.

@JKarlavige JKarlavige merged commit 390f3c2 into current Nov 21, 2023
6 checks passed
@JKarlavige JKarlavige deleted the cache-node-mods-ci branch November 21, 2023 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: small This change will take 1 to 2 days to address
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants