From 1bc67d51abee79800bf0a9db8569485dfcf688a2 Mon Sep 17 00:00:00 2001 From: Carson Full Date: Wed, 25 Oct 2023 12:14:18 -0500 Subject: [PATCH] Change yarn caching in GitHub Actions to allow partial caching Previously it was all or nothing, so a single change will have to re-download everything. Now it works the same as local, only downloading the one new package. --- .github/actions/setup/action.yml | 22 ++++++++++++++++++++++ .github/workflows/ci.yml | 11 +++++------ 2 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 .github/actions/setup/action.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000000..a0e205936f --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,22 @@ +name: Node Setup & Yarn Install +description: 'Setup Node.js and install dependencies with Yarn' +runs: + using: composite + steps: + - uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: Yarn cache + uses: actions/cache@v3 + with: + path: .yarn/cache + key: yarn-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }} + restore-keys: yarn-cache- + + - name: Install dependencies + shell: bash + run: yarn install + env: + # Use the local cache folder, so we can cache it above + YARN_ENABLE_GLOBAL_CACHE: 'false' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3ff4ce278..f9b24c7aba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,13 +21,12 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 20 - cache: yarn - - name: Install dependencies - run: yarn install && yarn dedupe --check + - name: Node Setup & Yarn Install + uses: ./.github/actions/setup + + - name: Check for no duplicate dependencies + run: yarn dedupe --check - name: Match API PR uses: actions-ecosystem/action-regex-match@v2