Skip to content

Commit 7f7a65c

Browse files
app/vmui: update GitHub Actions for vmui workflows: optimize caching and dependency installation process
1 parent 82df166 commit 7f7a65c

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

.github/workflows/vmui.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,24 @@ jobs:
3232
- name: Code checkout
3333
uses: actions/checkout@v6
3434

35-
- name: Cache node-modules
36-
uses: actions/cache@v5
35+
- name: Restore node_modules cache
36+
id: cache-restore
37+
uses: actions/cache/restore@v5
3738
with:
38-
path: |
39-
app/vmui/packages/vmui/node_modules
40-
key: vmui-artifacts-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
41-
restore-keys: vmui-artifacts-${{ runner.os }}-
39+
path: app/vmui/packages/vmui/node_modules
40+
key: vmui-deps-${{ runner.os }}-${{ hashFiles('app/vmui/packages/vmui/package-lock.json') }}
41+
restore-keys: |
42+
vmui-deps-${{ runner.os }}-
43+
44+
- name: Install dependencies
45+
run: make vmui-install
46+
47+
- name: Save node_modules cache
48+
if: steps.cache-restore.outputs.cache-hit != 'true'
49+
uses: actions/cache/save@v5
50+
with:
51+
path: app/vmui/packages/vmui/node_modules
52+
key: vmui-deps-${{ runner.os }}-${{ hashFiles('app/vmui/packages/vmui/package-lock.json') }}
4253

4354
- name: Run lint
4455
id: lint

app/vmui/Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ vmui-run-npm-command: vmui-package-base-image
77
--mount type=bind,src="$(shell pwd)/docs",dst=/docs \
88
-w /build/packages/vmui \
99
--entrypoint=/bin/bash \
10-
vmui-builder-image -c "npm install && $(NPM_COMMAND)"
10+
vmui-builder-image -c "npm ci && $(NPM_COMMAND)"
11+
12+
vmui-install:
13+
NPM_COMMAND="true" $(MAKE) vmui-run-npm-command
1114

1215
vmui-package-base-image:
1316
docker build -t vmui-builder-image -f app/vmui/Dockerfile-build ./app/vmui
@@ -22,14 +25,11 @@ vmui-build:
2225
vmui-update: vmui-build
2326
rm -rf app/vlselect/vmui/* && mv app/vmui/packages/vmui/build/* app/vlselect/vmui && rm -rf app/vlselect/vmui/dashboards
2427

25-
vmui-install-dependencies:
26-
NPM_COMMAND="npm ci" $(MAKE) vmui-run-npm-command
27-
28-
vmui-lint: vmui-install-dependencies
28+
vmui-lint:
2929
NPM_COMMAND="npm run lint" $(MAKE) vmui-run-npm-command
3030

31-
vmui-typecheck: vmui-install-dependencies
31+
vmui-typecheck:
3232
NPM_COMMAND="npm run typecheck" $(MAKE) vmui-run-npm-command
3333

34-
vmui-test: vmui-install-dependencies
34+
vmui-test:
3535
NPM_COMMAND="npm run test" $(MAKE) vmui-run-npm-command

0 commit comments

Comments
 (0)