ci: cache node_modules across CI builds

Use actions/cache to cache all three node_modules directories
(root, apps/studio, apps/ui-kit) keyed on OS and yarn.lock hash.
Skip yarn install when cache hits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthew Rathbone
2026-03-06 15:53:47 -06:00
parent 7d5bf67937
commit 119009a6bc
2 changed files with 21 additions and 5 deletions

View File

@@ -89,10 +89,18 @@ jobs:
node-version-file: '.nvmrc'
cache: yarn
- name: Clean cache
run: yarn cache clean
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
apps/studio/node_modules
apps/ui-kit/node_modules
key: node-modules-${{ matrix.os }}-${{ hashFiles('yarn.lock') }}
- name: Check dependencies
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: "yarn install --frozen-lockfile --network-timeout 100000"
env:
npm_config_node_gyp: ${{ github.workspace }}${{ runner.os == 'Windows' && '\node_modules\node-gyp\bin\node-gyp.js' || '/node_modules/node-gyp/bin/node-gyp.js' }}

View File

@@ -220,14 +220,22 @@ jobs:
uses: samuelmeuli/action-snapcraft@v3
if: matrix.os.type == 'linux'
- name: Clean cache
run: yarn cache clean --all
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
apps/studio/node_modules
apps/ui-kit/node_modules
key: node-modules-${{ matrix.os.name }}-${{ hashFiles('yarn.lock') }}
# FIXME (matthew) Windows needs retries. It sometimes fails to build
# the native oracledb package.
# But only sometimes. I cannot figure out why.
# Someone should at some point.
- name: yarn install (with retry)
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
with:
timeout_minutes: 20