Skip to content

Commit

Permalink
chore: Fix windows build by downloading libnode.dll (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray authored Feb 2, 2025
1 parent 4a1920a commit 690dbef
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 6 deletions.
12 changes: 12 additions & 0 deletions .github/scripts/install_libnode_dll_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# TODO: napi-build requires libnode.dll to be present on the system.
# Most builds on nodejs do not come with libnode.dll, instead they package
# everything in one binary. We download the libnode.dll file from the below releases
# for nodeJs 23.0.0. In the future, we might want to compile from nodeJs source itself and
# also only make this trigger on the compilation for the node bindings.

curl -L -o libnode.zip "https://github.com/metacall/libnode/releases/download/v23.0.0/libnode-amd64-windows.zip"
unzip libnode.zip libnode.dll
pwd_output=$(pwd)
echo "LIBNODE_PATH=$pwd_output" >> $GITHUB_ENV
11 changes: 11 additions & 0 deletions .github/workflows/release-csharp-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ jobs:
version: 0.10.1
- name: Install cargo-zigbuild
run: cargo binstall --no-confirm cargo-zigbuild

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '23.0.0'

- name: Install libnode
if: matrix.os == 'windows-latest'
run: .github/scripts/install_libnode_dll_windows.sh
shell: bash

- name: Run compile script
run: |
chmod +x .github/scripts/compile_all_targets_c_sharp_new.sh
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/release-java-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ jobs:
version: 0.10.1
- name: Install cargo-zigbuild
run: cargo binstall --no-confirm cargo-zigbuild

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '23.0.0'
- name: Install libnode
if: matrix.os == 'windows-latest'
run: .github/scripts/install_libnode_dll_windows.sh
shell: bash

- name: Run compile script
run: |
chmod +x .github/scripts/compile_all_targets_java.sh
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/release-rust-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:
inputs:
ref:
description: 'The reference (branch/tag/commit) to checkout'
description: 'The reference (branch/tag/commit) to checkout '
required: false
release-type:
type: choice
Expand Down Expand Up @@ -53,8 +53,19 @@ jobs:
toolchain: 1.80.0
target: ${{ matrix.target }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '23.0.0'

- name: Install libnode
if: matrix.os == 'windows-latest'
run: .github/scripts/install_libnode_dll_windows.sh
shell: bash

- name: Build
run: cargo build --target ${{ matrix.target }} --verbose
run: RUST_BACKTRACE=full cargo build --target ${{ matrix.target }} --verbose
shell: bash

- name: Run tests
run: RUST_BACKTRACE=1 cargo test --target ${{ matrix.target }}
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test-golang-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ jobs:
with:
toolchain: 1.80.0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '23.0.0'

- name: Install libnode
if: matrix.os == 'windows-latest'
run: .github/scripts/install_libnode_dll_windows.sh
shell: bash

- name: Run compile script
run: ./scripts/compile.sh golang
shell: bash
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test-nim-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ jobs:
with:
toolchain: 1.80.0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '23.0.0'

- name: Install libnode
if: matrix.os == 'windows-latest'
run: .github/scripts/install_libnode_dll_windows.sh
shell: bash

- name: Run compile script
run: ./scripts/compile.sh nim
shell: bash
Expand Down
6 changes: 3 additions & 3 deletions bindings/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ crate-type = ["cdylib"]

[dependencies]
# Enable napi6 feature because we want `BigInt` as a proxy for u64
napi = { version = "2.12.2", default-features = false, features = [
napi = { version = "2.16.3", default-features = false, features = [
"napi6",
"async",
] }
napi-derive = "2.12.2"
napi-derive = "2.16.13"
rust_eth_kzg = { workspace = true, features = ["multithreaded"] }

[build-dependencies]
napi-build = "2.0.1"
napi-build = "2.1.4"
2 changes: 1 addition & 1 deletion bindings/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": "napi version"
},
"devDependencies": {
"@napi-rs/cli": "^2.18.3",
"@napi-rs/cli": "^2",
"@types/jest": "^29.1.2",
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^6.14.0",
Expand Down

0 comments on commit 690dbef

Please sign in to comment.