-
Notifications
You must be signed in to change notification settings - Fork 78
599 lines (544 loc) · 17.9 KB
/
build-bindings.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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
name: Build binding
run-name: Build bindings (run_tests=${{ inputs.run_tests }}, use-server-rc=${{ inputs.use-server-rc }}, server-tag=${{ inputs.server-tag }})
# Builds manylinux bindings and source distribution
# If running tests, publish results in commit status
# Publishes bindings and source distribution on Github Actions if no tests are run or tests pass
on:
push:
branches: ["stage", "master"]
pull_request:
branches: ["stage", "master"]
types: [
# Default triggers
opened,
synchronize,
reopened,
# Additional triggers
labeled,
unlabeled
]
inputs:
# If we only want to check that the builds pass on an arbitrary branch
run_tests:
description: "Run integration tests"
required: true
type: boolean
default: true
use-server-rc:
type: boolean
required: true
default: false
description: 'Test against server release candidate?'
# If we are creating a backport and want to test an arbitrary branch against an older server version
server-tag:
required: true
default: 'latest'
description: 'Server docker image tag'
workflow_call:
inputs:
# The dev tests test the artifacts against a server release
# The stage tests and release workflow only need to build the artifacts
run_tests:
description: "Run integration tests"
required: true
type: boolean
default: true
commit_sha:
type: string
required: false
# Calling workflow doesn't actually use these 2 options
# But we need to set default values for workflow calls
use-server-rc:
required: false
default: true
type: boolean
server-tag:
type: string
required: false
default: 'latest'
secrets:
DOCKER_HUB_BOT_USERNAME:
required: false
DOCKER_HUB_BOT_PW:
required: false
MAC_M1_SELF_HOSTED_RUNNER_PW:
required: false
workflow_dispatch:
inputs:
# If we only want to check that the builds pass on an arbitrary branch
run_tests:
description: "Run integration tests"
required: true
type: boolean
default: true
use-server-rc:
type: boolean
required: true
default: false
description: 'Test against server release candidate?'
# If we are creating a backport and want to test an arbitrary branch against an older server version
server-tag:
required: true
default: 'latest'
description: 'Server docker image tag'
jobs:
manylinux:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
# nodejs versions to build bindings on
nodejs: [
["v108", 18],
["v115", 20],
["v127", 22],
["v131", 23]
]
platform: [
"x86_64",
#"aarch64"
]
steps:
- name: Show job status for commit
uses: myrotvorets/set-commit-status-action@v2.0.0
with:
sha: ${{ github.sha }}
context: "Build bindings (${{ matrix.nodejs[0] }}-manylinux_${{ matrix.platform }})"
- uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ inputs.commit_sha }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.nodejs[1] }}
architecture: 'x64'
- name: print
run: uname -m
- name: Set up QEMU for cross compiling arm64
if: ${{ matrix.platform == 'aarch64' }}
uses: docker/setup-qemu-action@v3
with:
platforms: all
- if: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
password: ${{ secrets.DOCKER_HUB_BOT_PW }}
- name: Run Aerospike server release candidate with latest tag
if: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
run: docker run -d --name aerospike -p 3000-3002:3000-3002 aerospike/aerospike-server-rc:latest
- name: Run Aerospike server
if: ${{ !contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
run: |
npm i @types/mocha @types/yargs @types/semver @types/chai;
docker run -d -v $(pwd)/.github/assets/aerospike.conf:/etc/mail/aerospike.conf --name aerospike -p 3000-3002:3000-3002 aerospike/aerospike-server --config-file /etc/mail/aerospike.conf
# - name: Set config.conf to use Docker IP address of Aerospike server
# # config.conf should be copied into the cibuildwheel Docker container
# run: |
# export SERVER_DOCKER_IP=$(docker container inspect -f '{{ .NetworkSettings.IPAddress }}' aerospike)
# # Install crudini
# pip install crudini -c ../.github/workflows/requirements.txt
# sed -i "s/127.0.0.1:3000//" config.conf
# crudini --set config.conf enterprise-edition hosts ${SERVER_DOCKER_IP}:3000
# working-directory: test
- name: Enable tests
run: echo "TEST_COMMAND=cd ts-test;
npm install typescript --save-dev;
npx tsc;
cd ..;
npm run test dist/ -- --h 127.0.0.1 --port 3000" >> $GITHUB_ENV
# - name: Disable tests (only run basic import test)
# if: ${{ !inputs.run_tests }}
# run: echo "TEST_COMMAND=node -e 'aerospike = require(\".\/lib\/aerospike\")'" >> $GITHUB_ENV
- uses: uraimo/run-on-arch-action@v2
name: Build client arm
if: ${{ matrix.platform == 'aarch64' }}
id: runcmd
with:
arch: aarch64
distro: ubuntu-22.04
# Set an output parameter `uname` for use in subsequent steps
run: |
apt update
apt install -y g++ libssl-dev zlib1g-dev make build-essential libuv1-dev wget curl
./scripts/build-c-client.sh
wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash;
source ~/.bashrc;
nvm i 22
npm install
- name: Build client x64
if: ${{ matrix.platform != 'aarch64' }}
run: |
sudo apt update
sudo apt install g++ libssl-dev zlib1g-dev;
sudo apt-get install -y make;
sudo apt install build-essential;
./scripts/build-c-client.sh
npm install
env:
CFLAGS: '-Werror'
- name: Test client
run: |
${{ env.TEST_COMMAND }}
- name: Send binding to test jobs
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.nodejs[0] }}-manylinux_${{ matrix.platform }}.build
path: ./lib/binding/node-*-linux-*/
- name: Set final commit status
uses: myrotvorets/set-commit-status-action@v2.0.0
if: always()
with:
sha: ${{ github.sha }}
status: ${{ job.status }}
context: "Build bindings (${{ matrix.nodejs[0] }}-manylinux_${{ matrix.platform }})"
macOS-x86:
strategy:
fail-fast: false
matrix:
nodejs: [
["v108", 18],
["v115", 20],
["v127", 22],
['v131', 23]
]
runs-on: macos-13
steps:
- name: Show job status for commit
uses: myrotvorets/set-commit-status-action@v2.0.0
with:
sha: ${{ github.sha }}
context: "Build bindings (${{ matrix.nodejs[0] }}-macosx_x86_64)"
- uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ inputs.commit_sha }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.nodejs[1] }}
architecture: 'x64'
# - name: Install Docker Engine
# run: brew install colima
#
# - name: Install Docker client
# run: brew install docker
#
# - name: Start Docker Engine
# run: colima start
#
# - if: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_BOT_PW }}
#
# - name: Run Aerospike server release candidate with latest tag
# if: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
# run: docker run -d --name aerospike -p 3000-3002:3000-3002 aerospike/aerospike-server-rc:latest
#
# - name: Run Aerospike server
# if: ${{ !contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
# run: docker run -d --name aerospike -p 3000-3002:3000-3002 aerospike/aerospike-server
#
# - name: Enable tests
# run: echo "TEST_COMMAND=npm test -- --h 127.0.0.1 --port 3000 --t 30000" >> $GITHUB_ENV
# - name: Disable tests (only run basic import test)
# if: ${{ !inputs.run_tests }}
# run: echo "TEST_COMMAND=node -e 'aerospike = require(\".\/lib\/aerospike\")'" >> $GITHUB_ENV
- name: Build client
run: |
./scripts/build-c-client.sh
npm install
env:
CFLAGS: '-Werror'
# - name: Test client
# run: |
# ${{ env.TEST_COMMAND }}
- name: Save macOS binding
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.nodejs[0] }}-macosx_x86_64.build
path: ./lib/binding/*/
- name: Set final commit status
uses: myrotvorets/set-commit-status-action@v2.0.0
if: always()
with:
status: ${{ job.status }}
sha: ${{ github.sha }}
context: "Build bindings (${{ matrix.nodejs[0] }}-macosx_x86_64)"
# macOS-m1:
# runs-on: [
# self-hosted,
# macOS,
# ARM64
# ]
# strategy:
# matrix:
# nodejs-version: [
# ["v108", "18"],
# ["v115", "20"],
# ["v127", 22]
# ]
# fail-fast: false
# steps:
# - name: Show job status for commit
# uses: myrotvorets/set-commit-status-action@v2.0.0
# with:
# sha: ${{ github.sha }}
# context: "Build bindings (${{ matrix.nodejs-version[1] }}-macosx_arm64)"
#
# - uses: actions/checkout@v4
# with:
# submodules: recursive
# ref: ${{ inputs.commit_sha }}
#
# - name: Install NVM
# run: |
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# source ~/.zshrc
# nvm -v
# nvm install ${{ matrix.nodejs-version[1] }}
#
#
# - name: Setup symlink folders
# run: |
# sudo rm -rf /usr/local/opt/openssl;
# sudo rm -rf /usr/local/opt/libuv;
# sudo mkdir -p /usr/local/opt;
# sudo chown -R $(whoami) /usr/local/opt
#
# - name: Install brew packages
# run: |
# brew install openssl@3.2.1
# brew install libuv@1.47.0
#
# - name: Set environment for building
# run: |
# echo "export PATH="/usr/local/bin/:/usr/local/opt/openssl/bin:$PATH"
# export LDFLAGS="-L/usr/local/opt/openssl/lib"
# export CPPFLAGS="-I/usr/local/opt/openssl/include"
# export EXT_CFLAGS="-I/usr/local/opt/openssl/include"" >> ~/.zshrc;
# source ~/.zshrc;
#
# - name: Setup symlink folders
# run: |
# sudo ln -s /usr/local/Cellar/libuv/1.47.0/ /usr/local/opt/libuv;
# sudo ln -s /usr/local/Cellar/openssl@3/3.2.1/ /usr/local/opt/openssl;
#
# # Self-hosted runner only
# # Need to be able to save Docker Hub credentials to keychain
# - run: security unlock-keychain -p ${{ secrets.MAC_M1_SELF_HOSTED_RUNNER_PW }}
# if: ${{ inputs.run_tests && inputs.use-server-rc }}
#
# - if: ${{ inputs.run_tests && inputs.use-server-rc }}
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_BOT_PW }}
#
# - name: Use server rc
# if: ${{ inputs.run_tests && inputs.use-server-rc }}
# run: echo IMAGE_NAME="${{ vars.SERVER_RC_REPO_LINK }}:${{ inputs.server-tag }}" >> $GITHUB_ENV
#
# - name: Use server release
# if: ${{ inputs.run_tests && !inputs.use-server-rc }}
# run: echo IMAGE_NAME="${{ vars.SERVER_REPO_LINK }}:${{ inputs.server-tag }}" >> $GITHUB_ENV
#
# - name: Run server
# if: ${{ inputs.run_tests }}
# run: docker run -d -p 3000:3000 --name aerospike ${{ env.IMAGE_NAME }}
#
# - name: Build client
# run: |
# ./scripts/build-c-client.sh
# npm install
# env:
# CFLAGS: '-Werror'
#
# - name: Enable tests
# if: ${{ inputs.run_tests }}
# run: echo "TEST_COMMAND=npm test -- --h 127.0.0.1 --port 3000" >> $GITHUB_ENV
#
# - name: Disable tests (only run basic import test)
# if: ${{ !inputs.run_tests }}
# run: echo "TEST_COMMAND=node -e 'aerospike = require(\".\/lib\/aerospike\")'" >> $GITHUB_ENV
#
#
# - name: Test client
# run: |
# ${{ env.TEST_COMMAND }}
#
# - name: Save macOS wheel
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.nodejs-version[0] }}-macosx_arm64.build
# path: ./lib/binding/*/
#
# - name: Stop server
# if: ${{ always() && inputs.run_tests }}
# run: |
# docker container stop aerospike
# docker container prune -f
#
# - name: Set final commit status
# uses: myrotvorets/set-commit-status-action@v2.0.0
# if: always()
# with:
# sha: ${{ github.sha }}
# status: ${{ job.status }}
# context: "Build bindings (${{ matrix.nodejs-version[0] }}-macosx_arm64)"
test-npm-install:
runs-on: ubuntu-22.04
needs: [manylinux, macOS-x86]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: ./.github/workflows/combine-bindings/
- uses: actions/setup-node@v4
with:
node-version: ${{ env.LOWEST_SUPPORTED_NODEJS_VERSION }}
architecture: 'x64'
- name: Modify the package.json
run: |
sudo npm install -g json
- name: Modify the package.json
run: |
sudo npm install -g json
json -I -f package.json -e "this.scripts.install=\"npm-run-all removeExtraBinaries build\""
- name: Run tests
run: |
mkdir -p testDir
cd testDir
pwd
sudo npm install ..
test-yarn-install:
runs-on: ubuntu-22.04
needs: [manylinux, macOS-x86]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: ./.github/workflows/combine-bindings/
- uses: actions/setup-node@v4
with:
node-version: ${{ env.LOWEST_SUPPORTED_NODEJS_VERSION }}
architecture: 'x64'
- name: Modify the package.json
run: |
sudo npm install -g json
json -I -f package.json -e "this.scripts.install=\"npm-run-all removeExtraBinaries build\""
- name: Run tests
run: |
mkdir -p testDir
yarn link
cd testDir
npm install --global yarn
yarn add link:..
test-pnpm-install:
runs-on: ubuntu-22.04
needs: [manylinux, macOS-x86]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: ./.github/workflows/combine-bindings/
- uses: actions/setup-node@v4
with:
node-version: ${{ env.LOWEST_SUPPORTED_NODEJS_VERSION }}
architecture: 'x64'
- name: Modify the package.json
run: |
sudo npm install -g json
json -I -f package.json -e "this.scripts.install=\"npm-run-all removeExtraBinaries build\""
- name: Run tests
run: |
mkdir -p testDir
cd testDir
npm install --global pnpm
SHELL=bash pnpm setup
source /home/runner/.bashrc
pnpm install ..
test-bun-install:
runs-on: ubuntu-latest
needs: [manylinux, macOS-x86]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: ./.github/workflows/combine-bindings/
- uses: actions/setup-node@v4
with:
node-version: ${{ env.LOWEST_SUPPORTED_NODEJS_VERSION }}
architecture: 'x64'
- name: Modify the package.json
run: |
sudo npm install -g json
json -I -f package.json -e "this.scripts.install=\"npm-run-all removeExtraBinaries build\""
- name: Run tests
run: |
npm install -g bun
bun link
mkdir -p testDir
cd testDir
bun link aerospike
# test-typescript-install:
# runs-on: ubuntu-22.04
# needs: [manylinux, macOS-x86]
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: recursive
#
# - uses: ./.github/workflows/combine-bindings/
#
# - uses: actions/setup-node@v4
# with:
# node-version: ${{ env.LOWEST_SUPPORTED_NODEJS_VERSION }}
# architecture: 'x64'
#
# - if: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_BOT_PW }}
#
#
# - name: Run Aerospike server release candidate with latest tag
# if: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
# run: docker run -d --name aerospike -p 3000-3002:3000-3002 aerospike/aerospike-server-rc:latest
#
# - name: Run Aerospike server
# if: ${{ !contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
# run: |
# cd ts-test;
# npm i --save-dev @types/mocha;
# npm i --save-dev @types/yargs;
# npm i --save-dev @types/semver;
# npm i --save-dev @types/chai;
# tsc;
# cd ..;
# npm install;
# docker run -d --name aerospike -p 3000-3002:3000-3002 aerospike/aerospike-server
#
#
#
# - name: Wait for database to be ready
# # Should be ready after 3 seconds
# run: sleep 15
#
# - name: Modify the package.json
# run: |
# sudo npm install -g json
# json -I -f package.json -e "this.scripts.install=\"npm-run-all removeExtraBinaries build\""
#
# - name: Run tests
# run: |
# mkdir my-aerospike-project
# cd my-aerospike-project
# npm init -y
# npm install typescript ts-node --save-dev
# npm install ..
# cp ../examples/typescript.ts index.ts
# npx tsc index.ts
# node index.js