Skip to content

Commit 2168278

Browse files
authored
ci: test on more platform (#73)
1 parent 8cc5242 commit 2168278

File tree

4 files changed

+64
-71
lines changed

4 files changed

+64
-71
lines changed

.github/workflows/CI.yml

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,34 @@ concurrency:
2323
group: ${{ github.workflow }}-${{ github.ref }}
2424
cancel-in-progress: true
2525
jobs:
26+
lint:
27+
name: Lint
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Setup node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 22
36+
cache: 'yarn'
37+
38+
- name: Install
39+
uses: dtolnay/rust-toolchain@stable
40+
with:
41+
components: clippy, rustfmt
42+
43+
- name: Install dependencies
44+
run: yarn install
45+
46+
- name: oxlint
47+
run: yarn lint
48+
49+
- name: Cargo fmt
50+
run: cargo fmt -- --check
51+
52+
- name: Clippy
53+
run: cargo clippy
2654
build:
2755
strategy:
2856
fail-fast: false
@@ -35,9 +63,7 @@ jobs:
3563
build: yarn build --target x86_64-pc-windows-msvc
3664
target: x86_64-pc-windows-msvc
3765
- host: windows-latest
38-
build: |
39-
yarn build --target i686-pc-windows-msvc
40-
yarn test
66+
build: yarn build --target i686-pc-windows-msvc
4167
target: i686-pc-windows-msvc
4268
- host: ubuntu-latest
4369
target: x86_64-unknown-linux-gnu
@@ -81,9 +107,9 @@ jobs:
81107
- host: ubuntu-latest
82108
target: wasm32-wasip1-threads
83109
build: |
84-
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0-linux.tar.gz
85-
tar -xvf wasi-sdk-22.0-linux.tar.gz
86-
export WASI_SDK_PATH="$(pwd)/wasi-sdk-22.0"
110+
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz
111+
tar -xvf wasi-sdk-25.0-x86_64-linux.tar.gz
112+
export WASI_SDK_PATH="$(pwd)/wasi-sdk-25.0-x86_64-linux"
87113
yarn build --target wasm32-wasip1-threads
88114
name: stable - ${{ matrix.settings.target }} - node@20
89115
runs-on: ${{ matrix.settings.host }}
@@ -126,18 +152,8 @@ jobs:
126152
run: ${{ matrix.settings.setup }}
127153
if: ${{ matrix.settings.setup }}
128154
shell: bash
129-
- name: Setup node x86
130-
if: matrix.settings.target == 'i686-pc-windows-msvc'
131-
run: yarn config set supportedArchitectures.cpu "ia32"
132-
shell: bash
133155
- name: Install dependencies
134156
run: yarn install
135-
- name: Setup node x86
136-
uses: actions/setup-node@v4
137-
if: matrix.settings.target == 'i686-pc-windows-msvc'
138-
with:
139-
node-version: 20
140-
architecture: x86
141157
- name: Build
142158
run: ${{ matrix.settings.build }}
143159
shell: bash
@@ -186,6 +202,7 @@ jobs:
186202
freebsd-version
187203
yarn install
188204
yarn build
205+
yarn test
189206
rm -rf node_modules
190207
rm -rf target
191208
rm -rf .yarn/cache
@@ -206,15 +223,21 @@ jobs:
206223
- host: windows-latest
207224
target: x86_64-pc-windows-msvc
208225
architecture: x64
226+
- host: windows-latest
227+
target: i686-pc-windows-msvc
228+
architecture: x64
229+
- host: windows-11-arm
230+
target: aarch64-pc-windows-msvc
231+
architecture: arm64
209232
- host: macos-latest
210233
target: x86_64-apple-darwin
211234
architecture: x64
212235
- host: macos-latest
213236
target: aarch64-apple-darwin
214237
architecture: arm64
215238
node:
216-
- '18'
217239
- '20'
240+
- '22'
218241
runs-on: ${{ matrix.settings.host }}
219242
steps:
220243
- uses: actions/checkout@v4
@@ -225,7 +248,19 @@ jobs:
225248
cache: yarn
226249
architecture: ${{ matrix.settings.architecture }}
227250
- name: Install dependencies
251+
if: ${{ matrix.settings.target == 'i686-pc-windows-msvc' }}
252+
run: |
253+
yarn config set --json supportedArchitectures.cpu '["current", "ia32"]'
254+
yarn install
255+
- name: Install dependencies
256+
if: ${{ matrix.settings.target != 'i686-pc-windows-msvc' }}
228257
run: yarn install
258+
- name: Setup node
259+
if: ${{ matrix.settings.target == 'i686-pc-windows-msvc' }}
260+
uses: actions/setup-node@v4
261+
with:
262+
node-version: ${{ matrix.node }}
263+
architecture: x86
229264
- name: Download artifacts
230265
uses: actions/download-artifact@v4
231266
with:
@@ -252,15 +287,9 @@ jobs:
252287
- s390x-unknown-linux-gnu
253288
- powerpc64le-unknown-linux-gnu
254289
node:
255-
- '18'
256290
- '20'
257-
exclude:
258-
# too slow
259-
- target: aarch64-unknown-linux-gnu
260-
node: '18'
261-
- target: s390x-unknown-linux-gnu
262-
node: '18'
263-
runs-on: ubuntu-latest
291+
- '22'
292+
runs-on: ${{ contains(matrix.target, 'aarch64') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
264293
steps:
265294
- uses: actions/checkout@v4
266295
- name: Setup node
@@ -306,12 +335,16 @@ jobs:
306335
run: ls -R .
307336
shell: bash
308337
- name: Set up QEMU
338+
if: ${{ !contains(matrix.target, 'aarch64') }}
309339
uses: docker/setup-qemu-action@v3
310340
with:
311341
platforms: all
312342
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
343+
if: ${{ !contains(matrix.target, 'aarch64') }}
313344
- name: Test bindings
314345
uses: addnab/docker-run-action@v3
346+
# Node.js on qemu randomly segfaults on powerpc64le
347+
continue-on-error: ${{ matrix.target == 'powerpc64le-unknown-linux-gnu' }}
315348
with:
316349
image: ${{ steps.docker.outputs.IMAGE }}
317350
options: -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }}
@@ -325,8 +358,8 @@ jobs:
325358
fail-fast: false
326359
matrix:
327360
node:
328-
- '18'
329361
- '20'
362+
- '22'
330363
runs-on: ubuntu-latest
331364
steps:
332365
- uses: actions/checkout@v4
@@ -353,6 +386,7 @@ jobs:
353386
name: Publish
354387
runs-on: ubuntu-latest
355388
needs:
389+
- lint
356390
- build-freebsd
357391
- test-macOS-windows-binding
358392
- test-linux-binding
@@ -362,7 +396,7 @@ jobs:
362396
- name: Setup node
363397
uses: actions/setup-node@v4
364398
with:
365-
node-version: 20
399+
node-version: 22
366400
cache: yarn
367401
- name: Install dependencies
368402
run: yarn install

.github/workflows/lint.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ napi = { version = "2", features = ["anyhow", "napi6"] }
1919
napi-derive = "2"
2020
tar = "0.4"
2121

22-
[target.'cfg(all(not(target_os = "linux"), not(target_family = "wasm")))'.dependencies]
22+
[target.'cfg(all(not(target_os = "linux"), not(target_os = "freebsd"), not(target_arch = "x86"), not(target_family = "wasm")))'.dependencies]
2323
mimalloc = "0.1"
2424

25-
[target.'cfg(target_os = "linux")'.dependencies]
25+
[target.'cfg(any(target_os = "linux", target_os = "freebsd"))'.dependencies]
2626
mimalloc = { version = "0.1", features = ["local_dynamic_tls"] }
2727

2828
[build-dependencies]

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::entry::Entries;
1616
mod entry;
1717
mod header;
1818

19-
#[cfg(not(target_family = "wasm"))]
19+
#[cfg(all(not(target_family = "wasm"), not(target_arch = "x86")))]
2020
#[global_allocator]
2121
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
2222

0 commit comments

Comments
 (0)