Skip to content

Commit f70469e

Browse files
authored
fix: linux musl workflow (#151)
* chore: add musl to workflow * docs: add comment in workflow about arm64 windows * fix: copy pasta for CI changes that originated in boilerplate * fix: try using debian container for aarch64-linux-musl * fix: update config.toml * fix: docker node matrix for tests * v2.0.3
1 parent 5b31d63 commit f70469e

File tree

10 files changed

+117
-9
lines changed

10 files changed

+117
-9
lines changed

.cargo/config.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
[target.x86_64-pc-windows-msvc]
2-
rustflags = ["-C", "target-feature=+crt-static"]
2+
rustflags = ["-C", "target-feature=+crt-static"]
3+
4+
[target.aarch64-unknown-linux-musl]
5+
linker = "aarch64-linux-musl-gcc"
6+
rustflags = ["-C", "target-feature=-crt-static"]

.github/workflows/CI.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,28 @@ jobs:
2929
target: x86_64-unknown-linux-gnu
3030
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
3131
build: yarn build --target x86_64-unknown-linux-gnu
32+
- host: ubuntu-latest
33+
target: x86_64-unknown-linux-musl
34+
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
35+
build: yarn build --target x86_64-unknown-linux-musl
3236
- host: macos-latest
3337
target: aarch64-apple-darwin
3438
build: yarn build --target aarch64-apple-darwin
3539
- host: ubuntu-latest
3640
target: aarch64-unknown-linux-gnu
3741
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
3842
build: yarn build --target aarch64-unknown-linux-gnu
43+
- host: ubuntu-latest
44+
target: aarch64-unknown-linux-musl
45+
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
46+
build: |-
47+
set -e &&
48+
rustup target add aarch64-unknown-linux-musl &&
49+
yarn build --target aarch64-unknown-linux-musl
50+
# not sure if we will add this eventually so leaving here as reminder to turn on the build
51+
# - host: windows-latest
52+
# target: aarch64-pc-windows-msvc
53+
# build: yarn build --target aarch64-pc-windows-msvc
3954
name: Build - ${{ matrix.settings.target }} - node@22
4055
runs-on: ${{ matrix.settings.host }}
4156
steps:
@@ -102,6 +117,7 @@ jobs:
102117
name: bindings-${{ matrix.settings.target }}
103118
path: ${{ env.APP_NAME }}.*.node
104119
if-no-files-found: error
120+
105121
test-macOS-windows-binding:
106122
name: Test - ${{ matrix.settings.target }} - node@${{ matrix.node }}
107123
needs:
@@ -184,6 +200,48 @@ jobs:
184200
- name: Spec tests
185201
run: yarn test:spec
186202

203+
test-linux-x64-musl-binding:
204+
name: Test - x86_64-unknown-linux-musl - node@${{ matrix.node }}
205+
needs:
206+
- build
207+
strategy:
208+
fail-fast: false
209+
matrix:
210+
node:
211+
- '18'
212+
- 22.4
213+
runs-on: ubuntu-latest
214+
steps:
215+
- uses: actions/checkout@v4
216+
- name: Setup node
217+
uses: actions/setup-node@v4
218+
with:
219+
node-version: ${{ matrix.node }}
220+
cache: yarn
221+
- name: Install dependencies
222+
run: |
223+
yarn config set supportedArchitectures.libc "musl"
224+
yarn install
225+
- name: Download artifacts
226+
uses: actions/download-artifact@v4
227+
with:
228+
name: bindings-x86_64-unknown-linux-musl
229+
path: .
230+
- name: List packages
231+
run: ls -R .
232+
shell: bash
233+
- name: Test bindings
234+
uses: addnab/docker-run-action@v3
235+
with:
236+
image: node:${{ matrix.node }}-alpine
237+
options: '--platform linux/amd64 -v ${{ github.workspace }}:/build -w /build'
238+
run: |
239+
set -e
240+
yarn test:unit
241+
yarn download-spec-tests
242+
yarn test:spec
243+
ls -la
244+
187245
test-linux-aarch64-gnu-binding:
188246
name: Test - aarch64-unknown-linux-gnu - node@${{ matrix.node }}
189247
needs:
@@ -226,14 +284,60 @@ jobs:
226284
yarn download-spec-tests
227285
yarn test:spec
228286
ls -la
287+
288+
test-linux-aarch64-musl-binding:
289+
name: Test - aarch64-unknown-linux-musl - node@${{ matrix.node }}
290+
needs:
291+
- build
292+
strategy:
293+
fail-fast: false
294+
matrix:
295+
node:
296+
- '18'
297+
- 22.4
298+
runs-on: ubuntu-latest
299+
steps:
300+
- uses: actions/checkout@v4
301+
- name: Download artifacts
302+
uses: actions/download-artifact@v4
303+
with:
304+
name: bindings-aarch64-unknown-linux-musl
305+
path: .
306+
- name: List packages
307+
run: ls -R .
308+
shell: bash
309+
- name: Install dependencies
310+
run: |
311+
yarn config set supportedArchitectures.cpu "arm64"
312+
yarn config set supportedArchitectures.libc "musl"
313+
yarn install
314+
- name: Set up QEMU
315+
uses: docker/setup-qemu-action@v3
316+
with:
317+
platforms: arm64
318+
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
319+
- name: Setup and run tests
320+
uses: addnab/docker-run-action@v3
321+
with:
322+
image: node:${{ matrix.node }}-alpine
323+
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build'
324+
run: |
325+
set -e
326+
yarn test:unit
327+
yarn download-spec-tests
328+
yarn test:spec
329+
ls -la
330+
229331
publish:
230332
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
231333
name: Publish
232334
runs-on: ubuntu-latest
233335
needs:
234336
- test-macOS-windows-binding
235337
- test-linux-x64-gnu-binding
338+
- test-linux-x64-musl-binding
236339
- test-linux-aarch64-gnu-binding
340+
- test-linux-aarch64-musl-binding
237341
steps:
238342
- uses: actions/checkout@v4
239343
- name: Setup node

npm/darwin-arm64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainsafe/blst-darwin-arm64",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"os": [
55
"darwin"
66
],

npm/darwin-x64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainsafe/blst-darwin-x64",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"os": [
55
"darwin"
66
],

npm/linux-arm64-gnu/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainsafe/blst-linux-arm64-gnu",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"os": [
55
"linux"
66
],

npm/linux-arm64-musl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainsafe/blst-linux-arm64-musl",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"os": [
55
"linux"
66
],

npm/linux-x64-gnu/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainsafe/blst-linux-x64-gnu",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"os": [
55
"linux"
66
],

npm/linux-x64-musl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainsafe/blst-linux-x64-musl",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"os": [
55
"linux"
66
],

npm/win32-x64-msvc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainsafe/blst-win32-x64-msvc",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"os": [
55
"win32"
66
],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainsafe/blst",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "Typescript wrapper for supranational/blst native bindings, a highly performant BLS12-381 signature library",
55
"scripts": {
66
"artifacts": "napi artifacts",

0 commit comments

Comments
 (0)