Skip to content

Commit c1ac1e1

Browse files
authored
Merge pull request #522 from zeromq/build [skip ci]
2 parents 9d5d1e5 + fbbf0e6 commit c1ac1e1

File tree

12 files changed

+1203
-526
lines changed

12 files changed

+1203
-526
lines changed

.github/workflows/CI.yml

Lines changed: 58 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,58 @@ jobs:
1414
matrix:
1515
os:
1616
- ubuntu-22.04
17-
- macos-11
1817
- windows-2022
1918
node_version:
2019
- 18
2120
node_arch:
2221
- x64
22+
cpp_arch:
23+
- x64
24+
ARCH:
25+
- x64
2326
zmq_draft:
2427
- false
25-
zmq_shared:
26-
- false
2728
zmq_version:
2829
- 4.3.4
29-
skip_gc_finalizer_tests:
30-
- true
31-
32-
# include:
33-
# - os: windows-latest
34-
# node_version: 18
35-
# node_arch: x86
36-
# zmq_draft: false
37-
# zmq_shared: false
38-
# skip_gc_finalizer_tests: true
39-
40-
# - os: macos-11.0
41-
# node_version: 15
42-
# node_arch: arm64
43-
# zmq_draft: false
44-
# zmq_shared: false
30+
31+
include:
32+
- os: windows-2022
33+
node_version: 18
34+
node_arch: x86
35+
ARCH: x86
36+
cpp_arch: amd64_x86
37+
zmq_draft: false
38+
zmq_version: 4.3.4
39+
40+
# - os: windows-2022
41+
# node_version: 18
42+
# node_arch: x64
43+
# ARCH: arm64
44+
# cpp_arch: amd64_arm64
45+
# zmq_draft: false
46+
# zmq_version: 4.3.4
47+
48+
- os: macos-11
49+
node_version: 18
50+
node_arch: x64
51+
ARCH: x86_64
52+
cpp_arch: x64
53+
zmq_draft: false
54+
zmq_version: 4.3.4
55+
56+
- os: macos-11
57+
node_version: 18
58+
node_arch: x64
59+
ARCH: arm64
60+
cpp_arch: amd64_arm64
61+
zmq_draft: false
62+
zmq_version: 4.3.4
4563

4664
env:
4765
ZMQ_VERSION: ${{ matrix.zmq_version }}
4866
ZMQ_DRAFT: ${{ matrix.zmq_draft }}
49-
ZMQ_SHARED: ${{ matrix.zmq_shared }}
50-
SKIP_GC_FINALIZER_TESTS: ${{ matrix.skip_gc_finalizer_tests }}
67+
ZMQ_SHARED: false
68+
ARCH: ${{ matrix.ARCH }}
5169
steps:
5270
- uses: actions/checkout@v3
5371

@@ -56,42 +74,40 @@ jobs:
5674
with:
5775
path: |
5876
./node_modules/
59-
~/.npm
60-
~/AppData/Roaming/npm-cache
61-
./build/zeromq-${{ matrix.zmq_version }}.tar.gz
62-
./zeromq-${{ matrix.zmq_version }}.tar.gz
63-
./libzmq
64-
./build/libzmq
77+
./build/
6578
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-ZMQ_VERSION:${{ matrix.zmq_version }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
6679
restore-keys: |
67-
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-ZMQ_VERSION:${{ matrix.zmq_version }}-Node:${{ matrix.node_version }}"
80+
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-ZMQ_VERSION:${{ matrix.zmq_version }}-Node:${{ matrix.node_version }}-"
6881
6982
- name: Setup Cpp
7083
uses: aminya/setup-cpp@v1
7184
with:
7285
vcvarsall: ${{ contains(matrix.os, 'windows') }}
7386
cmake: true
7487
ninja: true
75-
architecture: ${{ matrix.node_arch }}
88+
architecture: ${{ matrix.cpp_arch }}
89+
90+
- uses: pnpm/action-setup@v2.2.4
91+
with:
92+
version: 7
7693

7794
- name: Install Node
7895
uses: actions/setup-node@v3
7996
with:
8097
node-version: ${{ matrix.node_version }}
8198
architecture: ${{ matrix.node_arch }}
99+
cache: "pnpm"
82100

83101
- name: Install Mac-OS Dependencies
84102
if: contains(matrix.os, 'macos')
85103
run: |
86-
brew install libsodium
104+
brew install libsodium gnutls
87105
88106
- name: Install Dependencies and Build
89-
run: npm install
107+
run: pnpm install
90108

91109
- name: Prebuild
92-
run: npm run prebuild
93-
env:
94-
ARCH: ${{ matrix.node_arch }}
110+
run: pnpm run prebuild
95111

96112
- name: Upload artifacts
97113
uses: actions/upload-artifact@v2
@@ -100,12 +116,16 @@ jobs:
100116

101117
- name: Lint
102118
if: contains(matrix.os, 'ubuntu')
103-
run: npm run lint-test
119+
run: pnpm run lint-test
104120

105121
- name: Test (Debug)
106-
run: |
107-
npm run test.skip_gc_tests
122+
uses: nick-fields/retry@v2
123+
with:
124+
timeout_minutes: 15
125+
max_attempts: 1
126+
command: |
127+
pnpm run test.skip_gc_tests
108128
109129
- name: Tests + GC Tests (Release)
110130
run: |
111-
npm run test
131+
pnpm run test

.mocharc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
module.exports = {
4-
require: ['ts-node/register', 'choma'],
4+
require: ['ts-node/register', 'rocha'],
55
spec: ['test/unit/*-test.ts', 'test/unit/compat/*-test.{ts,js}'],
66
"expose-gc": true,
77
"experimental-worker": true,

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ async function run() {
121121

122122
while (true) {
123123
await sock.send("some work")
124-
await new Promise(resolve => setTimeout(resolve, 500))
124+
await new Promise(resolve => { setTimeout(resolve, 500) })
125125
}
126126
}
127127

@@ -170,7 +170,7 @@ async function run() {
170170
while (true) {
171171
console.log("sending a multipart message envelope")
172172
await sock.send(["kitty cats", "meow!"])
173-
await new Promise(resolve => setTimeout(resolve, 500))
173+
await new Promise(resolve => { setTimeout(resolve, 500) })
174174
}
175175
}
176176

binding.gyp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@
8080
],
8181
}],
8282

