From 9db4a04cd9388be022c9a9491a770c9433efdd2a Mon Sep 17 00:00:00 2001 From: Keith Williams Date: Wed, 14 Jun 2023 15:27:47 -0300 Subject: [PATCH] chore: Cache node_modules (#9492) * Adding check for cache hit * Adding a separate install step first * Put the restore cache steps back * Revert the uses type for restoring cache * Added step to restore nm cache * Removed the cache-hit check * Comments and naming * Removed extra install command * Updated the name of the linting step to be more clear --- .github/actions/yarn-install/action.yml | 9 +++++++++ .github/workflows/lint.yml | 2 +- .github/workflows/pr.yml | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/actions/yarn-install/action.yml b/.github/actions/yarn-install/action.yml index 216cdce6de..0ce62d3871 100644 --- a/.github/actions/yarn-install/action.yml +++ b/.github/actions/yarn-install/action.yml @@ -40,6 +40,14 @@ runs: restore-keys: | yarn-download-cache- + # Invalidated on yarn.lock changes + - name: Restore node_modules + id: yarn-nm-cache + uses: buildjet/cache@v3 + with: + path: "**/node_modules/" + key: ${{ runner.os }}-yarn-nm-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }} + # Invalidated on yarn.lock changes - name: Restore yarn install state id: yarn-install-state-cache @@ -58,5 +66,6 @@ runs: YARN_ENABLE_IMMUTABLE_INSTALLS: "false" # So it doesn't try to remove our private submodule deps YARN_ENABLE_GLOBAL_CACHE: "false" # Use local cache folder to keep downloaded archives YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz # Very small speedup when lock does not change + YARN_NM_MODE: "hardlinks-local" # Reduce node_modules size # Other environment variables HUSKY: "0" # By default do not run HUSKY install diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b566168d0a..47a5c19102 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v3 - uses: ./.github/actions/dangerous-git-checkout - uses: ./.github/actions/yarn-install - - name: Save Code Linting Reports + - name: Run Linting with Reports run: yarn lint:report continue-on-error: true diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e42cc70e91..7bba9c794c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -16,6 +16,7 @@ concurrency: jobs: changes: + name: Detect changes runs-on: buildjet-4vcpu-ubuntu-2204 permissions: pull-requests: read