Skip to content

Commit 76bdd21

Browse files
committed
ci: add node_modules caching to speed up workflow jobs
- Cache node_modules, redisinsight/node_modules, and redisinsight/api/node_modules - Skip yarn install when cache is restored - Use restore-keys for cross-branch cache fallback
1 parent 8b961df commit 76bdd21

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

.github/actions/install-all-build-libs/action.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ runs:
3939
cache: ${{ runner.os != 'Windows' && 'yarn' || '' }}
4040
cache-dependency-path: ${{ runner.os != 'Windows' && '**/yarn.lock' || '' }}
4141

42+
- name: Cache node_modules
43+
id: cache-node-modules
44+
uses: actions/cache@v4
45+
with:
46+
path: |
47+
node_modules
48+
redisinsight/node_modules
49+
redisinsight/api/node_modules
50+
key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock', 'redisinsight/yarn.lock', 'redisinsight/api/yarn.lock') }}
51+
restore-keys: |
52+
node-modules-${{ runner.os }}-
53+
4254
- name: Setup Python
4355
# if: ${{ contains(inputs.skip-electron-deps, '1') }}
4456
uses: actions/setup-python@v5
@@ -60,24 +72,23 @@ runs:
6072
run: |
6173
brew install libsecret
6274
63-
# TODO: matrix?
64-
# Javascript dependencies
75+
# Javascript dependencies (skip if cache was restored)
6576
- name: Install dependencies for redisinsight package.js
66-
# if: ${{ contains(inputs.skip-electron-deps, '1') }}
77+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
6778
uses: ./.github/actions/install-deps
6879
with:
6980
dir-path: './redisinsight'
7081
keytar-host-mirror: ${{ inputs.keytar-host-mirror }}
7182
sqlite3-host-mirror: ${{ inputs.sqlite3-host-mirror }}
7283

7384
- name: Install dependencies for BE package.js
74-
# if: ${{ !contains(inputs.skip-backend-deps, '1') }}
85+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
7586
uses: ./.github/actions/install-deps
7687
with:
7788
dir-path: './redisinsight/api'
7889

7990
- name: Install dependencies for root package.js
80-
# if: ${{ contains(inputs.skip-electron-deps, '1') }}
91+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
8192
uses: ./.github/actions/install-deps
8293
with:
8394
dir-path: './'

0 commit comments

Comments
 (0)