Skip to content

Commit 1026541

Browse files
committed
chore: update docs and ci
1 parent 2316f65 commit 1026541

File tree

4 files changed

+254
-56
lines changed

4 files changed

+254
-56
lines changed

.github/workflows/CI.yml

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -27,76 +27,76 @@ jobs:
2727
settings:
2828
- host: macos-13
2929
target: x86_64-apple-darwin
30-
build: yarn build --target x86_64-apple-darwin
30+
build: npm run build -- --target x86_64-apple-darwin
3131
- host: windows-latest
32-
build: yarn build --target x86_64-pc-windows-msvc
32+
build: npm run build -- --target x86_64-pc-windows-msvc
3333
target: x86_64-pc-windows-msvc
3434
- host: windows-latest
3535
build: |
3636
rustup target add i686-pc-windows-msvc &&
37-
yarn build --target i686-pc-windows-msvc
38-
yarn test
37+
npm run build -- --target i686-pc-windows-msvc
38+
npm test
3939
target: i686-pc-windows-msvc
4040
- host: ubuntu-latest
4141
target: x86_64-unknown-linux-gnu
4242
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
43-
build: yarn build --target x86_64-unknown-linux-gnu
43+
build: npm run build -- --target x86_64-unknown-linux-gnu
4444
- host: ubuntu-latest
4545
target: x86_64-unknown-linux-musl
4646
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
47-
build: yarn build --target x86_64-unknown-linux-musl
47+
build: npm run build -- --target x86_64-unknown-linux-musl
4848
- host: macos-latest
4949
target: aarch64-apple-darwin
50-
build: yarn build --target aarch64-apple-darwin
50+
build: npm run build -- --target aarch64-apple-darwin
5151
- host: ubuntu-latest
5252
target: aarch64-unknown-linux-gnu
5353
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
5454
build: |
5555
rustup target add aarch64-unknown-linux-gnu &&
56-
yarn build --target aarch64-unknown-linux-gnu
56+
npm run build -- --target aarch64-unknown-linux-gnu
5757
- host: ubuntu-latest
5858
target: armv7-unknown-linux-gnueabihf
5959
setup: |
6060
sudo apt-get update
6161
sudo apt-get install gcc-arm-linux-gnueabihf -y
6262
build: |
6363
rustup target add armv7-unknown-linux-gnueabihf &&
64-
yarn build --target armv7-unknown-linux-gnueabihf
64+
npm run build -- --target armv7-unknown-linux-gnueabihf
6565
- host: ubuntu-latest
6666
target: armv7-unknown-linux-musleabihf
6767
build: |
6868
rustup target add armv7-unknown-linux-musleabihf &&
69-
yarn build --target armv7-unknown-linux-musleabihf
69+
npm run build -- --target armv7-unknown-linux-musleabihf
7070
- host: ubuntu-latest
7171
target: aarch64-linux-android
7272
build: |
7373
rustup target add aarch64-linux-android &&
74-
yarn build --target aarch64-linux-android
74+
npm run build -- --target aarch64-linux-android
7575
- host: ubuntu-latest
7676
target: armv7-linux-androideabi
7777
build: |
7878
rustup target add armv7-linux-androideabi &&
79-
yarn build --target armv7-linux-androideabi
79+
npm run build -- --target armv7-linux-androideabi
8080
- host: ubuntu-latest
8181
target: aarch64-unknown-linux-musl
8282
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
8383
build: |-
8484
set -e &&
8585
rustup target add aarch64-unknown-linux-musl &&
86-
yarn build --target aarch64-unknown-linux-musl
86+
npm run build -- --target aarch64-unknown-linux-musl
8787
- host: windows-latest
8888
target: aarch64-pc-windows-msvc
8989
build: |
9090
rustup target add aarch64-pc-windows-msvc &&
91-
yarn build --target aarch64-pc-windows-msvc
91+
npm run build -- --target aarch64-pc-windows-msvc
9292
- host: ubuntu-latest
9393
target: riscv64gc-unknown-linux-gnu
9494
setup: |
9595
sudo apt-get update
9696
sudo apt-get install gcc-riscv64-linux-gnu -y
9797
build: |
9898
rustup target add riscv64gc-unknown-linux-gnu &&
99-
yarn build --target riscv64gc-unknown-linux-gnu
99+
npm run build -- --target riscv64gc-unknown-linux-gnu
100100
name: stable - ${{ matrix.settings.target }} - node@20
101101
runs-on: ${{ matrix.settings.host }}
102102
steps:
@@ -106,7 +106,7 @@ jobs:
106106
if: ${{ !matrix.settings.docker }}
107107
with:
108108
node-version: 20
109-
cache: yarn
109+
cache: npm
110110
- name: Install
111111
uses: dtolnay/rust-toolchain@stable
112112
if: ${{ !matrix.settings.docker }}
@@ -133,16 +133,16 @@ jobs:
133133
shell: bash
134134
- name: Setup node x86
135135
if: matrix.settings.target == 'i686-pc-windows-msvc'
136-
run: yarn config set supportedArchitectures.cpu "ia32"
136+
run: npm config set arch ia32
137137
shell: bash
138138
- name: Install dependencies
139-
run: yarn install
139+
run: npm install
140140
- name: Setup node x86
141141
uses: actions/setup-node@v4
142142
if: matrix.settings.target == 'i686-pc-windows-msvc'
143143
with:
144144
node-version: 20
145-
cache: yarn
145+
cache: npm
146146
architecture: x86
147147
- name: Build in docker
148148
uses: addnab/docker-run-action@v3
@@ -181,27 +181,25 @@ jobs:
181181
shell: bash
182182
run: |
183183
sudo pkg install -y -f curl node libnghttp2 npm
184-
sudo npm install -g yarn --ignore-scripts
185184
curl https://sh.rustup.rs -sSf --output rustup.sh
186185
sh rustup.sh -y --profile minimal --default-toolchain stable
187186
source "$HOME/.cargo/env"
188187
echo "~~~~ rustc --version ~~~~"
189188
rustc --version
190189
echo "~~~~ node -v ~~~~"
191190
node -v
192-
echo "~~~~ yarn --version ~~~~"
193-
yarn --version
191+
echo "~~~~ npm --version ~~~~"
192+
npm --version
194193
pwd
195194
ls -lah
196195
whoami
197196
env
198197
freebsd-version
199-
yarn install
200-
yarn build
201-
yarn test
198+
npm install
199+
npm run build
200+
npm test
202201
rm -rf node_modules
203202
rm -rf target
204-
rm -rf .yarn/cache
205203
- name: Upload artifact
206204
uses: actions/upload-artifact@v4
207205
with:
@@ -231,9 +229,9 @@ jobs:
231229
uses: actions/setup-node@v4
232230
with:
233231
node-version: ${{ matrix.node }}
234-
cache: yarn
232+
cache: npm
235233
- name: Install dependencies
236-
run: yarn install
234+
run: npm install
237235
- name: Download artifacts
238236
uses: actions/download-artifact@v4
239237
with:
@@ -243,7 +241,7 @@ jobs:
243241
run: ls -R .
244242
shell: bash
245243
- name: Test bindings
246-
run: yarn test
244+
run: npm test
247245
test-linux-x64-gnu-binding:
248246
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
249247
needs:
@@ -260,9 +258,9 @@ jobs:
260258
uses: actions/setup-node@v4
261259
with:
262260
node-version: ${{ matrix.node }}
263-
cache: yarn
261+
cache: npm
264262
- name: Install dependencies
265-
run: yarn install
263+
run: npm install
266264
- name: Download artifacts
267265
uses: actions/download-artifact@v4
268266
with:
@@ -272,7 +270,7 @@ jobs:
272270
run: ls -R .
273271
shell: bash
274272
- name: Test bindings
275-
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
273+
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim npm test
276274
test-linux-x64-musl-binding:
277275
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
278276
needs:
@@ -289,11 +287,10 @@ jobs:
289287
uses: actions/setup-node@v4
290288
with:
291289
node-version: ${{ matrix.node }}
292-
cache: yarn
290+
cache: npm
293291
- name: Install dependencies
294292
run: |
295-
yarn config set supportedArchitectures.libc "musl"
296-
yarn install
293+
npm install
297294
- name: Download artifacts
298295
uses: actions/download-artifact@v4
299296
with:
@@ -303,7 +300,7 @@ jobs:
303300
run: ls -R .
304301
shell: bash
305302
- name: Test bindings
306-
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test
303+
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine npm test
307304
test-linux-aarch64-gnu-binding:
308305
name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }}
309306
needs:
@@ -326,9 +323,7 @@ jobs:
326323
shell: bash
327324
- name: Install dependencies
328325
run: |
329-
yarn config set supportedArchitectures.cpu "arm64"
330-
yarn config set supportedArchitectures.libc "glibc"
331-
yarn install
326+
npm install
332327
- name: Set up QEMU
333328
uses: docker/setup-qemu-action@v3
334329
with:
@@ -341,7 +336,7 @@ jobs:
341336
options: "--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build"
342337
run: |
343338
set -e
344-
yarn test
339+
npm test
345340
ls -la
346341
test-linux-aarch64-musl-binding:
347342
name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }}
@@ -360,9 +355,7 @@ jobs:
360355
shell: bash
361356
- name: Install dependencies
362357
run: |
363-
yarn config set supportedArchitectures.cpu "arm64"
364-
yarn config set supportedArchitectures.libc "musl"
365-
yarn install
358+
npm install
366359
- name: Set up QEMU
367360
uses: docker/setup-qemu-action@v3
368361
with:
@@ -375,7 +368,7 @@ jobs:
375368
options: "--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build"
376369
run: |
377370
set -e
378-
yarn test
371+
npm test
379372
test-linux-arm-gnueabihf-binding:
380373
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
381374
needs:
@@ -398,8 +391,7 @@ jobs:
398391
shell: bash
399392
- name: Install dependencies
400393
run: |
401-
yarn config set supportedArchitectures.cpu "arm"
402-
yarn install
394+
npm install
403395
- name: Set up QEMU
404396
uses: docker/setup-qemu-action@v3
405397
with:
@@ -412,7 +404,7 @@ jobs:
412404
options: "--platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build"
413405
run: |
414406
set -e
415-
yarn test
407+
npm test
416408
ls -la
417409
universal-macOS:
418410
name: Build universal macOS binary
@@ -425,9 +417,9 @@ jobs:
425417
uses: actions/setup-node@v4
426418
with:
427419
node-version: 20
428-
cache: yarn
420+
cache: npm
429421
- name: Install dependencies
430-
run: yarn install
422+
run: npm install
431423
- name: Download macOS x64 artifact
432424
uses: actions/download-artifact@v4
433425
with:
@@ -439,7 +431,7 @@ jobs:
439431
name: bindings-aarch64-apple-darwin
440432
path: artifacts
441433
- name: Combine binaries
442-
run: yarn universal
434+
run: npm run universal
443435
- name: Upload artifact
444436
uses: actions/upload-artifact@v4
445437
with:
@@ -464,15 +456,15 @@ jobs:
464456
uses: actions/setup-node@v4
465457
with:
466458
node-version: 20
467-
cache: yarn
459+
cache: npm
468460
- name: Install dependencies
469-
run: yarn install
461+
run: npm install
470462
- name: Download all artifacts
471463
uses: actions/download-artifact@v4
472464
with:
473465
path: artifacts
474466
- name: Move artifacts
475-
run: yarn artifacts
467+
run: npm run artifacts
476468
- name: List packages
477469
run: ls -R ./npm
478470
shell: bash

.yarnrc.yml

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

CONTRIBUTING.zh-CN.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## 开始开发和测试
2+
3+
```bash
4+
npm install
5+
npm run build
6+
npm test
7+
```
8+
9+
## 基准测试
10+
11+
```bash
12+
cargo benchmark
13+
npm run benchmark
14+
```

0 commit comments

Comments
 (0)