-
-
Notifications
You must be signed in to change notification settings - Fork 214
378 lines (333 loc) · 9.84 KB
/
CI.yml
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
name: CI
on:
pull_request:
push:
branches:
- master
jobs:
Build:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ${{ matrix.os }}
# prettier-ignore
name: ${{ matrix.os }}-${{ matrix.node_arch }}-${{ matrix.dockerfile }}-${{ matrix.distro }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- windows-2019
node_arch:
- x64
cpp_arch:
- x64
dockerfile:
- ""
distro:
- ""
native:
- true
include:
- os: windows-2019
node_arch: ia32
cpp_arch: amd64_x86
native: true
# - os: windows-2022
# node_arch: x64
# arch: arm64
# cpp_arch: amd64_arm64
- os: macos-13
node_arch: x64
cpp_arch: x64
native: true
- os: macos-14
node_arch: arm64
cpp_arch: amd64_arm64
native: true
# Musl Alpine
- os: ubuntu-24.04
dockerfile: docker/alpine.dockerfile
node_arch: x64
cpp_arch: x64
native: false
# Debian Arm
- os: ubuntu-24.04
node_arch: arm64
cpp_arch: amd64_arm64
distro: bookworm
native: false
# Musl Alpine Arm
- os: ubuntu-24.04
node_arch: arm64
cpp_arch: amd64_arm64
distro: alpine_latest
native: false
env:
npm_config_arch: ${{ matrix.node_arch }}
npm_config_target_arch: ${{ matrix.node_arch }}
setup_node_arch: ${{ matrix.node_arch }}
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
./node_modules/
~/vcpkg
# prettier-ignore
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch}}-${{hashFiles('./pnpm-lock.yaml', './vcpkg.json', './CMakeLists.txt') }}"
restore-keys: |
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-"
- name: Env map
run: |
if [ "${{ matrix.node_arch }}" = "ia32" ]; then
echo "setup_node_arch=x86" > $GITHUB_ENV
fi
shell: bash
- name: Setup Cpp
if: ${{ matrix.native }}
uses: aminya/setup-cpp@v1
with:
vcvarsall: ${{ contains(matrix.os, 'windows') }}
cmake: true
ninja: true
python: true
vcpkg: true
architecture: ${{ matrix.cpp_arch }}
- name: Install Mac-OS Dependencies
if: ${{ contains(matrix.os, 'macos') }}
run: |
brew install gnutls autoconf automake libtool
- uses: pnpm/action-setup@v4
if: ${{ matrix.native }}
with:
version: 9
- name: Install Node 20
if: ${{ matrix.native }}
uses: actions/setup-node@v4
with:
node-version: 20
architecture: ${{ env.setup_node_arch }}
- name: Install and Build Native
if: ${{ matrix.native }}
run: pnpm install
- name: Build JavaScript
if: ${{ matrix.native }}
run: pnpm run build.js
- name: Install Node 10
if: ${{ matrix.native && matrix.os != 'macos-14' }}
uses: actions/setup-node@v4
with:
node-version: 10
architecture: ${{ env.setup_node_arch }}
- name: Build Native
if: ${{ matrix.native && matrix.node_arch != 'ia32' }}
run: npm run build.native
- name: Build Native Windows 32
if: ${{ matrix.os == 'windows-2019' && matrix.node_arch == 'ia32' }}
run:
node ./node_modules/@aminya/cmake-ts/build/main.js named-configs
windows-x86
- name: Use Node 20
if: ${{ matrix.native }}
uses: actions/setup-node@v4
with:
node-version: 20
architecture: ${{ env.setup_node_arch }}
- name: Prebuild Docker
if: ${{ matrix.dockerfile }}
run: |
docker build -t zeromq -f ${{ matrix.dockerfile }} .
docker create --name zeromq-temp zeromq
mkdir -p ./build
docker cp zeromq-temp:/app/build ./
docker rm -f zeromq-temp
- name: Build Linux Arm64
if: ${{ matrix.distro }}
uses: uraimo/[email protected]
with:
arch: aarch64
distro: ${{ matrix.distro }}
githubToken: ${{ github.token }}
setup: |
mkdir -p "${PWD}/build"
dockerRunArgs: |
--volume "${PWD}/build:/build"
env: |
VCPKG_FORCE_SYSTEM_BINARIES: 1
install: |
set -x
case "${{ matrix.distro }}" in
fedora*)
dnf update -q -y
dnf install -y \
bash \
build-essential \
curl \
git \
g++ \
make \
ninja-build \
pkg-config \
unzip \
zip \
python3 \
tar \
cmake \
ninja-build \
automake \
autoconf \
libtool \
nodejs
;;
alpine*)
apk update
apk add --no-cache bash build-base curl git g++ make ninja-build pkgconfig unzip zip python3 tar cmake musl-dev automake autoconf libtool nodejs npm
cp /usr/lib/ninja-build/bin/ninja /usr/bin/ninja
;;
*)
# Default case (Ubuntu/Debian)
apt-get update -q -y
apt-get install --no-install-recommends -y \
bash \
build-essential \
curl \
git \
g++ \
make \
ninja-build \
pkg-config \
unzip \
zip \
python3 \
tar \
cmake \
ninja-build \
automake \
autoconf \
libtool \
nodejs \
npm
;;
esac
npm i -g pnpm
run: |
pnpm install && \
pnpm run build
- name: Upload build
uses: actions/upload-artifact@v4
with:
path: ./build
name: build-${{ strategy.job-index }}
overwrite: true
- name: Lint
if: "${{ contains(matrix.os, 'ubuntu') && matrix.native }}"
run: pnpm run lint-test
- name: Test
if: ${{ matrix.native }}
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 3
shell: bash
command: |
pnpm run test.unit || (rm -rf ./tmp && mkdir -p ./tmp && exit 1)
rm -rf ./tmp && mkdir -p ./tmp
- name: Test Electron Windows/MacOS
if: "${{ !contains(matrix.os, 'ubuntu') && matrix.native }}"
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 1
command: |
pnpm run test.electron.main
continue-on-error: true
- name: Test Electron Linux
if: "${{ contains(matrix.os, 'ubuntu') && matrix.native }}"
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 1
command: |
sudo apt-get install xvfb
xvfb-run --auto-servernum pnpm run test.electron.main
continue-on-error: true
Package:
runs-on: ubuntu-latest
needs: Build
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: build
pattern: build-*
delete-merged: true
- uses: actions/checkout@v4
- name: Place build
uses: actions/download-artifact@v4
with:
name: build
path: ./build
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: "./.nvmrc"
- name: Install Pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Pack Zeromq
run: |
pnpm install
pnpm pack
- name: Upload Pack
uses: actions/upload-artifact@v4
with:
path: ./*.tgz
name: pack
overwrite: true
SmokeTest:
runs-on: ${{ matrix.os }}
needs: Package
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
- windows-2022
- macos-13
node-version:
- 10
- 22
include:
- os: macos-14
node-version: 22
steps:
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Yarn 1
if: matrix.node-version == 10
run: |
npm i -g yarn@^1
- name: Install Yarn Latest
if: matrix.node-version == 22
run: |
npm i -g yarn@latest
- name: Install Pnpm 5
if: matrix.node-version == 10
uses: pnpm/action-setup@v4
with:
version: 5
- name: Install Pnpm 9
if: matrix.node-version == 22
uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/checkout@v4
- name: Download Pack
uses: actions/download-artifact@v4
with:
name: pack
- name: Smoke Test
run: bash ./script/smoke-test.bash