Skip to content

Commit 7fea151

Browse files
ci: cache node_modules and aw-tauri cargo target to reduce build times
- Cache node_modules directly instead of npm global cache. The global cache only saves download time, but npm ci still does a full install into node_modules every run (~5-7 min per npm ci call). Caching node_modules directly skips this entirely on cache hit. - Cache aw-tauri/src-tauri/target alongside aw-server-rust/target in the Tauri workflow. The Tauri Cargo release build takes ~8 min uncached and was not being cached previously. - Also cache aw-tauri/node_modules in the Tauri workflow (has its own package-lock.json separate from aw-webui). Expected improvement: ~15-20 min savings on cached Windows Tauri builds (from ~34 min to ~15 min).
1 parent 278a864 commit 7fea151

File tree

2 files changed

+15
-25
lines changed

2 files changed

+15
-25
lines changed

.github/workflows/build-tauri.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,25 @@ jobs:
6969
with:
7070
toolchain: stable
7171

72-
- name: Get npm cache dir
73-
id: npm-cache-dir
74-
run: |
75-
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
76-
77-
- uses: actions/cache@v4
78-
name: Cache npm
72+
- name: Cache node_modules
73+
uses: actions/cache@v4
7974
if: ${{ !matrix.skip_webui }}
80-
env:
81-
cache-name: node
8275
with:
83-
path: ${{ steps.npm-cache-dir.outputs.dir }}
84-
key: ${{ matrix.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
76+
path: |
77+
aw-server-rust/aw-webui/node_modules
78+
aw-tauri/node_modules
79+
key: ${{ matrix.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
8580
restore-keys: |
86-
${{ matrix.os }}-${{ env.cache-name }}-
81+
${{ matrix.os }}-node_modules-
8782
8883
- name: Cache cargo build
8984
uses: actions/cache@v4
9085
env:
9186
cache-name: cargo-build-target
9287
with:
93-
path: aw-server-rust/target
88+
path: |
89+
aw-server-rust/target
90+
aw-tauri/src-tauri/target
9491
key: ${{ matrix.os }}-${{ env.cache-name }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
9592
restore-keys: |
9693
${{ matrix.os }}-${{ env.cache-name }}-${{ steps.toolchain.outputs.rustc_hash }}-

.github/workflows/build.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,14 @@ jobs:
7070
with:
7171
toolchain: stable
7272

73-
- name: Get npm cache dir
74-
id: npm-cache-dir
75-
run: |
76-
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
77-
78-
- uses: actions/cache@v4
79-
name: Cache npm
73+
- name: Cache node_modules
74+
uses: actions/cache@v4
8075
if: ${{ !matrix.skip_webui }}
81-
env:
82-
cache-name: node
8376
with:
84-
path: ${{ steps.npm-cache-dir.outputs.dir }}
85-
key: ${{ matrix.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
77+
path: aw-server-rust/aw-webui/node_modules
78+
key: ${{ matrix.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
8679
restore-keys: |
87-
${{ matrix.os }}-${{ env.cache-name }}-
80+
${{ matrix.os }}-node_modules-
8881
8982
- name: Cache cargo build
9083
uses: actions/cache@v4

0 commit comments

Comments
 (0)