-
Notifications
You must be signed in to change notification settings - Fork 1
146 lines (120 loc) · 4.55 KB
/
build.yml
File metadata and controls
146 lines (120 loc) · 4.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Build Addons
on:
push:
branches:
- master
pull_request:
jobs:
linux-gnu:
runs-on: ubuntu-latest
container:
image: alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:latest
steps:
- name: Install prerequisites
run: |
set -eux
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 vim procps-ng iputils
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js via NodeSource
run: |
set -eux
curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -
yum install -y nodejs
node -v
npm -v
- name: Install npm dependencies
run: |
set -eux
npm install --no-audit --prefer-offline
- name: Build RocketMQ native deps
run: |
set -eux
./deps/rocketmq/build.sh
- name: Build addon (glibc)
run: |
set -eux
npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release
- name: Detect architecture
run: echo "arch=$(uname -m)" >> $GITHUB_OUTPUT
id: detect_arch
- name: Package artifact
run: |
set -eux
mkdir -p Release
cp build/rocketmq.node Release/linux-${{ steps.detect_arch.outputs.arch }}-gnu-debug-rocketmq.node
strip --strip-all build/rocketmq.node
cp build/rocketmq.node Release/linux-${{ steps.detect_arch.outputs.arch }}-gnu-rocketmq.node
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-${{ steps.detect_arch.outputs.arch }}-gnu
path: |
Release/linux-${{ steps.detect_arch.outputs.arch }}-gnu-rocketmq.node
Release/linux-${{ steps.detect_arch.outputs.arch }}-gnu-debug-rocketmq.node
linux-musl:
runs-on: ubuntu-latest
container:
image: alpine:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install system dependencies
run: |
apk add --no-cache nodejs npm bash build-base cmake ninja python3 curl unzip git autoconf automake libtool pkgconfig ninja-build
- name: Install npm dependencies
run: npm install --no-audit --prefer-offline
- name: Build RocketMQ native deps
run: ./deps/rocketmq/build.sh
- name: Build addon (musl)
run: npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release
- name: Detect architecture
run: echo "arch=$(uname -m)" >> $GITHUB_OUTPUT
id: detect_arch
- name: Package artifact
run: |
mkdir -p Release
cp build/rocketmq.node Release/linux-${{ steps.detect_arch.outputs.arch }}-musl-debug-rocketmq.node
strip --strip-all build/rocketmq.node
cp build/rocketmq.node Release/linux-${{ steps.detect_arch.outputs.arch }}-musl-rocketmq.node
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-${{ steps.detect_arch.outputs.arch }}-musl
path: |
Release/linux-${{ steps.detect_arch.outputs.arch }}-musl-rocketmq.node
Release/linux-${{ steps.detect_arch.outputs.arch }}-musl-debug-rocketmq.node
macos-universal:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install build tools
run: brew install cmake ninja xz autoconf automake libtool pkg-config
- name: Install npm dependencies
run: npm install --no-audit --prefer-offline
- name: Build RocketMQ native deps
run: ./deps/rocketmq/build.sh
- name: Build addon (Darwin universal)
run: |
npx cmake-js compile --CDCMAKE_BUILD_TYPE=Release \
--CDCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
--CDCMAKE_OSX_DEPLOYMENT_TARGET=11 \
--CDCMAKE_SKIP_DEPENDENCY_TRACKING=ON
- name: Package artifact
run: |
mkdir -p Release
cp build/rocketmq.node Release/darwin-universal-debug-rocketmq.node
strip -S -x build/rocketmq.node
cp build/rocketmq.node Release/darwin-universal-rocketmq.node
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: darwin-universal
path: |
Release/darwin-universal-rocketmq.node
Release/darwin-universal-debug-rocketmq.node