Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve the architecture handling the build system + add support for MacOS Arm + Windows 32 bit #522

Merged
merged 24 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
49e5304
fix: fix the x86 builds
aminya Nov 16, 2022
c2fe69e
ci: remove skip_gc_finalizer_tests env variable
aminya Nov 16, 2022
e0429a4
fix: update dependencies
aminya Nov 16, 2022
09835c3
ci: add windows x86 builds to the CI
aminya Nov 16, 2022
f92de03
fix: support building for Windows Arm
aminya Nov 16, 2022
db396ce
fix: support building for ARM on MacOS and Linux
aminya Nov 16, 2022
1c3633e
ci: cross-compile for ARM64 and x86
aminya Nov 16, 2022
94f989d
ci: handle the falsey strings in the environment variables
aminya Nov 16, 2022
1a8978c
test: use rocha to randomize the mocha tests
aminya Nov 16, 2022
31813a9
test: increase the timeout for should poll simultaneously
aminya Nov 16, 2022
705f094
ci: timeout if the tests are stuck
aminya Nov 16, 2022
a061cae
fix: ensure that the types are included in the package
aminya Nov 16, 2022
044fe44
ci: install gnutls on macos
aminya Nov 16, 2022
a7ff2cc
fix: specify the prebuild arch separately
aminya Nov 16, 2022
2820eaa
fix: fix the MacOS arm64 flags
aminya Nov 16, 2022
a917a8c
ci: use pnpm inside CI
aminya Nov 16, 2022
9a86a1e
ci: fix the MacOS ARCH value on x64
aminya Nov 16, 2022
7d20cd0
fix: fix the MacOS Arm flags
aminya Nov 16, 2022
867e65d
fix: disable Arm builds for Mac and Windows
aminya Nov 16, 2022
40e86a7
fix: echo the cmake commands to the stdout
aminya Nov 16, 2022
9f7eee0
fix: fix the zmq_draft check
aminya Nov 16, 2022
62e2d9c
Revert "fix: disable Arm builds for Mac and Windows"
aminya Nov 16, 2022
8ef19ce
ci: set Arch env var globally
aminya Nov 16, 2022
fbbf0e6
fix: add sodium library to the link list for the tests
aminya Nov 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 58 additions & 38 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,58 @@ jobs:
matrix:
os:
- ubuntu-22.04
- macos-11
- windows-2022
node_version:
- 18
node_arch:
- x64
cpp_arch:
- x64
ARCH:
- x64
zmq_draft:
- false
zmq_shared:
- false
zmq_version:
- 4.3.4
skip_gc_finalizer_tests:
- true

# include:
# - os: windows-latest
# node_version: 18
# node_arch: x86
# zmq_draft: false
# zmq_shared: false
# skip_gc_finalizer_tests: true

# - os: macos-11.0
# node_version: 15
# node_arch: arm64
# zmq_draft: false
# zmq_shared: false

include:
- os: windows-2022
node_version: 18
node_arch: x86
ARCH: x86
cpp_arch: amd64_x86
zmq_draft: false
zmq_version: 4.3.4

# - os: windows-2022
# node_version: 18
# node_arch: x64
# ARCH: arm64
# cpp_arch: amd64_arm64
# zmq_draft: false
# zmq_version: 4.3.4

- os: macos-11
node_version: 18
node_arch: x64
ARCH: x86_64
cpp_arch: x64
zmq_draft: false
zmq_version: 4.3.4

- os: macos-11
node_version: 18
node_arch: x64
ARCH: arm64
cpp_arch: amd64_arm64
zmq_draft: false
zmq_version: 4.3.4

env:
ZMQ_VERSION: ${{ matrix.zmq_version }}
ZMQ_DRAFT: ${{ matrix.zmq_draft }}
ZMQ_SHARED: ${{ matrix.zmq_shared }}
SKIP_GC_FINALIZER_TESTS: ${{ matrix.skip_gc_finalizer_tests }}
ZMQ_SHARED: false
ARCH: ${{ matrix.ARCH }}
steps:
- uses: actions/checkout@v3

Expand All @@ -56,42 +74,40 @@ jobs:
with:
path: |
./node_modules/
~/.npm
~/AppData/Roaming/npm-cache
./build/zeromq-${{ matrix.zmq_version }}.tar.gz
./zeromq-${{ matrix.zmq_version }}.tar.gz
./libzmq
./build/libzmq
./build/
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') }}"
restore-keys: |
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-ZMQ_VERSION:${{ matrix.zmq_version }}-Node:${{ matrix.node_version }}"
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-ZMQ_VERSION:${{ matrix.zmq_version }}-Node:${{ matrix.node_version }}-"

- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
vcvarsall: ${{ contains(matrix.os, 'windows') }}
cmake: true
ninja: true
architecture: ${{ matrix.node_arch }}
architecture: ${{ matrix.cpp_arch }}

- uses: pnpm/[email protected]
with:
version: 7

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
architecture: ${{ matrix.node_arch }}
cache: "pnpm"

- name: Install Mac-OS Dependencies
if: contains(matrix.os, 'macos')
run: |
brew install libsodium
brew install libsodium gnutls

