diff --git a/.cargo/config.toml b/.cargo/config.toml index 0c17df09..3bdd06f4 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,6 @@ [target.x86_64-pc-windows-msvc] -rustflags = ["-C", "target-feature=+crt-static"] \ No newline at end of file +rustflags = ["-C", "target-feature=+crt-static"] + +[target.aarch64-unknown-linux-musl] +linker = "aarch64-linux-musl-gcc" +rustflags = ["-C", "target-feature=-crt-static"] \ No newline at end of file diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e9362435..2ba6a865 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -29,6 +29,10 @@ jobs: target: x86_64-unknown-linux-gnu docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian build: yarn build --target x86_64-unknown-linux-gnu + - host: ubuntu-latest + target: x86_64-unknown-linux-musl + docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine + build: yarn build --target x86_64-unknown-linux-musl - host: macos-latest target: aarch64-apple-darwin build: yarn build --target aarch64-apple-darwin @@ -36,6 +40,17 @@ jobs: target: aarch64-unknown-linux-gnu docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 build: yarn build --target aarch64-unknown-linux-gnu + - host: ubuntu-latest + target: aarch64-unknown-linux-musl + docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine + build: |- + set -e && + rustup target add aarch64-unknown-linux-musl && + yarn build --target aarch64-unknown-linux-musl + # not sure if we will add this eventually so leaving here as reminder to turn on the build + # - host: windows-latest + # target: aarch64-pc-windows-msvc + # build: yarn build --target aarch64-pc-windows-msvc name: Build - ${{ matrix.settings.target }} - node@22 runs-on: ${{ matrix.settings.host }} steps: @@ -102,6 +117,7 @@ jobs: name: bindings-${{ matrix.settings.target }} path: ${{ env.APP_NAME }}.*.node if-no-files-found: error + test-macOS-windows-binding: name: Test - ${{ matrix.settings.target }} - node@${{ matrix.node }} needs: @@ -184,6 +200,48 @@ jobs: - name: Spec tests run: yarn test:spec + test-linux-x64-musl-binding: + name: Test - x86_64-unknown-linux-musl - node@${{ matrix.node }} + needs: + - build + strategy: + fail-fast: false + matrix: + node: + - '18' + - 22.4 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + cache: yarn + - name: Install dependencies + run: | + yarn config set supportedArchitectures.libc "musl" + yarn install + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: bindings-x86_64-unknown-linux-musl + path: . + - name: List packages + run: ls -R . + shell: bash + - name: Test bindings + uses: addnab/docker-run-action@v3 + with: + image: node:${{ matrix.node }}-alpine + options: '--platform linux/amd64 -v ${{ github.workspace }}:/build -w /build' + run: | + set -e + yarn test:unit + yarn download-spec-tests + yarn test:spec + ls -la + test-linux-aarch64-gnu-binding: name: Test - aarch64-unknown-linux-gnu - node@${{ matrix.node }} needs: @@ -226,6 +284,50 @@ jobs: yarn download-spec-tests yarn test:spec ls -la + + test-linux-aarch64-musl-binding: + name: Test - aarch64-unknown-linux-musl - node@${{ matrix.node }} + needs: + - build + strategy: + fail-fast: false + matrix: + node: + - '18' + - 22.4 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: bindings-aarch64-unknown-linux-musl + path: . + - name: List packages + run: ls -R . + shell: bash + - name: Install dependencies + run: | + yarn config set supportedArchitectures.cpu "arm64" + yarn config set supportedArchitectures.libc "musl" + yarn install + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - name: Setup and run tests + uses: addnab/docker-run-action@v3 + with: + image: node:${{ matrix.node }}-alpine + options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build' + run: | + set -e + yarn test:unit + yarn download-spec-tests + yarn test:spec + ls -la + publish: if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' name: Publish @@ -233,7 +335,9 @@ jobs: needs: - test-macOS-windows-binding - test-linux-x64-gnu-binding + - test-linux-x64-musl-binding - test-linux-aarch64-gnu-binding + - test-linux-aarch64-musl-binding steps: - uses: actions/checkout@v4 - name: Setup node diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json index 7d45dd89..ad2e7a73 100644 --- a/npm/darwin-arm64/package.json +++ b/npm/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@chainsafe/blst-darwin-arm64", - "version": "2.0.2", + "version": "2.0.3", "os": [ "darwin" ], diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json index ef8cf8ac..0750cded 100644 --- a/npm/darwin-x64/package.json +++ b/npm/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@chainsafe/blst-darwin-x64", - "version": "2.0.2", + "version": "2.0.3", "os": [ "darwin" ], diff --git a/npm/linux-arm64-gnu/package.json b/npm/linux-arm64-gnu/package.json index 37b546d1..416ef945 100644 --- a/npm/linux-arm64-gnu/package.json +++ b/npm/linux-arm64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@chainsafe/blst-linux-arm64-gnu", - "version": "2.0.2", + "version": "2.0.3", "os": [ "linux" ], diff --git a/npm/linux-arm64-musl/package.json b/npm/linux-arm64-musl/package.json index a6787cc1..a9880313 100644 --- a/npm/linux-arm64-musl/package.json +++ b/npm/linux-arm64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@chainsafe/blst-linux-arm64-musl", - "version": "2.0.2", + "version": "2.0.3", "os": [ "linux" ], diff --git a/npm/linux-x64-gnu/package.json b/npm/linux-x64-gnu/package.json index df7aca8e..7d1a74ee 100644 --- a/npm/linux-x64-gnu/package.json +++ b/npm/linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@chainsafe/blst-linux-x64-gnu", - "version": "2.0.2", + "version": "2.0.3", "os": [ "linux" ], diff --git a/npm/linux-x64-musl/package.json b/npm/linux-x64-musl/package.json index 062acabc..da397457 100644 --- a/npm/linux-x64-musl/package.json +++ b/npm/linux-x64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@chainsafe/blst-linux-x64-musl", - "version": "2.0.2", + "version": "2.0.3", "os": [ "linux" ], diff --git a/npm/win32-x64-msvc/package.json b/npm/win32-x64-msvc/package.json index a76c5e7f..974cf913 100644 --- a/npm/win32-x64-msvc/package.json +++ b/npm/win32-x64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@chainsafe/blst-win32-x64-msvc", - "version": "2.0.2", + "version": "2.0.3", "os": [ "win32" ], diff --git a/package.json b/package.json index e31b13ab..f9195147 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@chainsafe/blst", - "version": "2.0.2", + "version": "2.0.3", "description": "Typescript wrapper for supranational/blst native bindings, a highly performant BLS12-381 signature library", "scripts": { "artifacts": "napi artifacts",