Skip to content

Commit 59b201d

Browse files
authored
ci(release-napi): support riscv64gc-unknown-linux-gnu and s390x-unknown-linux-gnu (#451)
closes #424
1 parent 23747a2 commit 59b201d

File tree

4 files changed

+51
-14
lines changed

4 files changed

+51
-14
lines changed

.github/workflows/release-napi.yml

+47-12
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,68 @@ jobs:
4949
include:
5050
- os: windows-latest
5151
target: x86_64-pc-windows-msvc
52+
build: |
53+
pnpm build --target x86_64-pc-windows-msvc
54+
5255
- os: windows-latest
5356
target: aarch64-pc-windows-msvc
57+
build: |
58+
pnpm build --target aarch64-pc-windows-msvc
59+
5460
- os: ubuntu-latest
5561
target: x86_64-unknown-linux-gnu
62+
build: |
63+
pnpm build --target x86_64-unknown-linux-gnu --use-napi-cross
64+
5665
- os: ubuntu-latest
5766
target: x86_64-unknown-linux-musl
67+
build: |
68+
pnpm build --target x86_64-unknown-linux-musl -x
69+
5870
- os: ubuntu-latest
5971
target: aarch64-unknown-linux-gnu
72+
build: |
73+
pnpm build --target aarch64-unknown-linux-gnu --use-napi-cross
74+
6075
- os: ubuntu-latest
6176
target: aarch64-unknown-linux-musl
77+
build: |
78+
pnpm build --target aarch64-unknown-linux-musl -x
79+
6280
- os: ubuntu-latest
6381
target: armv7-unknown-linux-gnueabihf
82+
build: |
83+
pnpm build --target armv7-unknown-linux-gnueabihf --use-napi-cross
84+
6485
- os: macos-latest
6586
target: x86_64-apple-darwin
87+
build: |
88+
pnpm build --target x86_64-apple-darwin
89+
6690
- os: macos-latest
6791
target: aarch64-apple-darwin
92+
build: |
93+
pnpm build --target aarch64-apple-darwin
94+
6895
- os: ubuntu-latest
6996
target: wasm32-wasip1-threads
97+
build: |
98+
pnpm build --target wasm32-wasip1-threads
99+
100+
- os: ubuntu-latest
101+
target: s390x-unknown-linux-gnu
102+
build: |
103+
export CFLAGS="-fuse-ld=lld"
104+
pnpm build --target s390x-unknown-linux-gnu --use-napi-cross
105+
106+
- os: ubuntu-latest
107+
target: riscv64gc-unknown-linux-gnu
108+
build: |
109+
sudo apt-get update
110+
sudo apt-get install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu -y
111+
export CC=riscv64-linux-gnu-gcc
112+
export CXX=riscv64-linux-gnu-g++
113+
pnpm build --target riscv64gc-unknown-linux-gnu
70114
71115
name: Package ${{ matrix.target }}
72116
runs-on: ${{ matrix.os }}
@@ -82,25 +126,16 @@ jobs:
82126
with:
83127
version: 0.13.0
84128

85-
- name: Build with zig cross
86-
if: ${{ contains(matrix.target, 'musl') }}
87-
run: pnpm build -x --target ${{ matrix.target }}
88-
89-
- name: Build with napi cross
90-
if: ${{ contains(matrix.target, 'gnu') }}
91-
env:
92-
CC: clang # for mimalloc
93-
run: pnpm build --use-napi-cross --target ${{ matrix.target }}
94-
95129
- name: Build
96-
if: ${{ !contains(matrix.target, 'gnu') && !contains(matrix.target, 'musl') }}
130+
run: ${{ matrix.build }}
131+
shell: bash
97132
env:
98133
CC: clang # for mimalloc
99-
run: pnpm build --target ${{ matrix.target }}
100134

101135
- name: Upload artifacts
102136
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
103137
with:
138+
if-no-files-found: 'error'
104139
name: bindings-${{ matrix.target }}
105140
path: |
106141
napi/*.node

napi/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
2020
[target.'cfg(all(not(target_os = "linux"), not(target_os = "freebsd"), not(target_arch = "arm"), not(target_family = "wasm")))'.dependencies]
2121
mimalloc-safe = { version = "0.1.50", features = ["skip_collect_on_exit"] }
2222

23-
[target.'cfg(any(all(target_os = "linux", not(target_arch = "arm")), target_os = "freebsd"))'.dependencies]
23+
[target.'cfg(all(target_os = "linux", not(target_arch = "arm")))'.dependencies]
2424
mimalloc-safe = { version = "0.1.50", features = ["skip_collect_on_exit", "local_dynamic_tls"] }
2525

2626
[build-dependencies]

napi/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(all(not(target_arch = "arm"), not(target_family = "wasm")))]
1+
#[cfg(all(not(target_arch = "arm"), not(target_os = "freebsd"), not(target_family = "wasm")))]
22
#[global_allocator]
33
static ALLOC: mimalloc_safe::MiMalloc = mimalloc_safe::MiMalloc;
44

npm/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
"aarch64-unknown-linux-gnu",
3737
"aarch64-unknown-linux-musl",
3838
"armv7-unknown-linux-gnueabihf",
39+
"s390x-unknown-linux-gnu",
40+
"riscv64gc-unknown-linux-gnu",
3941
"x86_64-apple-darwin",
4042
"aarch64-apple-darwin",
4143
"wasm32-wasip1-threads"

0 commit comments

Comments
 (0)