- name: Install Dependencies and Build
run: npm install
run: pnpm install

- name: Prebuild
run: npm run prebuild
env:
ARCH: ${{ matrix.node_arch }}
run: pnpm run prebuild

- name: Upload artifacts
uses: actions/upload-artifact@v2
Expand All @@ -100,12 +116,16 @@ jobs:

- name: Lint
if: contains(matrix.os, 'ubuntu')
run: npm run lint-test
run: pnpm run lint-test

- name: Test (Debug)
run: |
npm run test.skip_gc_tests
uses: nick-fields/retry@v2
with:
timeout_minutes: 15
max_attempts: 1
command: |
pnpm run test.skip_gc_tests

- name: Tests + GC Tests (Release)
run: |
npm run test
pnpm run test
2 changes: 1 addition & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

module.exports = {
require: ['ts-node/register', 'choma'],
require: ['ts-node/register', 'rocha'],
spec: ['test/unit/*-test.ts', 'test/unit/compat/*-test.{ts,js}'],
"expose-gc": true,
"experimental-worker": true,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ async function run() {

while (true) {
await sock.send("some work")
await new Promise(resolve => setTimeout(resolve, 500))
await new Promise(resolve => { setTimeout(resolve, 500) })
}
}

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

Expand Down
23 changes: 21 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@
],
}],

['OS == "mac"', {
'libraries': [
'<(PRODUCT_DIR)/../libzmq/lib/libzmq.a',
'-lsodium',
],
}],

['OS == "win"', {
'libraries': [
'<(PRODUCT_DIR)/../libzmq/lib/libzmq',
Expand Down Expand Up @@ -125,7 +132,13 @@
'-Wno-missing-field-initializers',
],
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_EXCEPTIONS': 'YES'
'GCC_ENABLE_EXCEPTIONS': 'YES',
'OTHER_CFLAGS': [
"<!(echo \"-arch ${ARCH:=x86_64}\")",
],
'OTHER_LDFLAGS': [
"<!(echo \"-arch ${ARCH:=x86_64}\")",
]
},
}],

Expand Down Expand Up @@ -212,7 +225,13 @@
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',
'DEAD_CODE_STRIPPING': 'YES',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_EXCEPTIONS': 'YES'
'GCC_ENABLE_EXCEPTIONS': 'YES',
'OTHER_CFLAGS': [
"<!(echo \"-arch ${ARCH:=x86_64}\")",
],
'OTHER_LDFLAGS': [
"<!(echo \"-arch ${ARCH:=x86_64}\")",
]
},
}],

Expand Down
40 changes: 7 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"@types/node": "^18.11.9",
"@types/shelljs": "^0.8.11",
"cross-env": "^7.0.3",
"node-gyp-build": "^4.5.0",
"node-addon-api": "^5.0.0",
"node-gyp-build": "^4.5.0",
"shelljs": "^0.8.5",
"ts-node": "10.9"
},
Expand All @@ -34,7 +34,6 @@
"@types/weak-napi": "^2.0.1",
"benchmark": ">=2",
"chai": ">=4.3",
"choma": ">= 1.2",
"deasync": "^0.1.28",
"eslint-config-atomic": "^1.18.1",
"eslint-plugin-prettier": "^4.2.1",
Expand All @@ -46,11 +45,12 @@
"npm-run-all2": "^6.0.4",
"prebuildify": "^5.0.1",
"prettier": "^2.7.1",
"rocha": "^2.5.10",
"semver": ">=7",
"shx": "^0.3.4",
"tar-fs": "^2.1.1",
"ts-morph": "^16.0.0",
"typescript": "4.8",
"typescript": "4.9",
"weak-napi": "^2.0.2"
},
"engines": {
Expand Down Expand Up @@ -88,10 +88,11 @@
"test.skip_gc_tests": "run-s build.debug && cross-env SKIP_GC_TESTS=true mocha",
"lint.clang-format": "clang-format -i -style=file ./src/*.cc ./src/*.h ./src/util/*.h",
"lint-test.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
"lint.eslint": "pnpm run lint-test.eslint -- --fix",
"lint.eslint": "pnpm run lint-test.eslint --fix",
"lint": "run-p lint.eslint lint.clang-format",
"lint-test": "run-s lint-test.eslint",
"bench": "node --expose-gc test/bench"
"bench": "node --expose-gc test/bench",
"prepublishOnly": "pnpm run build.js"
},
"keywords": [
"zeromq",
Expand All @@ -111,32 +112,5 @@
"napi"
],
"license": "MIT",
"author": "Rolf Timmermans <[email protected]>",
"greenkeeper": {
"ignore": [
"@gnd/typedoc",
"@types/chai",
"@types/mocha",
"@types/node",
"@types/semver",
"@typescript-eslint/eslint-plugin",
"@typescript-eslint/parser",
"benchmark",
"chai",
"choma",
"eslint",
"eslint-config-prettier",
"eslint-plugin-prettier",
"gunzip-maybe",
"mocha",
"node-addon-api",
"node-fetch",
"prebuildify",
"prettier",
"semver",
"tar-fs",
"ts-node",
"weak-napi"
]
}
"author": "Rolf Timmermans <[email protected]>"
}
Loading