Skip to content

Commit

Permalink
build: target Node 12 when building
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Oct 20, 2024
1 parent 640900f commit aa6748d
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 53 deletions.
61 changes: 36 additions & 25 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,23 +26,19 @@ 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

Expand All @@ -53,9 +47,8 @@ jobs:
docker: node:18-alpine
docker_cmd:
apk add --no-cache pkgconfig tar python3 build-base cmake ninja
zip unzip curl git musl-dev && npm i -g pnpm && pnpm install &&
pnpm run build
node_version: 18
zip unzip curl git musl-dev gcc g++ && npm i -g pnpm && pnpm
install && pnpm run build
node_arch: x64
cpp_arch: x64

Expand All @@ -76,9 +69,9 @@ jobs:
./build/
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 @@ -98,18 +91,6 @@ jobs:
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 @@ -123,13 +104,43 @@ jobs:
echo "PATH=$PATH" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
- uses: pnpm/action-setup@v4
if: ${{ !matrix.docker }}
with:
version: 9

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

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

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

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

- name: Build Native with Node 12
if: ${{ !matrix.docker }}
run: npm run build.native

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

- name: Prebuild Docker
if: ${{ matrix.docker }}
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ set_target_properties(addon PROPERTIES PREFIX "" SUFFIX ".node")
# Windows workaround
if(WIN32)
set_property(TARGET addon PROPERTY LINK_FLAGS "-Xlinker /DELAYLOAD:NODE.EXE")
target_link_libraries(addon "ShLwApi.lib" "delayimp.lib")
target_link_libraries(addon PRIVATE "ShLwApi.lib" "delayimp.lib")
endif()
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ Install **ZeroMQ.js** with prebuilt binaries:
npm install zeromq
```

Requirements for using prebuilt binaries:
Supported versions:

- Node.js 10.2+ or Electron 3+ (requires a
[N-API](https://nodejs.org/api/n-api.html) version 3+)
- Node.js v12 (requires a [N-API](https://nodejs.org/api/n-api.html))

### Prebuilt binaries

Expand Down
40 changes: 16 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
}
},
"engines": {
"node": ">= 10.2",
"node": ">= 12",
"pnpm": ">= 9"
},
"files": [
Expand Down Expand Up @@ -123,67 +123,59 @@
"configurations": [
{
"name": "linux-x64",
"dev": true,
"os": "linux",
"arch": "x64",
"runtime": "node",
"runtimeVersion": "14.20.0"
"runtimeVersion": "12.22.12"
},
{
"name": "win-x64",
"dev": true,
"name": "windows-x64",
"os": "win32",
"arch": "x64",
"runtime": "node",
"runtimeVersion": "14.20.0"
"runtimeVersion": "12.22.12"
},
{
"name": "macos-x64",
"dev": true,
"name": "darwin-x64",
"os": "darwin",
"arch": "x64",
"runtime": "node",
"runtimeVersion": "14.20.0"
"runtimeVersion": "12.22.12"
},
{
"name": "macos-arm64",
"dev": true,
"name": "darwin-arm64",
"os": "darwin",
"arch": "arm64",
"runtime": "node",
"runtimeVersion": "14.20.0"
"runtimeVersion": "12.22.12"
},
{
"name": "linux-x64",
"dev": true,
"name": "linux-x64-electron",
"os": "linux",
"arch": "x64",
"runtime": "electron",
"runtimeVersion": "14.20.0"
"runtimeVersion": "12.22.12"
},
{
"name": "win-x64",
"dev": true,
"name": "windows-x64-electron",
"os": "win32",
"arch": "x64",
"runtime": "electron",
"runtimeVersion": "14.20.0"
"runtimeVersion": "12.22.12"
},
{
"name": "macos-x64",
"dev": true,
"name": "darwin-x64-electron",
"os": "darwin",
"arch": "x64",
"runtime": "electron",
"runtimeVersion": "14.20.0"
"runtimeVersion": "12.22.12"
},
{
"name": "macos-arm64",
"dev": true,
"name": "darwin-arm64-electron",
"os": "darwin",
"arch": "arm64",
"runtime": "electron",
"runtimeVersion": "14.20.0"
"runtimeVersion": "12.22.12"
}
],
"targetDirectory": "build",
Expand Down

0 comments on commit aa6748d

Please sign in to comment.