Skip to content

Commit

Permalink
Merge pull request #522 from zeromq/build [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Nov 16, 2022
2 parents 9d5d1e5 + fbbf0e6 commit c1ac1e1
Show file tree
Hide file tree
Showing 12 changed files with 1,203 additions and 526 deletions.
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

0 comments on commit c1ac1e1

Please sign in to comment.