@napi-rs/cli 3.0.0-alpha.91 → 3.0.0-alpha.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,602 +0,0 @@
1
- import type { SupportedPackageManager } from '../../utils/config.js'
2
-
3
- export type WasiTargetName =
4
- | 'wasm32-wasi-preview1-threads'
5
- | 'wasm32-wasip1-threads'
6
- | 'wasm32-wasip2'
7
-
8
- export const YAML = (
9
- packageManager: SupportedPackageManager,
10
- wasiTargetName: WasiTargetName,
11
- ) => `
12
- name: CI
13
-
14
- env:
15
- DEBUG: 'napi:*'
16
- MACOSX_DEPLOYMENT_TARGET: '10.13'
17
-
18
- permissions:
19
- contents: write
20
- id-token: write
21
-
22
- on:
23
- push:
24
- branches:
25
- - main
26
- tags-ignore:
27
- - '**'
28
- paths-ignore:
29
- - '**/*.md'
30
- - 'LICENSE'
31
- - '**/*.gitignore'
32
- - '.editorconfig'
33
- - 'docs/**'
34
- pull_request:
35
-
36
- jobs:
37
- build:
38
-
39
- strategy:
40
- fail-fast: false
41
- matrix:
42
- settings:
43
- - host: macos-latest
44
- target: 'x86_64-apple-darwin'
45
- build: ${packageManager} build --platform --target x86_64-apple-darwin
46
- - host: windows-latest
47
- build: ${packageManager} build --platform
48
- target: 'x86_64-pc-windows-msvc'
49
- - host: windows-latest
50
- build: |
51
- ${packageManager} build --platform --target i686-pc-windows-msvc
52
- ${packageManager} test
53
- target: 'i686-pc-windows-msvc'
54
- - host: ubuntu-latest
55
- target: 'x86_64-unknown-linux-gnu'
56
- build: ${packageManager} build --platform --target x86_64-unknown-linux-gnu --use-napi-cross
57
- - host: ubuntu-latest
58
- target: 'x86_64-unknown-linux-musl'
59
- build: ${packageManager} build --platform --target x86_64-unknown-linux-musl -x
60
- - host: macos-latest
61
- target: 'aarch64-apple-darwin'
62
- build: ${packageManager} build --platform --target aarch64-apple-darwin
63
- - host: ubuntu-latest
64
- target: 'aarch64-unknown-linux-gnu'
65
- build: ${packageManager} build --platform --target aarch64-unknown-linux-gnu --use-napi-cross
66
- - host: ubuntu-latest
67
- target: 'armv7-unknown-linux-gnueabihf'
68
- build: ${packageManager} build --platform --target armv7-unknown-linux-gnueabihf --use-napi-cross
69
- - host: ubuntu-latest
70
- target: 'armv7-unknown-linux-musleabihf'
71
- build: ${packageManager} build --platform --target armv7-unknown-linux-musleabihf -x
72
- - host: ubuntu-latest
73
- target: 'aarch64-linux-android'
74
- build: ${packageManager} build --platform --target aarch64-linux-android
75
- - host: ubuntu-latest
76
- target: 'armv7-linux-androideabi'
77
- build: ${packageManager} build --platform --target armv7-linux-androideabi
78
- - host: ubuntu-latest
79
- target: 'aarch64-unknown-linux-musl'
80
- build: ${packageManager} build --platform --target aarch64-unknown-linux-musl -x
81
- - host: windows-latest
82
- target: 'aarch64-pc-windows-msvc'
83
- build: ${packageManager} build --platform --target aarch64-pc-windows-msvc
84
- - host: ubuntu-latest
85
- target: 'riscv64gc-unknown-linux-gnu'
86
- setup: |
87
- sudo apt-get update
88
- sudo apt-get install gcc-riscv64-linux-gnu -y
89
- build: ${packageManager} build --platform --target riscv64gc-unknown-linux-gnu
90
- - host: ubuntu-latest
91
- target: 'powerpc64le-unknown-linux-gnu'
92
- setup: |
93
- sudo apt-get update
94
- sudo apt-get install gcc-powerpc64le-linux-gnu -y
95
- build: ${packageManager} build --platform --target powerpc64le-unknown-linux-gnu
96
- - host: ubuntu-latest
97
- target: 's390x-unknown-linux-gnu'
98
- setup: |
99
- sudo apt-get update
100
- sudo apt-get install gcc-s390x-linux-gnu -y
101
- build: ${packageManager} build --platform --target s390x-unknown-linux-gnu
102
- - host: ubuntu-latest
103
- target: '${wasiTargetName}'
104
- build: ${packageManager} build --platform --target ${wasiTargetName}
105
-
106
- name: stable - \${{ matrix.settings.target }} - node@20
107
- runs-on: \${{ matrix.settings.host }}
108
-
109
- steps:
110
- - uses: actions/checkout@v4
111
-
112
- - name: Setup node
113
- uses: actions/setup-node@v4
114
- with:
115
- node-version: 20
116
- cache: ${packageManager}
117
-
118
- - name: Install
119
- uses: dtolnay/rust-toolchain@stable
120
- with:
121
- toolchain: stable
122
- targets: \${{ matrix.settings.target }}
123
-
124
- - name: Cache cargo
125
- uses: actions/cache@v4
126
- with:
127
- path: |
128
- ~/.cargo/registry/index/
129
- ~/.cargo/registry/cache/
130
- ~/.cargo/git/db/
131
- ~/.napi-rs
132
- .cargo-cache
133
- target/
134
- key: \${{ matrix.settings.target }}-cargo-\${{ matrix.settings.host }}
135
-
136
- - uses: goto-bus-stop/setup-zig@v2
137
- if: \${{ contains(matrix.settings.target, 'musl') }}
138
- with:
139
- version: 0.13.0
140
-
141
- - name: Install cargo-zigbuild
142
- uses: taiki-e/install-action@v2
143
- if: \${{ contains(matrix.settings.target, 'musl') }}
144
- env:
145
- GITHUB_TOKEN: \${{ github.token }}
146
- with:
147
- tool: cargo-zigbuild
148
-
149
- - name: Setup toolchain
150
- run: \${{ matrix.settings.setup }}
151
- if: \${{ matrix.settings.setup }}
152
- shell: bash
153
-
154
- - name: Setup node x86
155
- if: matrix.settings.target == 'i686-pc-windows-msvc'
156
- run: yarn config set supportedArchitectures.cpu "ia32"
157
- shell: bash
158
-
159
- - name: 'Install dependencies'
160
- run: ${packageManager} install
161
-
162
- - name: Setup node x86
163
- uses: actions/setup-node@v4
164
- if: matrix.settings.target == 'i686-pc-windows-msvc'
165
- with:
166
- node-version: 20
167
- architecture: x86
168
-
169
- - name: 'Build'
170
- run: \${{ matrix.settings.build }}
171
- shell: bash
172
-
173
- - name: Upload artifact
174
- uses: actions/upload-artifact@v4
175
- if: matrix.settings.target != '${wasiTargetName}'
176
- with:
177
- name: bindings-\${{ matrix.settings.target }}
178
- path: "*.node"
179
- if-no-files-found: error
180
-
181
- - name: Upload artifact
182
- uses: actions/upload-artifact@v4
183
- if: matrix.settings.target == '${wasiTargetName}'
184
- with:
185
- name: bindings-\${{ matrix.settings.target }}
186
- path: "*.wasm"
187
- if-no-files-found: error
188
-
189
- build-freebsd:
190
- runs-on: ubuntu-latest
191
- name: Build FreeBSD
192
- steps:
193
- - uses: actions/checkout@v4
194
- - name: Build
195
- id: build
196
- uses: cross-platform-actions/action@v0.25.0
197
- env:
198
- DEBUG: 'napi:*'
199
- RUSTUP_IO_THREADS: 1
200
- with:
201
- operating_system: freebsd
202
- version: '14.1'
203
- memory: 8G
204
- cpu_count: 3
205
- environment_variables: 'DEBUG RUSTUP_IO_THREADS'
206
- shell: bash
207
- run: |
208
- sudo pkg install -y -f curl node libnghttp2 npm
209
- sudo npm install -g ${packageManager} --ignore-scripts
210
- curl https://sh.rustup.rs -sSf --output rustup.sh
211
- sh rustup.sh -y --profile minimal --default-toolchain stable
212
- source "$HOME/.cargo/env"
213
- echo "~~~~ rustc --version ~~~~"
214
- rustc --version
215
- echo "~~~~ node -v ~~~~"
216
- node -v
217
- echo "~~~~ yarn --version ~~~~"
218
- yarn --version
219
- pwd
220
- ls -lah
221
- whoami
222
- env
223
- freebsd-version
224
- ${packageManager} install
225
- ${packageManager} build
226
- strip -x *.node
227
- yarn test
228
- rm -rf node_modules
229
- rm -rf target
230
- rm -rf .yarn/cache
231
- - name: Upload artifact
232
- uses: actions/upload-artifact@v4
233
- with:
234
- name: bindings-freebsd
235
- path: "*.node"
236
- if-no-files-found: error
237
-
238
- test-macOS-windows-binding:
239
- name: Test bindings on \${{ matrix.settings.target }} - node@\${{ matrix.node }}
240
- needs:
241
- - build
242
- strategy:
243
- fail-fast: false
244
- matrix:
245
- settings:
246
- - host: macos-latest
247
- target: 'x86_64-apple-darwin'
248
- architecture: x64
249
- - host: macos-latest
250
- target: 'aarch64-apple-darwin'
251
- architecture: arm64
252
- - host: windows-latest
253
- target: 'x86_64-pc-windows-msvc'
254
- architecture: x64
255
- node: ['18', '20']
256
- runs-on: \${{ matrix.settings.host }}
257
-
258
- steps:
259
- - uses: actions/checkout@v4
260
-
261
- - name: Setup node
262
- uses: actions/setup-node@v4
263
- with:
264
- node-version: \${{ matrix.node }}
265
- cache: '${packageManager}'
266
- architecture: \${{ matrix.settings.architecture }}
267
-
268
- - name: 'Install dependencies'
269
- run: ${packageManager} install
270
-
271
- - name: Download artifacts
272
- uses: actions/download-artifact@v4
273
- with:
274
- name: bindings-\${{ matrix.settings.target }}
275
- path: .
276
-
277
- - name: List packages
278
- run: ls -R .
279
- shell: bash
280
-
281
- - name: Test bindings
282
- run: ${packageManager} run test
283
-
284
- test-linux-x64-gnu-binding:
285
- name: Test bindings on Linux-x64-gnu - node@\${{ matrix.node }}
286
- needs:
287
- - build
288
- strategy:
289
- fail-fast: false
290
- matrix:
291
- node: ['18', '20']
292
- runs-on: ubuntu-latest
293
-
294
- steps:
295
- - uses: actions/checkout@v4
296
-
297
- - name: Setup node
298
- uses: actions/setup-node@v4
299
- with:
300
- node-version: \${{ matrix.node }}
301
- cache: '${packageManager}'
302
-
303
- - name: 'Install dependencies'
304
- run: ${packageManager} install
305
-
306
- - name: Download artifacts
307
- uses: actions/download-artifact@v4
308
- with:
309
- name: bindings-x86_64-unknown-linux-gnu
310
- path: .
311
-
312
- - name: List packages
313
- run: ls -R .
314
- shell: bash
315
-
316
- - name: Test bindings
317
- run: docker run --rm -v $(pwd):/build -w /build node:\${{ matrix.node }}-slim ${packageManager} run test
318
-
319
- test-linux-x64-musl-binding:
320
- name: Test bindings on x86_64-unknown-linux-musl - node@\${{ matrix.node }}
321
- needs:
322
- - build
323
- strategy:
324
- fail-fast: false
325
- matrix:
326
- node: ['18', '20']
327
- runs-on: ubuntu-latest
328
-
329
- steps:
330
- - uses: actions/checkout@v4
331
-
332
- - name: Setup node
333
- uses: actions/setup-node@v4
334
- with:
335
- node-version: \${{ matrix.node }}
336
- cache: '${packageManager}'
337
-
338
- - name: 'Install dependencies'
339
- run: |
340
- yarn config set supportedArchitectures.libc "musl"
341
- ${packageManager} install
342
-
343
- - name: Download artifacts
344
- uses: actions/download-artifact@v4
345
- with:
346
- name: bindings-x86_64-unknown-linux-musl
347
- path: .
348
-
349
- - name: List packages
350
- run: ls -R .
351
- shell: bash
352
-
353
- - name: Test bindings
354
- run: docker run --rm -v $(pwd):/build -w /build node:\${{ matrix.node }}-alpine ${packageManager} run test
355
-
356
- test-linux-aarch64-gnu-binding:
357
- name: Test bindings on aarch64-unknown-linux-gnu - node@\${{ matrix.node }}
358
- needs:
359
- - build
360
- strategy:
361
- fail-fast: false
362
- matrix:
363
- node: ['20']
364
- runs-on: ubuntu-latest
365
-
366
- steps:
367
- - uses: actions/checkout@v4
368
-
369
- - name: Download artifacts
370
- uses: actions/download-artifact@v4
371
- with:
372
- name: bindings-aarch64-unknown-linux-gnu
373
- path: .
374
-
375
- - name: List packages
376
- run: ls -R .
377
- shell: bash
378
-
379
- - name: Install dependencies
380
- run: |
381
- yarn config set supportedArchitectures.cpu "arm64"
382
- yarn config set supportedArchitectures.libc "glibc"
383
- ${packageManager} install
384
-
385
- - name: Set up QEMU
386
- uses: docker/setup-qemu-action@v3
387
- with:
388
- platforms: arm64
389
- - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
390
-
391
- - name: Setup and run tests
392
- uses: addnab/docker-run-action@v3
393
- with:
394
- image: node:\${{ matrix.node }}-slim
395
- options: --platform linux/arm64 -v \${{ github.workspace }}:/build -w /build
396
- run: ${packageManager} run test
397
-
398
- test-linux-aarch64-musl-binding:
399
- name: Test bindings on aarch64-unknown-linux-musl - node@\${{ matrix.node }}
400
- needs:
401
- - build
402
- strategy:
403
- fail-fast: false
404
- matrix:
405
- node: ['18', '20']
406
-
407
- runs-on: ubuntu-latest
408
-
409
- steps:
410
- - uses: actions/checkout@v4
411
-
412
- - name: Download artifacts
413
- uses: actions/download-artifact@v4
414
- with:
415
- name: bindings-aarch64-unknown-linux-musl
416
- path: .
417
-
418
- - name: List packages
419
- run: ls -R .
420
- shell: bash
421
-
422
- - name: Install dependencies
423
- run: |
424
- yarn config set supportedArchitectures.cpu "arm64"
425
- yarn config set supportedArchitectures.libc "musl"
426
- ${packageManager} install
427
-
428
- - name: Set up QEMU
429
- uses: docker/setup-qemu-action@v3
430
- with:
431
- platforms: arm64
432
- - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
433
-
434
- - name: Setup and run tests
435
- uses: addnab/docker-run-action@v3
436
- with:
437
- image: node:\${{ matrix.node }}-alpine
438
- options: --platform linux/arm64 -v \${{ github.workspace }}:/build -w /build
439
- run: ${packageManager} run test
440
-
441
- test-linux-arm-gnueabihf-binding:
442
- name: Test bindings on armv7-unknown-linux-gnueabihf - node@\${{ matrix.node }}
443
- needs:
444
- - build
445
- strategy:
446
- fail-fast: false
447
- matrix:
448
- node: ['18', '20']
449
- runs-on: ubuntu-latest
450
-
451
- steps:
452
- - uses: actions/checkout@v4
453
-
454
- - name: Download artifacts
455
- uses: actions/download-artifact@v4
456
- with:
457
- name: bindings-armv7-unknown-linux-gnueabihf
458
- path: .
459
-
460
- - name: List packages
461
- run: ls -R .
462
- shell: bash
463
-
464
- - name: Install dependencies
465
- run: |
466
- yarn config set supportedArchitectures.cpu "arm"
467
- ${packageManager} install
468
-
469
- - name: Set up QEMU
470
- uses: docker/setup-qemu-action@v3
471
- with:
472
- platforms: arm
473
- - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
474
-
475
- - name: Setup and run tests
476
- uses: addnab/docker-run-action@v3
477
- with:
478
- image: node:\${{ matrix.node }}-bullseye-slim
479
- options: --platform linux/arm/v7 -v \${{ github.workspace }}:/build -w /build
480
- run: ${packageManager} test
481
-
482
- universal-macOS:
483
- name: Build universal macOS binary
484
- needs:
485
- - build
486
- runs-on: macos-latest
487
-
488
- steps:
489
- - uses: actions/checkout@v4
490
-
491
- - name: Setup node
492
- uses: actions/setup-node@v4
493
- with:
494
- node-version: 20
495
- cache: ${packageManager}
496
-
497
- - name: 'Install dependencies'
498
- run: ${packageManager} install
499
-
500
- - name: Download macOS x64 artifact
501
- uses: actions/download-artifact@v4
502
- with:
503
- name: bindings-x86_64-apple-darwin
504
- path: .
505
- - name: Download macOS arm64 artifact
506
- uses: actions/download-artifact@v4
507
- with:
508
- name: bindings-aarch64-apple-darwin
509
- path: .
510
-
511
- - name: Combine binaries
512
- run: ${packageManager} napi universalize
513
-
514
- - name: Upload artifact
515
- uses: actions/upload-artifact@v4
516
- with:
517
- name: bindings-universal-apple-darwin
518
- path: "*.node"
519
- if-no-files-found: error
520
-
521
- test-wasi-nodejs:
522
- name: Test bindings on wasi - node@\${{ matrix.node }}
523
- needs:
524
- - build
525
- strategy:
526
- fail-fast: false
527
- matrix:
528
- node: ['18', '20']
529
- runs-on: ubuntu-latest
530
- steps:
531
- - uses: actions/checkout@v4
532
- - name: Download artifacts
533
- uses: actions/download-artifact@v4
534
- with:
535
- name: bindings-${wasiTargetName}
536
- path: .
537
- - name: List packages
538
- run: ls -R .
539
- - uses: actions/setup-node@v4
540
- with:
541
- node-version: \${{ matrix.node }}
542
- cache: ${packageManager}
543
- - name: 'Install dependencies'
544
- run: ${packageManager} install
545
- - name: Test
546
- run: ${packageManager} test
547
- env:
548
- NAPI_RS_FORCE_WASI: true
549
-
550
- publish:
551
- name: Publish
552
- runs-on: ubuntu-latest
553
- needs:
554
- - test-linux-x64-gnu-binding
555
- - test-linux-x64-musl-binding
556
- - test-linux-aarch64-gnu-binding
557
- - test-linux-arm-gnueabihf-binding
558
- - test-macOS-windows-binding
559
- - test-linux-aarch64-musl-binding
560
- - test-wasi-nodejs
561
- - build-freebsd
562
-
563
- steps:
564
- - uses: actions/checkout@v4
565
-
566
- - name: Setup node
567
- uses: actions/setup-node@v4
568
- with:
569
- node-version: 20
570
- cache: '${packageManager}'
571
- registry-url: 'https://registry.npmjs.org'
572
-
573
- - name: 'Install dependencies'
574
- run: ${packageManager} install
575
-
576
- - name: Download all artifacts
577
- uses: actions/download-artifact@v4
578
- with:
579
- path: artifacts
580
-
581
- - name: Move artifacts
582
- run: ${packageManager} artifacts
583
-
584
- - name: List packages
585
- run: ls -R ./npm
586
- shell: bash
587
-
588
- - name: Publish
589
- run: |
590
- if git log -1 --pretty=%B | grep "^[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+$";
591
- then
592
- npm publish --access public --provenance
593
- elif git log -1 --pretty=%B | grep "^[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+";
594
- then
595
- npm publish --tag next --access public --provenance
596
- else
597
- echo "Not a release, skipping publish"
598
- fi
599
- env:
600
- GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
601
- NODE_AUTH_TOKEN: \${{ secrets.NPM_TOKEN }}
602
- `