diff --git a/.github/workflows/studio-build-non-production.yml b/.github/workflows/studio-build-non-production.yml index 77fdb091b..e792d7edf 100644 --- a/.github/workflows/studio-build-non-production.yml +++ b/.github/workflows/studio-build-non-production.yml @@ -87,12 +87,24 @@ jobs: uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' - cache: yarn + + - name: Cache node_modules + id: cache-nm + uses: actions/cache@v4 + with: + path: | + node_modules + apps/studio/node_modules + apps/ui-kit/node_modules + apps/sqltools/node_modules + key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.nvmrc') }}-${{ hashFiles('yarn.lock') }} - name: Clean cache + if: steps.cache-nm.outputs.cache-hit != 'true' run: yarn cache clean - name: Check dependencies + if: steps.cache-nm.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' }} diff --git a/.github/workflows/studio-publish.yml b/.github/workflows/studio-publish.yml index 52c2235dc..d6604cfc4 100644 --- a/.github/workflows/studio-publish.yml +++ b/.github/workflows/studio-publish.yml @@ -225,13 +225,24 @@ jobs: uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' - cache: yarn + + - name: Cache node_modules + id: cache-nm + uses: actions/cache@v4 + with: + path: | + node_modules + apps/studio/node_modules + apps/ui-kit/node_modules + apps/sqltools/node_modules + key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.nvmrc') }}-${{ hashFiles('yarn.lock') }} - name: Install Snapcraft uses: samuelmeuli/action-snapcraft@v3 if: matrix.os.type == 'linux' && matrix.os.arch != 'arm64' - name: Clean cache + if: steps.cache-nm.outputs.cache-hit != 'true' run: yarn cache clean --all # FIXME (matthew) Windows needs retries. It sometimes fails to build @@ -239,6 +250,7 @@ jobs: # But only sometimes. I cannot figure out why. # Someone should at some point. - name: yarn install (with retry) + if: steps.cache-nm.outputs.cache-hit != 'true' uses: nick-fields/retry@v2 with: timeout_minutes: 20 diff --git a/.github/workflows/studio-test.yml b/.github/workflows/studio-test.yml index e38a9d3ae..ed2560176 100644 --- a/.github/workflows/studio-test.yml +++ b/.github/workflows/studio-test.yml @@ -49,7 +49,7 @@ jobs: apps/studio/node_modules apps/ui-kit/node_modules apps/sqltools/node_modules - key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node-modules-${{ runner.os }}-${{ hashFiles('.nvmrc') }}-${{ hashFiles('yarn.lock') }} - name: Install dependencies if: steps.cache-nm.outputs.cache-hit != 'true' @@ -83,7 +83,7 @@ jobs: apps/studio/node_modules apps/ui-kit/node_modules apps/sqltools/node_modules - key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node-modules-${{ runner.os }}-${{ hashFiles('.nvmrc') }}-${{ hashFiles('yarn.lock') }} fail-on-cache-miss: true - name: Lint @@ -137,7 +137,7 @@ jobs: apps/studio/node_modules apps/ui-kit/node_modules apps/sqltools/node_modules - key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node-modules-${{ runner.os }}-${{ hashFiles('.nvmrc') }}-${{ hashFiles('yarn.lock') }} fail-on-cache-miss: true - name: Install libaio (for oracle) @@ -202,7 +202,7 @@ jobs: apps/studio/node_modules apps/ui-kit/node_modules apps/sqltools/node_modules - key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node-modules-${{ runner.os }}-${{ hashFiles('.nvmrc') }}-${{ hashFiles('yarn.lock') }} fail-on-cache-miss: true - name: Start postgres container