3131
3232 - name : Install Node.js
3333 run : |
34- curl -fsSL https://rpm.nodesource.com/setup_18 .x | bash -
34+ curl -fsSL https://rpm.nodesource.com/setup_20 .x | bash -
3535 yum install -y nodejs
3636
3737 - name : Setup Zig
@@ -53,13 +53,43 @@ jobs:
5353 echo "CXXFLAGS=-fPIC -fno-sanitize=undefined" >> "$GITHUB_ENV"
5454 echo "LDFLAGS=-static-libstdc++ -static-libgcc -fno-sanitize=undefined" >> "$GITHUB_ENV"
5555
56+ - name : Cache npm dependencies
57+ uses : actions/cache@v4
58+ with :
59+ path : node_modules
60+ key : npm-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('package-lock.json') }}
61+ restore-keys : |
62+ npm-${{ runner.os }}-${{ env.ZIG_TARGET }}-
63+
64+ - name : Cache RocketMQ native deps
65+ uses : actions/cache@v4
66+ with :
67+ path : |
68+ deps/rocketmq/bin
69+ deps/rocketmq/libs/signature/lib
70+ deps/rocketmq/tmp_down_dir
71+ key : rocketmq-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('deps/rocketmq/build.sh', 'deps/rocketmq/CMakeLists.txt') }}
72+ restore-keys : |
73+ rocketmq-${{ runner.os }}-${{ env.ZIG_TARGET }}-
74+
75+ - name : Cache addon build
76+ id : cache-addon
77+ uses : actions/cache@v4
78+ with :
79+ path : build/rocketmq.node
80+ key : addon-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('lib/**', 'CMakeLists.txt', 'package.json') }}
81+ restore-keys : |
82+ addon-${{ runner.os }}-${{ env.ZIG_TARGET }}-
83+
5684 - name : Install npm dependencies
5785 run : npm install --no-audit --prefer-offline
5886
5987 - name : Build RocketMQ native deps
88+ if : steps.cache-addon.outputs.cache-hit != 'true'
6089 run : ./deps/rocketmq/build.sh
6190
6291 - name : Build addon
92+ if : steps.cache-addon.outputs.cache-hit != 'true'
6393 run : npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release
6494
6595 - name : Package artifact
89119
90120 - name : Install Node.js
91121 run : |
92- curl -fsSL https://rpm.nodesource.com/setup_18 .x | bash -
122+ curl -fsSL https://rpm.nodesource.com/setup_20 .x | bash -
93123 yum install -y nodejs
94124
95125 - name : Setup Zig
@@ -111,13 +141,43 @@ jobs:
111141 echo "CXXFLAGS=-fPIC -fno-sanitize=undefined" >> "$GITHUB_ENV"
112142 echo "LDFLAGS=-static-libstdc++ -static-libgcc -fno-sanitize=undefined" >> "$GITHUB_ENV"
113143
144+ - name : Cache npm dependencies
145+ uses : actions/cache@v4
146+ with :
147+ path : node_modules
148+ key : npm-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('package-lock.json') }}
149+ restore-keys : |
150+ npm-${{ runner.os }}-${{ env.ZIG_TARGET }}-
151+
152+ - name : Cache RocketMQ native deps
153+ uses : actions/cache@v4
154+ with :
155+ path : |
156+ deps/rocketmq/bin
157+ deps/rocketmq/libs/signature/lib
158+ deps/rocketmq/tmp_down_dir
159+ key : rocketmq-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('deps/rocketmq/build.sh', 'deps/rocketmq/CMakeLists.txt') }}
160+ restore-keys : |
161+ rocketmq-${{ runner.os }}-${{ env.ZIG_TARGET }}-
162+
163+ - name : Cache addon build
164+ id : cache-addon
165+ uses : actions/cache@v4
166+ with :
167+ path : build/rocketmq.node
168+ key : addon-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('lib/**', 'CMakeLists.txt', 'package.json') }}
169+ restore-keys : |
170+ addon-${{ runner.os }}-${{ env.ZIG_TARGET }}-
171+
114172 - name : Install npm dependencies
115173 run : npm install --no-audit --prefer-offline
116174
117175 - name : Build RocketMQ native deps
176+ if : steps.cache-addon.outputs.cache-hit != 'true'
118177 run : ./deps/rocketmq/build.sh
119178
120179 - name : Build addon
180+ if : steps.cache-addon.outputs.cache-hit != 'true'
121181 run : npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release
122182
123183 - name : Package artifact
@@ -135,15 +195,15 @@ jobs:
135195 linux-musl-x64 :
136196 runs-on : ubuntu-24.04
137197 container :
138- image : alpine:latest
198+ image : node:20-alpine
139199 env :
140200 ZIG_TARGET : x86_64-linux-musl
141201 steps :
142202 - name : Checkout
143203 uses : actions/checkout@v4
144204
145205 - name : Install system dependencies
146- run : apk add --no-cache nodejs npm bash build-base cmake ninja python3 curl unzip git autoconf automake libtool pkgconfig
206+ run : apk add --no-cache bash build-base cmake ninja python3 curl unzip git autoconf automake libtool pkgconfig
147207
148208 - name : Setup Zig
149209 uses : mlugg/setup-zig@v2
@@ -164,13 +224,43 @@ jobs:
164224 echo "CXXFLAGS=-fPIC -fno-sanitize=undefined" >> "$GITHUB_ENV"
165225 echo "LDFLAGS=-static-libstdc++ -static-libgcc -fno-sanitize=undefined" >> "$GITHUB_ENV"
166226
227+ - name : Cache npm dependencies
228+ uses : actions/cache@v4
229+ with :
230+ path : node_modules
231+ key : npm-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('package-lock.json') }}
232+ restore-keys : |
233+ npm-${{ runner.os }}-
234+
235+ - name : Cache RocketMQ native deps
236+ uses : actions/cache@v4
237+ with :
238+ path : |
239+ deps/rocketmq/bin
240+ deps/rocketmq/libs/signature/lib
241+ deps/rocketmq/tmp_down_dir
242+ key : rocketmq-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('deps/rocketmq/build.sh', 'deps/rocketmq/CMakeLists.txt') }}
243+ restore-keys : |
244+ rocketmq-${{ runner.os }}-
245+
246+ - name : Cache addon build
247+ id : cache-addon
248+ uses : actions/cache@v4
249+ with :
250+ path : build/rocketmq.node
251+ key : addon-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('lib/**', 'CMakeLists.txt', 'package.json') }}
252+ restore-keys : |
253+ addon-${{ runner.os }}-
254+
167255 - name : Install npm dependencies
168256 run : npm install --no-audit --prefer-offline
169257
170258 - name : Build RocketMQ native deps
259+ if : steps.cache-addon.outputs.cache-hit != 'true'
171260 run : ./deps/rocketmq/build.sh
172261
173262 - name : Build addon
263+ if : steps.cache-addon.outputs.cache-hit != 'true'
174264 run : npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release
175265
176266 - name : Package artifact
@@ -196,7 +286,7 @@ jobs:
196286 - name : Setup Node.js
197287 uses : actions/setup-node@v4
198288 with :
199- node-version : 18
289+ node-version : 20
200290
201291 - name : Install system dependencies
202292 run : sudo apt-get update && sudo apt-get install -y build-essential cmake ninja-build python3 curl unzip git autoconf automake libtool pkg-config
@@ -220,13 +310,43 @@ jobs:
220310 echo "CXXFLAGS=-fPIC -fno-sanitize=undefined" >> "$GITHUB_ENV"
221311 echo "LDFLAGS=-static-libstdc++ -static-libgcc -fno-sanitize=undefined" >> "$GITHUB_ENV"
222312
313+ - name : Cache npm dependencies
314+ uses : actions/cache@v4
315+ with :
316+ path : node_modules
317+ key : npm-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('package-lock.json') }}
318+ restore-keys : |
319+ npm-${{ runner.os }}-
320+
321+ - name : Cache RocketMQ native deps
322+ uses : actions/cache@v4
323+ with :
324+ path : |
325+ deps/rocketmq/bin
326+ deps/rocketmq/libs/signature/lib
327+ deps/rocketmq/tmp_down_dir
328+ key : rocketmq-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('deps/rocketmq/build.sh', 'deps/rocketmq/CMakeLists.txt') }}
329+ restore-keys : |
330+ rocketmq-${{ runner.os }}-
331+
332+ - name : Cache addon build
333+ id : cache-addon
334+ uses : actions/cache@v4
335+ with :
336+ path : build/rocketmq.node
337+ key : addon-${{ runner.os }}-${{ env.ZIG_TARGET }}-${{ hashFiles('lib/**', 'CMakeLists.txt', 'package.json') }}
338+ restore-keys : |
339+ addon-${{ runner.os }}-
340+
223341 - name : Install npm dependencies
224342 run : npm install --no-audit --prefer-offline
225343
226344 - name : Build RocketMQ native deps
345+ if : steps.cache-addon.outputs.cache-hit != 'true'
227346 run : ./deps/rocketmq/build.sh
228347
229348 - name : Build addon
349+ if : steps.cache-addon.outputs.cache-hit != 'true'
230350 run : npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release
231351
232352 - name : Package artifact
@@ -250,18 +370,48 @@ jobs:
250370 - name : Setup Node.js
251371 uses : actions/setup-node@v4
252372 with :
253- node-version : 18
373+ node-version : 20
254374
255375 - name : Install build tools
256376 run : brew install cmake ninja xz autoconf automake libtool pkg-config
257377
378+ - name : Cache npm dependencies
379+ uses : actions/cache@v4
380+ with :
381+ path : node_modules
382+ key : npm-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
383+ restore-keys : |
384+ npm-${{ runner.os }}-
385+
386+ - name : Cache RocketMQ native deps
387+ uses : actions/cache@v4
388+ with :
389+ path : |
390+ deps/rocketmq/bin
391+ deps/rocketmq/libs/signature/lib
392+ deps/rocketmq/tmp_down_dir
393+ key : rocketmq-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('deps/rocketmq/build.sh', 'deps/rocketmq/CMakeLists.txt') }}
394+ restore-keys : |
395+ rocketmq-${{ runner.os }}-
396+
397+ - name : Cache addon build
398+ id : cache-addon
399+ uses : actions/cache@v4
400+ with :
401+ path : build/rocketmq.node
402+ key : addon-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('lib/**', 'CMakeLists.txt', 'package.json') }}
403+ restore-keys : |
404+ addon-${{ runner.os }}-
405+
258406 - name : Install npm dependencies
259407 run : npm install --no-audit --prefer-offline
260408
261409 - name : Build RocketMQ native deps
410+ if : steps.cache-addon.outputs.cache-hit != 'true'
262411 run : ./deps/rocketmq/build.sh
263412
264413 - name : Build addon
414+ if : steps.cache-addon.outputs.cache-hit != 'true'
265415 run : |
266416 npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release \
267417 --CDCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
@@ -323,7 +473,7 @@ jobs:
323473 - name : Setup Node.js
324474 uses : actions/setup-node@v4
325475 with :
326- node-version : 18
476+ node-version : 20
327477 registry-url : ' https://registry.npmjs.org'
328478
329479 - name : Download all artifacts
0 commit comments