Skip to content

Commit

Permalink
fix: linux musl workflow (#151)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
matthewkeil authored Jul 26, 2024
1 parent 5b31d63 commit f70469e
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
rustflags = ["-C", "target-feature=+crt-static"]

[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
rustflags = ["-C", "target-feature=-crt-static"]
104 changes: 104 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,28 @@ 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
- host: ubuntu-latest
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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -226,14 +284,60 @@ 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
runs-on: ubuntu-latest
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
Expand Down
2 changes: 1 addition & 1 deletion npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainsafe/blst-darwin-arm64",
"version": "2.0.2",
"version": "2.0.3",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainsafe/blst-darwin-x64",
"version": "2.0.2",
"version": "2.0.3",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-arm64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainsafe/blst-linux-arm64-gnu",
"version": "2.0.2",
"version": "2.0.3",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-arm64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainsafe/blst-linux-arm64-musl",
"version": "2.0.2",
"version": "2.0.3",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainsafe/blst-linux-x64-gnu",
"version": "2.0.2",
"version": "2.0.3",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-x64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainsafe/blst-linux-x64-musl",
"version": "2.0.2",
"version": "2.0.3",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainsafe/blst-win32-x64-msvc",
"version": "2.0.2",
"version": "2.0.3",
"os": [
"win32"
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit f70469e

Please sign in to comment.