@@ -3,77 +3,105 @@ name: Build Addons
33on :
44 push :
55 branches :
6- - main
6+ - master
77 pull_request :
88
99jobs :
1010 linux-gnu :
1111 runs-on : ubuntu-latest
12+ container :
13+ image : alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:latest
1214 steps :
15+ - name : Install prerequisites
16+ run : |
17+ set -eux
18+ yum install -y git curl wget xz tar unzip rsync which python3 python3-pip python3-setuptools autoconf automake libtool pkgconfig gcc gcc-c++ make ninja-build cmake file gdb strace vim procps-ng iputils
19+
1320 - name : Checkout
1421 uses : actions/checkout@v4
1522
16- - name : Setup Node.js
17- uses : actions/setup-node@v4
18- with :
19- node-version : 20
20-
21- - name : Install system dependencies
23+ - name : Install Node.js via NodeSource
2224 run : |
23- sudo apt-get update
24- sudo apt-get install -y build-essential cmake ninja-build python3 unzip curl
25+ set -eux
26+ curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -
27+ yum install -y nodejs
28+ node -v
29+ npm -v
2530
2631 - name : Install npm dependencies
27- run : npm ci
32+ run : |
33+ set -eux
34+ npm install --no-audit --prefer-offline
2835
2936 - name : Build RocketMQ native deps
30- run : ./deps/rocketmq/build.sh
37+ run : |
38+ set -eux
39+ ./deps/rocketmq/build.sh
3140
3241 - name : Build addon (glibc)
33- run : npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release
42+ run : |
43+ set -eux
44+ npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release
45+
46+ - name : Detect architecture
47+ run : echo "arch=$(uname -m)" >> $GITHUB_OUTPUT
48+ id : detect_arch
3449
3550 - name : Package artifact
3651 run : |
52+ set -eux
3753 mkdir -p Release
38- cp build/rocketmq.node Release/linux-x86_64-gnu-rocketmq.node
54+ cp build/rocketmq.node Release/linux-${{ steps.detect_arch.outputs.arch }}-gnu-debug-rocketmq.node
55+ strip --strip-all build/rocketmq.node
56+ cp build/rocketmq.node Release/linux-${{ steps.detect_arch.outputs.arch }}-gnu-rocketmq.node
3957
4058 - name : Upload artifact
4159 uses : actions/upload-artifact@v4
4260 with :
43- name : linux-x86_64-gnu
44- path : Release/linux-x86_64-gnu-rocketmq.node
61+ name : linux-${{ steps.detect_arch.outputs.arch }}-gnu
62+ path : |
63+ Release/linux-${{ steps.detect_arch.outputs.arch }}-gnu-rocketmq.node
64+ Release/linux-${{ steps.detect_arch.outputs.arch }}-gnu-debug-rocketmq.node
4565
4666 linux-musl :
4767 runs-on : ubuntu-latest
4868 container :
49- image : node:20- alpine
69+ image : alpine:latest
5070 steps :
5171 - name : Checkout
5272 uses : actions/checkout@v4
5373
5474 - name : Install system dependencies
5575 run : |
56- apk add --no-cache bash build-base cmake ninja python3 curl unzip git
76+ apk add --no-cache nodejs npm bash build-base cmake ninja python3 curl unzip git autoconf automake libtool pkgconfig ninja-build
5777
5878 - name : Install npm dependencies
59- run : npm ci
79+ run : npm install --no-audit --prefer-offline
6080
6181 - name : Build RocketMQ native deps
6282 run : ./deps/rocketmq/build.sh
6383
6484 - name : Build addon (musl)
6585 run : npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release
6686
87+ - name : Detect architecture
88+ run : echo "arch=$(uname -m)" >> $GITHUB_OUTPUT
89+ id : detect_arch
90+
6791 - name : Package artifact
6892 run : |
6993 mkdir -p Release
70- cp build/rocketmq.node Release/linux-x86_64-musl-rocketmq.node
94+ cp build/rocketmq.node Release/linux-${{ steps.detect_arch.outputs.arch }}-musl-debug-rocketmq.node
95+ strip --strip-all build/rocketmq.node
96+ cp build/rocketmq.node Release/linux-${{ steps.detect_arch.outputs.arch }}-musl-rocketmq.node
7197
7298 - name : Upload artifact
7399 uses : actions/upload-artifact@v4
74100 with :
75- name : linux-x86_64-musl
76- path : Release/linux-x86_64-musl-rocketmq.node
101+ name : linux-${{ steps.detect_arch.outputs.arch }}-musl
102+ path : |
103+ Release/linux-${{ steps.detect_arch.outputs.arch }}-musl-rocketmq.node
104+ Release/linux-${{ steps.detect_arch.outputs.arch }}-musl-debug-rocketmq.node
77105
78106 macos-universal :
79107 runs-on : macos-latest
@@ -84,19 +112,35 @@ jobs:
84112 - name : Setup Node.js
85113 uses : actions/setup-node@v4
86114 with :
87- node-version : 20
115+ node-version : 18
88116
89117 - name : Install build tools
90- run : brew install cmake ninja || true
118+ run : brew install cmake ninja xz autoconf automake libtool pkg-config
91119
92120 - name : Install npm dependencies
93- run : npm ci
121+ run : npm install --no-audit --prefer-offline
122+
123+ - name : Build RocketMQ native deps
124+ run : ./deps/rocketmq/build.sh
94125
95- - name : Build universal addon
96- run : ./build.sh build Darwin
126+ - name : Build addon (Darwin universal)
127+ run : |
128+ npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release \
129+ --CDCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
130+ --CDCMAKE_OSX_DEPLOYMENT_TARGET=11 \
131+ --CDCMAKE_SKIP_DEPENDENCY_TRACKING=ON
132+
133+ - name : Package artifact
134+ run : |
135+ mkdir -p Release
136+ cp build/rocketmq.node Release/darwin-universal-debug-rocketmq.node
137+ strip -S -x build/rocketmq.node
138+ cp build/rocketmq.node Release/darwin-universal-rocketmq.node
97139
98140 - name : Upload artifact
99141 uses : actions/upload-artifact@v4
100142 with :
101143 name : darwin-universal
102- path : Release/darwin-universal-rocketmq.node
144+ path : |
145+ Release/darwin-universal-rocketmq.node
146+ Release/darwin-universal-debug-rocketmq.node
0 commit comments