Skip to content

Commit 1a8921d

Browse files
authored
Merge pull request #665 from zeromq/cmake-ts
2 parents 840ff75 + a76e464 commit 1a8921d

30 files changed

+5090
-3563
lines changed

.clang-format

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
Language: Cpp
33
# BasedOnStyle: Google
44
AccessModifierOffset: -4
5-
AlignAfterOpenBracket: false
6-
AlignConsecutiveAssignments: false
5+
AlignAfterOpenBracket: "DontAlign"
6+
AlignConsecutiveAssignments: "None"
77
AlignEscapedNewlinesLeft: false
8-
AlignOperands: false
8+
AlignOperands: "DontAlign"
99
AlignTrailingComments: false
1010
AllowAllParametersOfDeclarationOnNextLine: true
11-
AllowShortBlocksOnASingleLine: false
11+
AllowShortBlocksOnASingleLine: "Never"
1212
AllowShortCaseLabelsOnASingleLine: false
1313
AllowShortFunctionsOnASingleLine: Empty
14-
AllowShortIfStatementsOnASingleLine: true
14+
AllowShortIfStatementsOnASingleLine: "AllIfsAndElse"
1515
AllowShortLoopsOnASingleLine: true
1616
AlwaysBreakAfterDefinitionReturnType: None
1717
AlwaysBreakBeforeMultilineStrings: true
18-
AlwaysBreakTemplateDeclarations: true
18+
AlwaysBreakTemplateDeclarations: "Yes"
1919
BinPackArguments: true
2020
BinPackParameters: true
2121
BreakBeforeBinaryOperators: NonAssignment
@@ -64,6 +64,7 @@ SpacesInSquareBrackets: false
6464
Standard: Auto
6565
TabWidth: 4
6666
UseTab: Never
67+
RemoveSemicolon: true
6768

6869
IncludeBlocks: Regroup
6970
IncludeCategories:

.clang-tidy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
Checks:
3+
"*, -abseil-*, -altera-*, -android-*, -fuchsia-*, google-*,
4+
-google-runtime-int, -llvm*, -modernize-use-trailing-return-type, -zircon-*,
5+
readability-else-after-return, readability-static-accessed-through-instance,
6+
readability-avoid-const-params-in-decls,
7+
cppcoreguidelines-non-private-member-variables-in-classes,
8+
misc-non-private-member-variables-in-classes,
9+
-*-non-private-member-variables-in-classes,-misc-include-cleaner"
10+
WarningsAsErrors: ""
11+
HeaderFilterRegex: ""
12+
FormatStyle: none

.clangd

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/CI.yml

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ jobs:
1515
os:
1616
- ubuntu-20.04
1717
- windows-2019
18-
node_version:
19-
- 18
2018
node_arch:
2119
- x64
2220
cpp_arch:
@@ -28,34 +26,30 @@ jobs:
2826

2927
include:
3028
- os: windows-2019
31-
node_version: 18
3229
node_arch: ia32
3330
cpp_arch: amd64_x86
3431

3532
# - os: windows-2022
36-
# node_version: 18
3733
# node_arch: x64
3834
# arch: arm64
3935
# cpp_arch: amd64_arm64
4036

4137
- os: macos-13
42-
node_version: 18
4338
node_arch: x64
4439
cpp_arch: x64
4540

4641
- os: macos-14
47-
node_version: 18
4842
node_arch: arm64
4943
cpp_arch: amd64_arm64
5044

5145
# Alpine
5246
- os: ubuntu-22.04
5347
docker: node:18-alpine
5448
docker_cmd:
55-
apk add --no-cache pkgconfig curl tar python3 make gcc g++ cmake
56-
musl-dev && npm i -g pnpm && pnpm install && pnpm run
57-
build.prebuild
58-
node_version: 18
49+
apk add --no-cache bash build-base curl git g++ make ninja-build
50+
pkgconfig unzip zip python3 tar cmake ninja musl-dev && cp
51+
/usr/lib/ninja-build/bin/ninja /usr/bin/ninja && npm i -g pnpm &&
52+
pnpm install && pnpm run build
5953
node_arch: x64
6054
cpp_arch: x64
6155

@@ -73,12 +67,12 @@ jobs:
7367
with:
7468
path: |
7569
./node_modules/
76-
./build/
70+
~/vcpkg
7771
key:
7872
# prettier-ignore
79-
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch}}-ZMQ_DRAFT:${{env.npm_config_zmq_draft }}-Node:${{ matrix.node_version}}-${{hashFiles('./package.json') }}"
73+
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch}}-ZMQ_DRAFT:${{env.npm_config_zmq_draft }}-${{hashFiles('./package.json') }}"
8074
restore-keys: |
81-
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ env.npm_config_zmq_draft }}-Node:${{ matrix.node_version }}-"
75+
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ env.npm_config_zmq_draft }}-"
8276
8377
- name: Env map
8478
run: |
@@ -93,21 +87,11 @@ jobs:
9387
with:
9488
vcvarsall: ${{ contains(matrix.os, 'windows') }}
9589
cmake: true
90+
ninja: true
9691
python: true
92+
vcpkg: true
9793
architecture: ${{ matrix.cpp_arch }}
9894

