Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Cache yarn in CI (#65946)

Fraser5a8ec6631ab9
diff --git a/.github/actions/prepare-frontend/action.yml b/.github/actions/prepare-frontend/action.yml
index ad655d6a1eb..e8e303e8182 100644
--- a/.github/actions/prepare-frontend/action.yml
+++ b/.github/actions/prepare-frontend/action.yml
@@ -6,7 +6,7 @@ inputs:
apply-patches:
description: "Whether to patch frontend dependencies with patch-package."
required: true
- default: 'true'
+ default: "true"
runs:
using: "composite"
steps:
@@ -28,11 +28,21 @@ runs:
~/.gitlibs
key: ${{ steps.get-cache-keys.outputs.m2-cache-key }}
+ - name: Get yarn cache directory
+ id: yarn-cache-dir
+ run: |
+ YARN_CACHE_DIR=$(yarn cache dir)
+ echo "Yarn cache directory: $YARN_CACHE_DIR"
+ echo "dir=$YARN_CACHE_DIR" >> $GITHUB_OUTPUT
+ shell: bash
+
- name: Restore node_modules cache
uses: actions/cache/restore@v4
id: node-modules-cache
with:
- path: node_modules
+ path: |
+ ${{ steps.yarn-cache-dir.outputs.dir }}
+ node_modules
key: ${{ steps.get-cache-keys.outputs.node-cache-key }}
# postinstall lifecycle hook can be dangerous in CI so we only run it locally (see package.json)
diff --git a/.github/workflows/cache-generator.yml b/.github/workflows/cache-generator.yml
index 999056c5289..d9f5f30ed84 100644
--- a/.github/workflows/cache-generator.yml
+++ b/.github/workflows/cache-generator.yml
@@ -94,10 +94,19 @@ jobs:
with:
apply-patches: 'false'
+ - name: Get yarn cache directory
+ id: yarn-cache-dir
+ run: |
+ YARN_CACHE_DIR=$(yarn cache dir)
+ echo "Yarn cache directory: $YARN_CACHE_DIR"
+ echo "dir=$YARN_CACHE_DIR" >> $GITHUB_OUTPUT
+
- name: Update node_modules cache
uses: ./.github/actions/update-cache
with:
- path: node_modules
+ path: |
+ ${{ steps.yarn-cache-dir.outputs.dir }}
+ node_modules
key: ${{ env.NODE_CACHE_KEY }}
- name: Update eslint cache