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

misc: use cache in ci.yml #854

Merged
merged 1 commit into from
Mar 6, 2023
Merged

misc: use cache in ci.yml #854

merged 1 commit into from
Mar 6, 2023

Conversation

jongwooo
Copy link
Contributor

@jongwooo jongwooo commented Dec 19, 2022

Signed-off-by: jongwooo [email protected]

Summary

Updated workflows to cache dependencies using actions/setup-node. setup-node@v3 or newer has caching built-in.

About caching workflow dependencies

Jobs on GitHub-hosted runners start in a clean virtual environment and must download dependencies each time, causing increased network utilization, longer runtime, and increased cost. To help speed up the time it takes to recreate files like dependencies, GitHub can cache files that frequently use in workflows.

Solutions

Node.js projects can run faster on GitHub Actions by enabling dependency caching on the setup-node action.

AS-IS

- name: Use Node.js 16.x
  uses: actions/setup-node@v1
  with:
    node-version: 16.x
- run: yarn

TO-BE

- name: Use Node.js 16.x
  uses: actions/setup-node@v3
  with:
    node-version: 16.x
    cache: yarn
- run: yarn install --frozen-lockfile

It’s literally a one line change to pass the cache: yarn input parameter.

Related Issues/PRs

N/A

References

@Hill8488
Copy link

Signed-off-by: jongwooo [email protected]

Summary

Updated workflows to cache dependencies using actions/setup-node. setup-node@v3 or newer has caching built-in.

About caching workflow dependencies

Jobs on GitHub-hosted runners start in a clean virtual environment and must download dependencies each time, causing increased network utilization, longer runtime, and increased cost. To help speed up the time it takes to recreate files like dependencies, GitHub can cache files that frequently use in workflows.

Solutions

Node.js projects can run faster on GitHub Actions by enabling dependency caching on the setup-node action.

AS-IS

- name: Use Node.js 16.x
  uses: actions/setup-node@v1
  with:
    node-version: 16.x
- run: yarn

TO-BE

- name: Use Node.js 16.x
  uses: actions/setup-node@v3
  with:
    node-version: 16.x
    cache: yarn
- run: yarn install --frozen-lockfile

It’s literally a one line change to pass the cache: yarn input parameter.

Related Issues/PRs

N/A

References

I'm on you Scotty

@paulirish paulirish merged commit 617a436 into GoogleChrome:main Mar 6, 2023
@paulirish
Copy link
Member

thx @jongwooo

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