Enable GitHub Actions Yarn Caching (#1332)

Summary:
We sometimes see workflows fail due to network flakiness, almost always being Windows agents doing a `yarn install`. This change enables storing and reusing Yarn's package cache, and makes `yarn install` more permissive when it does hit the network. https://stackoverflow.com/questions/51508364/yarn-there-appears-to-be-trouble-with-your-network-connection-retrying

Pull Request resolved: https://github.com/facebook/yoga/pull/1332

Test Plan: Workflows succeed, and we see cache being restored before yarn install step.

Reviewed By: lunaleaps

Differential Revision: D48967590

Pulled By: NickGerleman

fbshipit-source-id: 55ce6f05496f014512e0153b6646a7ca0ab964d9
This commit is contained in:
Nick Gerleman
2023-09-05 10:27:27 -07:00
committed by Facebook GitHub Bot
parent 65ae809d5d
commit 95a7b4497e
3 changed files with 22 additions and 13 deletions

View File

@@ -3,17 +3,22 @@ name: Setup JavaScript envirionment
runs:
using: "composite"
steps:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install emsdk
uses: ./.github/actions/install-emsdk
- name: Install Ninja
uses: ./.github/actions/install-ninja
- name: Setup Node environment
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn
cache-dependency-path: yarn.lock
env:
# https://github.com/actions/setup-node/issues/317
FORCE_COLOR: 0
- name: yarn install
shell: bash
run: yarn install --frozen-lockfile

View File

@@ -5,14 +5,19 @@ runs:
steps:
# TODO: Update to latest when website is moved to the workspace version of
# yoga-layout
- name: Install Node
uses: actions/setup-node@v1
- name: Setup Node environment
uses: actions/setup-node@v3
with:
node-version: 12.x
cache: yarn
cache-dependency-path: website/yarn.lock
env:
# https://github.com/actions/setup-node/issues/317
FORCE_COLOR: 0
# TODO: the website should be in a yarn workspace with the library, but the
# current version of gatsby is incompatible with hoisting.
- name: yarn install
shell: bash
run: yarn install --frozen-lockfile
run: yarn install --frozen-lockfile --network-timeout 1000000
working-directory: website