83+
['OS == "mac"', {
84+
'libraries': [
85+
'<(PRODUCT_DIR)/../libzmq/lib/libzmq.a',
86+
'-lsodium',
87+
],
88+
}],
89+
8390
['OS == "win"', {
8491
'libraries': [
8592
'<(PRODUCT_DIR)/../libzmq/lib/libzmq',
@@ -125,7 +132,13 @@
125132
'-Wno-missing-field-initializers',
126133
],
127134
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
128-
'GCC_ENABLE_EXCEPTIONS': 'YES'
135+
'GCC_ENABLE_EXCEPTIONS': 'YES',
136+
'OTHER_CFLAGS': [
137+
"<!(echo \"-arch ${ARCH:=x86_64}\")",
138+
],
139+
'OTHER_LDFLAGS': [
140+
"<!(echo \"-arch ${ARCH:=x86_64}\")",
141+
]
129142
},
130143
}],
131144

@@ -212,7 +225,13 @@
212225
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',
213226
'DEAD_CODE_STRIPPING': 'YES',
214227
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
215-
'GCC_ENABLE_EXCEPTIONS': 'YES'
228+
'GCC_ENABLE_EXCEPTIONS': 'YES',
229+
'OTHER_CFLAGS': [
230+
"<!(echo \"-arch ${ARCH:=x86_64}\")",
231+
],
232+
'OTHER_LDFLAGS': [
233+
"<!(echo \"-arch ${ARCH:=x86_64}\")",
234+
]
216235
},
217236
}],
218237

package.json

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"@types/node": "^18.11.9",
2121
"@types/shelljs": "^0.8.11",
2222
"cross-env": "^7.0.3",
23-
"node-gyp-build": "^4.5.0",
2423
"node-addon-api": "^5.0.0",
24+
"node-gyp-build": "^4.5.0",
2525
"shelljs": "^0.8.5",
2626
"ts-node": "10.9"
2727
},
@@ -34,7 +34,6 @@
3434
"@types/weak-napi": "^2.0.1",
3535
"benchmark": ">=2",
3636
"chai": ">=4.3",
37-
"choma": ">= 1.2",
3837
"deasync": "^0.1.28",
3938
"eslint-config-atomic": "^1.18.1",
4039
"eslint-plugin-prettier": "^4.2.1",
@@ -46,11 +45,12 @@
4645
"npm-run-all2": "^6.0.4",
4746
"prebuildify": "^5.0.1",
4847
"prettier": "^2.7.1",
48+
"rocha": "^2.5.10",
4949
"semver": ">=7",
5050
"shx": "^0.3.4",
5151
"tar-fs": "^2.1.1",
5252
"ts-morph": "^16.0.0",
53-
"typescript": "4.8",
53+
"typescript": "4.9",
5454
"weak-napi": "^2.0.2"
5555
},
5656
"engines": {
@@ -88,10 +88,11 @@
8888
"test.skip_gc_tests": "run-s build.debug && cross-env SKIP_GC_TESTS=true mocha",
8989
"lint.clang-format": "clang-format -i -style=file ./src/*.cc ./src/*.h ./src/util/*.h",
9090
"lint-test.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
91-
"lint.eslint": "pnpm run lint-test.eslint -- --fix",
91+
"lint.eslint": "pnpm run lint-test.eslint --fix",
9292
"lint": "run-p lint.eslint lint.clang-format",
9393
"lint-test": "run-s lint-test.eslint",
94-
"bench": "node --expose-gc test/bench"
94+
"bench": "node --expose-gc test/bench",
95+
"prepublishOnly": "pnpm run build.js"
9596
},
9697
"keywords": [
9798
"zeromq",
@@ -111,32 +112,5 @@
111112
"napi"
112113
],
113114
"license": "MIT",
114-
"author": "Rolf Timmermans <rolf@zxcv.nl>",
115-
"greenkeeper": {
116-
"ignore": [
117-
"@gnd/typedoc",
118-
"@types/chai",
119-
"@types/mocha",
120-
"@types/node",
121-
"@types/semver",
122-
"@typescript-eslint/eslint-plugin",
123-
"@typescript-eslint/parser",
124-
"benchmark",
125-
"chai",
126-
"choma",
127-
"eslint",
128-
"eslint-config-prettier",
129-
"eslint-plugin-prettier",
130-
"gunzip-maybe",
131-
"mocha",
132-
"node-addon-api",
133-
"node-fetch",
134-
"prebuildify",
135-
"prettier",
136-
"semver",
137-
"tar-fs",
138-
"ts-node",
139-
"weak-napi"
140-
]
141-
}
115+
"author": "Rolf Timmermans <rolf@zxcv.nl>"
142116
}

0 commit comments

Comments
 (0)