Skip to content

Commit

Permalink
Merge pull request #665 from zeromq/cmake-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Oct 21, 2024
2 parents 840ff75 + a76e464 commit 1a8921d
Show file tree
Hide file tree
Showing 30 changed files with 5,090 additions and 3,563 deletions.
13 changes: 7 additions & 6 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: false
AlignConsecutiveAssignments: false
AlignAfterOpenBracket: "DontAlign"
AlignConsecutiveAssignments: "None"
AlignEscapedNewlinesLeft: false
AlignOperands: false
AlignOperands: "DontAlign"
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortBlocksOnASingleLine: "Never"
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: "AllIfsAndElse"
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
AlwaysBreakTemplateDeclarations: "Yes"
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: NonAssignment
Expand Down Expand Up @@ -64,6 +64,7 @@ SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 4
UseTab: Never
RemoveSemicolon: true

IncludeBlocks: Regroup
IncludeCategories:
Expand Down
12 changes: 12 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
Checks:
"*, -abseil-*, -altera-*, -android-*, -fuchsia-*, google-*,
-google-runtime-int, -llvm*, -modernize-use-trailing-return-type, -zircon-*,
readability-else-after-return, readability-static-accessed-through-instance,
readability-avoid-const-params-in-decls,
cppcoreguidelines-non-private-member-variables-in-classes,
misc-non-private-member-variables-in-classes,
-*-non-private-member-variables-in-classes,-misc-include-cleaner"
WarningsAsErrors: ""
HeaderFilterRegex: ""
FormatStyle: none
2 changes: 0 additions & 2 deletions .clangd

This file was deleted.

89 changes: 56 additions & 33 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
os:
- ubuntu-20.04
- windows-2019
node_version:
- 18
node_arch:
- x64
cpp_arch:
Expand All @@ -28,34 +26,30 @@ jobs:

include:
- os: windows-2019
node_version: 18
node_arch: ia32
cpp_arch: amd64_x86

# - os: windows-2022
# node_version: 18
# node_arch: x64
# arch: arm64
# cpp_arch: amd64_arm64

- os: macos-13
node_version: 18
node_arch: x64
cpp_arch: x64

- os: macos-14
node_version: 18
node_arch: arm64
cpp_arch: amd64_arm64

# Alpine
- os: ubuntu-22.04
docker: node:18-alpine
docker_cmd:
apk add --no-cache pkgconfig curl tar python3 make gcc g++ cmake
musl-dev && npm i -g pnpm && pnpm install && pnpm run
build.prebuild
node_version: 18
apk add --no-cache bash build-base curl git g++ make ninja-build
pkgconfig unzip zip python3 tar cmake ninja musl-dev && cp
/usr/lib/ninja-build/bin/ninja /usr/bin/ninja && npm i -g pnpm &&
pnpm install && pnpm run build
node_arch: x64
cpp_arch: x64

Expand All @@ -73,12 +67,12 @@ jobs:
with:
path: |
./node_modules/
./build/
~/vcpkg
key:
# prettier-ignore
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch}}-ZMQ_DRAFT:${{env.npm_config_zmq_draft }}-Node:${{ matrix.node_version}}-${{hashFiles('./package.json') }}"
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch}}-ZMQ_DRAFT:${{env.npm_config_zmq_draft }}-${{hashFiles('./package.json') }}"
restore-keys: |
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ env.npm_config_zmq_draft }}-Node:${{ matrix.node_version }}-"
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ env.npm_config_zmq_draft }}-"
- name: Env map
run: |
Expand All @@ -93,21 +87,11 @@ jobs:
with:
vcvarsall: ${{ contains(matrix.os, 'windows') }}
cmake: true
ninja: true
python: true
vcpkg: true
architecture: ${{ matrix.cpp_arch }}

- uses: pnpm/action-setup@v4
if: ${{ !matrix.docker }}
with:
version: 9

- name: Install Node
if: ${{ !matrix.docker }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
architecture: ${{ env.setup_node_arch }}

- name: Install Mac-OS x86_64 Dependencies
if: ${{ contains(matrix.os, 'macos') && matrix.node_arch == 'x64' }}
run: |
Expand All @@ -121,13 +105,52 @@ jobs:
echo "PATH=$PATH" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
- name: Install Dependencies and Build
- uses: pnpm/action-setup@v4
if: ${{ !matrix.docker }}
with:
version: 9

- name: Install Node 20
if: ${{ !matrix.docker }}
uses: actions/setup-node@v4
with:
node-version: 20
architecture: ${{ env.setup_node_arch }}

- name: Install Dependencies
if: ${{ !matrix.docker }}
run: pnpm install

- name: Prebuild
- name: Build JavaScript
if: ${{ !matrix.docker }}
run: pnpm run build.prebuild
run: pnpm run build.js

- name: Install Node 12
if: ${{ !matrix.docker && matrix.os != 'macos-14' }}
uses: actions/setup-node@v4
with:
node-version: 12
architecture: ${{ env.setup_node_arch }}

- name: Build Native
if:
${{ !matrix.docker && matrix.os != 'windows-2019' && matrix.node_arch
!= 'ia32' }}
run: npm run build.native

- name: Build Native Windows 32
if:
${{ !matrix.docker && matrix.os == 'windows-2019' && matrix.node_arch
== 'ia32' }}
run:
node ./node_modules/cmake-ts/build/main.js named-configs windows-x86

- name: Use Node 20
if: ${{ !matrix.docker }}
uses: actions/setup-node@v4
with:
node-version: 20
architecture: ${{ env.setup_node_arch }}

- name: Prebuild Docker
if: ${{ matrix.docker }}
Expand All @@ -140,8 +163,8 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: ./prebuilds
name: prebuilds-${{ strategy.job-index }}
path: ./build
name: build-${{ strategy.job-index }}
overwrite: true

- name: Lint
Expand Down Expand Up @@ -169,13 +192,13 @@ jobs:
pnpm install -g electron@latest
xvfb-run --auto-servernum pnpm run test.electron.main
continue-on-error: true
merge-prebuilds:
merge-build:
runs-on: ubuntu-latest
needs: Build
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: prebuilds
pattern: prebuilds-*
name: build
pattern: build-*
delete-merged: true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ tsconfig.*.tsbuildinfo
/doc-unminified
.DS_Store
.idea
/staging
!/lib/load-addon.js
!/lib/load-addon.js.map

compile_commands.json
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
/node_modules
pnpm-lock.yaml
/build
/script/*.js
/script/*.mjs
10 changes: 1 addition & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,8 @@
"mochaExplorer.nodeArgv": ["--expose-gc"],
"mochaExplorer.debuggerConfig": "JS-Attach",
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/.cache": true,
"**/script/*.js": true,
"**/script/*.mjs": true,
"**/script/*.js.map": true,
"**/script/*.mjs.map": true,
"**/script/*.d.ts": true,
"**/script/*.d.mts": true,
"**/script/*.tsbuildinfo": true
"**/.cache": true
}
}
Loading

0 comments on commit 1a8921d

Please sign in to comment.