99-
- uses: pnpm/action-setup@v4
100-
if: ${{ !matrix.docker }}
101-
with:
102-
version: 9
103-
104-
- name: Install Node
105-
if: ${{ !matrix.docker }}
106-
uses: actions/setup-node@v4
107-
with:
108-
node-version: ${{ matrix.node_version }}
109-
architecture: ${{ env.setup_node_arch }}
110-
11195
- name: Install Mac-OS x86_64 Dependencies
11296
if: ${{ contains(matrix.os, 'macos') && matrix.node_arch == 'x64' }}
11397
run: |
@@ -121,13 +105,52 @@ jobs:
121105
echo "PATH=$PATH" >> $GITHUB_ENV
122106
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
123107
124-
- name: Install Dependencies and Build
108+
- uses: pnpm/action-setup@v4
109+
if: ${{ !matrix.docker }}
110+
with:
111+
version: 9
112+
113+
- name: Install Node 20
114+
if: ${{ !matrix.docker }}
115+
uses: actions/setup-node@v4
116+
with:
117+
node-version: 20
118+
architecture: ${{ env.setup_node_arch }}
119+
120+
- name: Install Dependencies
125121
if: ${{ !matrix.docker }}
126122
run: pnpm install
127123

128-
- name: Prebuild
124+
- name: Build JavaScript
129125
if: ${{ !matrix.docker }}
130-
run: pnpm run build.prebuild
126+
run: pnpm run build.js
127+
128+
- name: Install Node 12
129+
if: ${{ !matrix.docker && matrix.os != 'macos-14' }}
130+
uses: actions/setup-node@v4
131+
with:
132+
node-version: 12
133+
architecture: ${{ env.setup_node_arch }}
134+
135+
- name: Build Native
136+
if:
137+
${{ !matrix.docker && matrix.os != 'windows-2019' && matrix.node_arch
138+
!= 'ia32' }}
139+
run: npm run build.native
140+
141+
- name: Build Native Windows 32
142+
if:
143+
${{ !matrix.docker && matrix.os == 'windows-2019' && matrix.node_arch
144+
== 'ia32' }}
145+
run:
146+
node ./node_modules/cmake-ts/build/main.js named-configs windows-x86
147+
148+
- name: Use Node 20
149+
if: ${{ !matrix.docker }}
150+
uses: actions/setup-node@v4
151+
with:
152+
node-version: 20
153+
architecture: ${{ env.setup_node_arch }}
131154

132155
- name: Prebuild Docker
133156
if: ${{ matrix.docker }}
@@ -140,8 +163,8 @@ jobs:
140163
- name: Upload artifacts
141164
uses: actions/upload-artifact@v4
142165
with:
143-
path: ./prebuilds
144-
name: prebuilds-${{ strategy.job-index }}
166+
path: ./build
167+
name: build-${{ strategy.job-index }}
145168
overwrite: true
146169

147170
- name: Lint
@@ -169,13 +192,13 @@ jobs:
169192
pnpm install -g electron@latest
170193
xvfb-run --auto-servernum pnpm run test.electron.main
171194
continue-on-error: true
172-
merge-prebuilds:
195+
merge-build:
173196
runs-on: ubuntu-latest
174197
needs: Build
175198
steps:
176199
- name: Merge Artifacts
177200
uses: actions/upload-artifact/merge@v4
178201
with:
179-
name: prebuilds
180-
pattern: prebuilds-*
202+
name: build
203+
pattern: build-*
181204
delete-merged: true

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ tsconfig.*.tsbuildinfo
2121
/doc-unminified
2222
.DS_Store
2323
.idea
24+
/staging
25+
!/lib/load-addon.js
26+
!/lib/load-addon.js.map
27+
28+
compile_commands.json

.npmrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

.prettierignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@
55
/node_modules
66
pnpm-lock.yaml
77
/build
8-
/script/*.js
9-
/script/*.mjs

.vscode/settings.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,8 @@
44
"mochaExplorer.nodeArgv": ["--expose-gc"],
55
"mochaExplorer.debuggerConfig": "JS-Attach",
66
"files.exclude": {
7-
"**/.git": true,
87
"**/.DS_Store": true,
98
"**/Thumbs.db": true,
10-
"**/.cache": true,
11-
"**/script/*.js": true,
12-
"**/script/*.mjs": true,
13-
"**/script/*.js.map": true,
14-
"**/script/*.mjs.map": true,
15-
"**/script/*.d.ts": true,
16-
"**/script/*.d.mts": true,
17-
"**/script/*.tsbuildinfo": true
9+
"**/.cache": true
1810
}
1911
}

0 commit comments

Comments
 (0)