Skip to content

Commit 82f1343

Browse files
committed
fix: ci
1 parent 7d634da commit 82f1343

File tree

20 files changed

+2982
-102
lines changed

20 files changed

+2982
-102
lines changed

.github/workflows/CI.yml

Lines changed: 60 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: CI
22
env:
33
DEBUG: napi:*
4-
APP_NAME: "@domparser-rs/domparser"
4+
APP_NAME: "domparser-rs"
55
MACOSX_DEPLOYMENT_TARGET: "10.13"
66
permissions:
77
contents: write
@@ -27,105 +27,76 @@ jobs:
2727
settings:
2828
- host: macos-13
2929
target: x86_64-apple-darwin
30-
build: npm run build -- --target x86_64-apple-darwin
30+
build: yarn build --target x86_64-apple-darwin
3131
- host: windows-latest
32-
build: npm run build -- --target x86_64-pc-windows-msvc
32+
build: yarn 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-
npm run build -- --target i686-pc-windows-msvc
38-
npm test
37+
yarn build --target i686-pc-windows-msvc
38+
yarn 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: |
44-
set -e &&
45-
apt-get update && apt-get install -y curl &&
46-
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&
47-
apt-get install -y nodejs &&
48-
rustup update stable &&
49-
npm install &&
50-
npm run build -- --target x86_64-unknown-linux-gnu
43+
build: yarn build --target x86_64-unknown-linux-gnu
5144
- host: ubuntu-latest
5245
target: x86_64-unknown-linux-musl
5346
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
54-
build: |
55-
set -e &&
56-
rm -f /usr/local/bin/node /usr/local/bin/npm /usr/local/bin/npx &&
57-
apk del nodejs npm || true &&
58-
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/v3.20/main --repository=http://dl-cdn.alpinelinux.org/alpine/v3.20/community nodejs npm &&
59-
node -v &&
60-
rustup update stable &&
61-
npm install &&
62-
npm run build -- --target x86_64-unknown-linux-musl
47+
build: yarn build --target x86_64-unknown-linux-musl
6348
- host: macos-latest
6449
target: aarch64-apple-darwin
65-
build: npm run build -- --target aarch64-apple-darwin
50+
build: yarn build --target aarch64-apple-darwin
6651
- host: ubuntu-latest
6752
target: aarch64-unknown-linux-gnu
6853
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
6954
build: |
70-
set -e &&
71-
apt-get update && apt-get install -y curl &&
72-
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&
73-
apt-get install -y nodejs &&
74-
rustup update stable &&
75-
npm install &&
7655
rustup target add aarch64-unknown-linux-gnu &&
77-
npm run build -- --target aarch64-unknown-linux-gnu
56+
yarn build --target aarch64-unknown-linux-gnu
7857
- host: ubuntu-latest
7958
target: armv7-unknown-linux-gnueabihf
8059
setup: |
8160
sudo apt-get update
8261
sudo apt-get install gcc-arm-linux-gnueabihf -y
8362
build: |
84-
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
8563
rustup target add armv7-unknown-linux-gnueabihf &&
86-
npm run build -- --target armv7-unknown-linux-gnueabihf
64+
yarn build --target armv7-unknown-linux-gnueabihf
8765
- host: ubuntu-latest
8866
target: armv7-unknown-linux-musleabihf
8967
build: |
9068
rustup target add armv7-unknown-linux-musleabihf &&
91-
npm run build -- --target armv7-unknown-linux-musleabihf --cross-compile
69+
yarn build --target armv7-unknown-linux-musleabihf
9270
- host: ubuntu-latest
9371
target: aarch64-linux-android
9472
build: |
9573
rustup target add aarch64-linux-android &&
96-
npm run build -- --target aarch64-linux-android --cross-compile
74+
yarn build --target aarch64-linux-android
9775
- host: ubuntu-latest
9876
target: armv7-linux-androideabi
9977
build: |
10078
rustup target add armv7-linux-androideabi &&
101-
npm run build -- --target armv7-linux-androideabi --cross-compile
79+
yarn build --target armv7-linux-androideabi
10280
- host: ubuntu-latest
10381
target: aarch64-unknown-linux-musl
10482
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
10583
build: |-
10684
set -e &&
107-
rm -f /usr/local/bin/node /usr/local/bin/npm /usr/local/bin/npx &&
108-
apk del nodejs npm || true &&
109-
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/v3.20/main --repository=http://dl-cdn.alpinelinux.org/alpine/v3.20/community nodejs npm &&
110-
node -v &&
111-
rustup update stable &&
112-
npm install &&
11385
rustup target add aarch64-unknown-linux-musl &&
114-
npm run build -- --target aarch64-unknown-linux-musl
86+
yarn build --target aarch64-unknown-linux-musl
11587
- host: windows-latest
11688
target: aarch64-pc-windows-msvc
11789
build: |
11890
rustup target add aarch64-pc-windows-msvc &&
119-
npm run build -- --target aarch64-pc-windows-msvc
91+
yarn build --target aarch64-pc-windows-msvc
12092
- host: ubuntu-latest
12193
target: riscv64gc-unknown-linux-gnu
12294
setup: |
12395
sudo apt-get update
12496
sudo apt-get install gcc-riscv64-linux-gnu -y
12597
build: |
126-
export CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER=riscv64-linux-gnu-gcc
12798
rustup target add riscv64gc-unknown-linux-gnu &&
128-
npm run build -- --target riscv64gc-unknown-linux-gnu
99+
yarn build --target riscv64gc-unknown-linux-gnu
129100
name: stable - ${{ matrix.settings.target }} - node@20
130101
runs-on: ${{ matrix.settings.host }}
131102
steps:
@@ -135,7 +106,7 @@ jobs:
135106
if: ${{ !matrix.settings.docker }}
136107
with:
137108
node-version: 20
138-
cache: npm
109+
cache: yarn
139110
- name: Install
140111
uses: dtolnay/rust-toolchain@stable
141112
if: ${{ !matrix.settings.docker }}
@@ -153,23 +124,26 @@ jobs:
153124
target/
154125
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
155126
- uses: goto-bus-stop/setup-zig@v2
156-
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' || matrix.settings.target == 'armv7-unknown-linux-musleabihf' || matrix.settings.target == 'aarch64-linux-android' || matrix.settings.target == 'armv7-linux-androideabi' }}
127+
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' || matrix.settings.target == 'armv7-unknown-linux-musleabihf' }}
157128
with:
158129
version: 0.13.0
159130
- name: Setup toolchain
160131
run: ${{ matrix.settings.setup }}
161132
if: ${{ matrix.settings.setup }}
162133
shell: bash
134+
- name: Setup node x86
135+
if: matrix.settings.target == 'i686-pc-windows-msvc'
136+
run: yarn config set supportedArchitectures.cpu "ia32"
137+
shell: bash
138+
- name: Install dependencies
139+
run: yarn install
163140
- name: Setup node x86
164141
uses: actions/setup-node@v4
165142
if: matrix.settings.target == 'i686-pc-windows-msvc'
166143
with:
167144
node-version: 20
168-
cache: npm
145+
cache: yarn
169146
architecture: x86
170-
- name: Install dependencies
171-
if: ${{ !matrix.settings.docker }}
172-
run: npm install
173147
- name: Build in docker
174148
uses: addnab/docker-run-action@v3
175149
if: ${{ matrix.settings.docker }}
@@ -207,25 +181,27 @@ jobs:
207181
shell: bash
208182
run: |
209183
sudo pkg install -y -f curl node libnghttp2 npm
184+
sudo npm install -g yarn --ignore-scripts
210185
curl https://sh.rustup.rs -sSf --output rustup.sh
211186
sh rustup.sh -y --profile minimal --default-toolchain stable
212187
source "$HOME/.cargo/env"
213188
echo "~~~~ rustc --version ~~~~"
214189
rustc --version
215190
echo "~~~~ node -v ~~~~"
216191
node -v
217-
echo "~~~~ npm --version ~~~~"
218-
npm --version
192+
echo "~~~~ yarn --version ~~~~"
193+
yarn --version
219194
pwd
220195
ls -lah
221196
whoami
222197
env
223198
freebsd-version
224-
npm install
225-
npm run build
226-
npm test
199+
yarn install
200+
yarn build
201+
yarn test
227202
rm -rf node_modules
228203
rm -rf target
204+
rm -rf .yarn/cache
229205
- name: Upload artifact
230206
uses: actions/upload-artifact@v4
231207
with:
@@ -255,9 +231,9 @@ jobs:
255231
uses: actions/setup-node@v4
256232
with:
257233
node-version: ${{ matrix.node }}
258-
cache: npm
234+
cache: yarn
259235
- name: Install dependencies
260-
run: npm install
236+
run: yarn install
261237
- name: Download artifacts
262238
uses: actions/download-artifact@v4
263239
with:
@@ -267,7 +243,7 @@ jobs:
267243
run: ls -R .
268244
shell: bash
269245
- name: Test bindings
270-
run: npm test
246+
run: yarn test
271247
test-linux-x64-gnu-binding:
272248
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
273249
needs:
@@ -284,9 +260,9 @@ jobs:
284260
uses: actions/setup-node@v4
285261
with:
286262
node-version: ${{ matrix.node }}
287-
cache: npm
263+
cache: yarn
288264
- name: Install dependencies
289-
run: npm install
265+
run: yarn install
290266
- name: Download artifacts
291267
uses: actions/download-artifact@v4
292268
with:
@@ -296,7 +272,7 @@ jobs:
296272
run: ls -R .
297273
shell: bash
298274
- name: Test bindings
299-
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim npm test
275+
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
300276
test-linux-x64-musl-binding:
301277
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
302278
needs:
@@ -313,10 +289,11 @@ jobs:
313289
uses: actions/setup-node@v4
314290
with:
315291
node-version: ${{ matrix.node }}
316-
cache: npm
292+
cache: yarn
317293
- name: Install dependencies
318294
run: |
319-
npm install
295+
yarn config set supportedArchitectures.libc "musl"
296+
yarn install
320297
- name: Download artifacts
321298
uses: actions/download-artifact@v4
322299
with:
@@ -326,7 +303,7 @@ jobs:
326303
run: ls -R .
327304
shell: bash
328305
- name: Test bindings
329-
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine npm test
306+
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test
330307
test-linux-aarch64-gnu-binding:
331308
name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }}
332309
needs:
@@ -349,7 +326,9 @@ jobs:
349326
shell: bash
350327
- name: Install dependencies
351328
run: |
352-
npm install
329+
yarn config set supportedArchitectures.cpu "arm64"
330+
yarn config set supportedArchitectures.libc "glibc"
331+
yarn install
353332
- name: Set up QEMU
354333
uses: docker/setup-qemu-action@v3
355334
with:
@@ -362,7 +341,7 @@ jobs:
362341
options: "--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build"
363342
run: |
364343
set -e
365-
npm test
344+
yarn test
366345
ls -la
367346
test-linux-aarch64-musl-binding:
368347
name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }}
@@ -381,7 +360,9 @@ jobs:
381360
shell: bash
382361
- name: Install dependencies
383362
run: |
384-
npm install
363+
yarn config set supportedArchitectures.cpu "arm64"
364+
yarn config set supportedArchitectures.libc "musl"
365+
yarn install
385366
- name: Set up QEMU
386367
uses: docker/setup-qemu-action@v3
387368
with:
@@ -394,7 +375,7 @@ jobs:
394375
options: "--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build"
395376
run: |
396377
set -e
397-
npm test
378+
yarn test
398379
test-linux-arm-gnueabihf-binding:
399380
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
400381
needs:
@@ -417,7 +398,8 @@ jobs:
417398
shell: bash
418399
- name: Install dependencies
419400
run: |
420-
npm install
401+
yarn config set supportedArchitectures.cpu "arm"
402+
yarn install
421403
- name: Set up QEMU
422404
uses: docker/setup-qemu-action@v3
423405
with:
@@ -430,7 +412,7 @@ jobs:
430412
options: "--platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build"
431413
run: |
432414
set -e
433-
npm test
415+
yarn test
434416
ls -la
435417
universal-macOS:
436418
name: Build universal macOS binary
@@ -443,9 +425,9 @@ jobs:
443425
uses: actions/setup-node@v4
444426
with:
445427
node-version: 20
446-
cache: npm
428+
cache: yarn
447429
- name: Install dependencies
448-
run: npm install
430+
run: yarn install
449431
- name: Download macOS x64 artifact
450432
uses: actions/download-artifact@v4
451433
with:
@@ -457,7 +439,7 @@ jobs:
457439
name: bindings-aarch64-apple-darwin
458440
path: artifacts
459441
- name: Combine binaries
460-
run: npm run universal
442+
run: yarn universal
461443
- name: Upload artifact
462444
uses: actions/upload-artifact@v4
463445
with:
@@ -482,15 +464,15 @@ jobs:
482464
uses: actions/setup-node@v4
483465
with:
484466
node-version: 20
485-
cache: npm
467+
cache: yarn
486468
- name: Install dependencies
487-
run: npm install
469+
run: yarn install
488470
- name: Download all artifacts
489471
uses: actions/download-artifact@v4
490472
with:
491473
path: artifacts
492474
- name: Move artifacts
493-
run: npm run artifacts
475+
run: yarn artifacts
494476
- name: List packages
495477
run: ls -R ./npm
496478
shell: bash
@@ -510,4 +492,4 @@ jobs:
510492
fi
511493
env:
512494
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
513-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
495+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
cargo fmt
55

6-
npx taplo format
6+
npx @taplo/cli format

.yarn/install-state.gz

158 KB
Binary file not shown.

0 commit comments

Comments
 (0)