@napi-rs/cli 3.0.0-alpha.6 → 3.0.0-alpha.61
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.
- package/dist/api/artifacts.js +28 -7
- package/dist/api/artifacts.js.map +1 -1
- package/dist/api/build.js +220 -39
- package/dist/api/build.js.map +1 -1
- package/dist/api/create-npm-dirs.js +45 -8
- package/dist/api/create-npm-dirs.js.map +1 -1
- package/dist/api/new.js +57 -20
- package/dist/api/new.js.map +1 -1
- package/dist/api/pre-publish.js +9 -7
- package/dist/api/pre-publish.js.map +1 -1
- package/dist/api/rename.js +9 -1
- package/dist/api/rename.js.map +1 -1
- package/dist/api/templates/ci-template.d.ts +3 -1
- package/dist/api/templates/ci-template.js +124 -124
- package/dist/api/templates/ci-template.js.map +1 -1
- package/dist/api/templates/ci.yml.d.ts +3 -1
- package/dist/api/templates/ci.yml.js +21 -5
- package/dist/api/templates/ci.yml.js.map +1 -1
- package/dist/api/templates/js-binding.js +104 -214
- package/dist/api/templates/js-binding.js.map +1 -1
- package/dist/api/templates/lib.rs.js +1 -4
- package/dist/api/templates/lib.rs.js.map +1 -1
- package/dist/api/templates/load-wasi-template.d.ts +2 -0
- package/dist/api/templates/load-wasi-template.js +166 -0
- package/dist/api/templates/load-wasi-template.js.map +1 -0
- package/dist/api/templates/package.json.d.ts +9 -2
- package/dist/api/templates/package.json.js +26 -4
- package/dist/api/templates/package.json.js.map +1 -1
- package/dist/api/templates/wasi-worker-template.d.ts +2 -0
- package/dist/api/templates/wasi-worker-template.js +122 -0
- package/dist/api/templates/wasi-worker-template.js.map +1 -0
- package/dist/api/universalize.js +5 -5
- package/dist/api/universalize.js.map +1 -1
- package/dist/api/version.js +2 -2
- package/dist/api/version.js.map +1 -1
- package/dist/commands/artifacts.js +2 -2
- package/dist/commands/artifacts.js.map +1 -1
- package/dist/commands/build.js +1 -1
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/new.js +30 -8
- package/dist/commands/new.js.map +1 -1
- package/dist/def/artifacts.d.ts +21 -1
- package/dist/def/artifacts.js +10 -2
- package/dist/def/artifacts.js.map +1 -1
- package/dist/def/build.d.ts +22 -4
- package/dist/def/build.js +16 -4
- package/dist/def/build.js.map +1 -1
- package/dist/def/create-npm-dirs.d.ts +10 -0
- package/dist/def/create-npm-dirs.js +4 -0
- package/dist/def/create-npm-dirs.js.map +1 -1
- package/dist/def/new.d.ts +25 -7
- package/dist/def/new.js +11 -1
- package/dist/def/new.js.map +1 -1
- package/dist/def/pre-publish.d.ts +12 -2
- package/dist/def/pre-publish.js +7 -3
- package/dist/def/pre-publish.js.map +1 -1
- package/dist/def/rename.d.ts +16 -6
- package/dist/def/rename.js +5 -1
- package/dist/def/rename.js.map +1 -1
- package/dist/def/universalize.d.ts +10 -0
- package/dist/def/universalize.js +4 -0
- package/dist/def/universalize.js.map +1 -1
- package/dist/def/version.d.ts +10 -0
- package/dist/def/version.js +4 -0
- package/dist/def/version.js.map +1 -1
- package/dist/index.cjs +8143 -14638
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/__tests__/config.spec.d.ts +1 -0
- package/dist/utils/__tests__/config.spec.js +63 -0
- package/dist/utils/__tests__/config.spec.js.map +1 -0
- package/dist/utils/__tests__/typegen.spec.js +8 -4
- package/dist/utils/__tests__/typegen.spec.js.map +1 -1
- package/dist/utils/cargo.js +1 -1
- package/dist/utils/cargo.js.map +1 -1
- package/dist/utils/config.d.ts +49 -5
- package/dist/utils/config.js +38 -6
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/metadata.js +2 -2
- package/dist/utils/metadata.js.map +1 -1
- package/dist/utils/misc.d.ts +1 -2
- package/dist/utils/misc.js +3 -3
- package/dist/utils/misc.js.map +1 -1
- package/dist/utils/target.d.ts +7 -5
- package/dist/utils/target.js +17 -3
- package/dist/utils/target.js.map +1 -1
- package/dist/utils/typegen.d.ts +1 -1
- package/dist/utils/typegen.js +29 -9
- package/dist/utils/typegen.js.map +1 -1
- package/dist/utils/version.d.ts +2 -1
- package/dist/utils/version.js +10 -8
- package/dist/utils/version.js.map +1 -1
- package/package.json +25 -24
- package/src/api/artifacts.ts +81 -9
- package/src/api/build.ts +379 -58
- package/src/api/create-npm-dirs.ts +56 -8
- package/src/api/new.ts +89 -31
- package/src/api/pre-publish.ts +13 -7
- package/src/api/rename.ts +10 -1
- package/src/api/templates/ci-template.ts +134 -124
- package/src/api/templates/ci.yml.ts +27 -6
- package/src/api/templates/js-binding.ts +105 -214
- package/src/api/templates/lib.rs.ts +1 -4
- package/src/api/templates/load-wasi-template.ts +180 -0
- package/src/api/templates/package.json.ts +47 -5
- package/src/api/templates/wasi-worker-template.ts +122 -0
- package/src/api/universalize.ts +13 -8
- package/src/api/version.ts +5 -2
- package/src/commands/artifacts.ts +2 -2
- package/src/commands/build.ts +1 -1
- package/src/commands/new.ts +31 -8
- package/src/def/artifacts.ts +22 -3
- package/src/def/build.ts +36 -8
- package/src/def/create-npm-dirs.ts +9 -0
- package/src/def/new.ts +28 -3
- package/src/def/pre-publish.ts +12 -3
- package/src/def/rename.ts +11 -2
- package/src/def/universalize.ts +9 -0
- package/src/def/version.ts +9 -0
- package/src/index.ts +2 -0
- package/src/utils/__tests__/__fixtures__/napi_type_def +130 -130
- package/src/utils/__tests__/__snapshots__/config.spec.ts.md +97 -0
- package/src/utils/__tests__/__snapshots__/config.spec.ts.snap +0 -0
- package/src/utils/__tests__/__snapshots__/target.spec.ts.md +28 -0
- package/src/utils/__tests__/__snapshots__/target.spec.ts.snap +0 -0
- package/src/utils/__tests__/__snapshots__/typegen.spec.ts.md +713 -158
- package/src/utils/__tests__/__snapshots__/typegen.spec.ts.snap +0 -0
- package/src/utils/__tests__/__snapshots__/version.spec.ts.md +8 -7
- package/src/utils/__tests__/__snapshots__/version.spec.ts.snap +0 -0
- package/src/utils/__tests__/config.spec.ts +81 -0
- package/src/utils/__tests__/typegen.spec.ts +18 -3
- package/src/utils/cargo.ts +1 -1
- package/src/utils/config.ts +114 -12
- package/src/utils/index.ts +0 -1
- package/src/utils/metadata.ts +2 -2
- package/src/utils/misc.ts +11 -3
- package/src/utils/target.ts +22 -4
- package/src/utils/typegen.ts +37 -8
- package/src/utils/version.ts +10 -8
- package/dist/api/load-wasi-template.d.ts +0 -1
- package/dist/api/load-wasi-template.js +0 -63
- package/dist/api/load-wasi-template.js.map +0 -1
- package/dist/api/wasi-worker-template.d.ts +0 -1
- package/dist/api/wasi-worker-template.js +0 -53
- package/dist/api/wasi-worker-template.js.map +0 -1
- package/dist/utils/ci.d.ts +0 -11
- package/dist/utils/ci.js +0 -96
- package/dist/utils/ci.js.map +0 -1
- package/src/api/load-wasi-template.ts +0 -65
- package/src/api/wasi-worker-template.ts +0 -52
- package/src/utils/ci.ts +0 -111
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
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
|
+
) => `
|
|
2
12
|
name: CI
|
|
3
13
|
|
|
4
14
|
env:
|
|
@@ -32,82 +42,68 @@ jobs:
|
|
|
32
42
|
settings:
|
|
33
43
|
- host: macos-latest
|
|
34
44
|
target: 'x86_64-apple-darwin'
|
|
35
|
-
build:
|
|
36
|
-
yarn build --platform
|
|
37
|
-
strip -x *.node
|
|
45
|
+
build: ${packageManager} build --platform --target x86_64-apple-darwin
|
|
38
46
|
- host: windows-latest
|
|
39
|
-
build:
|
|
47
|
+
build: ${packageManager} build --platform
|
|
40
48
|
target: 'x86_64-pc-windows-msvc'
|
|
41
49
|
- host: windows-latest
|
|
42
50
|
build: |
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
${packageManager} build --platform --target i686-pc-windows-msvc
|
|
52
|
+
${packageManager} test
|
|
45
53
|
target: 'i686-pc-windows-msvc'
|
|
46
54
|
- host: ubuntu-latest
|
|
47
55
|
target: 'x86_64-unknown-linux-gnu'
|
|
48
|
-
|
|
49
|
-
build: >-
|
|
50
|
-
set -e &&\n
|
|
51
|
-
yarn build --platform --target x86_64-unknown-linux-gnu &&\n
|
|
52
|
-
strip *.node
|
|
56
|
+
build: ${packageManager} build --platform --target x86_64-unknown-linux-gnu --use-napi-cross
|
|
53
57
|
- host: ubuntu-latest
|
|
54
58
|
target: 'x86_64-unknown-linux-musl'
|
|
55
|
-
|
|
56
|
-
build: >-
|
|
57
|
-
set -e &&
|
|
58
|
-
yarn build --platform &&
|
|
59
|
-
strip *.node
|
|
59
|
+
build: ${packageManager} build --platform --target x86_64-unknown-linux-musl -x
|
|
60
60
|
- host: macos-latest
|
|
61
61
|
target: 'aarch64-apple-darwin'
|
|
62
|
-
build:
|
|
63
|
-
yarn build --platform --target aarch64-apple-darwin
|
|
64
|
-
strip -x *.node
|
|
62
|
+
build: ${packageManager} build --platform --target aarch64-apple-darwin
|
|
65
63
|
- host: ubuntu-latest
|
|
66
64
|
target: 'aarch64-unknown-linux-gnu'
|
|
67
|
-
|
|
68
|
-
build: >-
|
|
69
|
-
set -e &&\n
|
|
70
|
-
yarn build --platform --target aarch64-unknown-linux-gnu &&\n
|
|
71
|
-
aarch64-unknown-linux-gnu-strip *.node
|
|
65
|
+
build: ${packageManager} build --platform --target aarch64-unknown-linux-gnu --use-napi-cross
|
|
72
66
|
- host: ubuntu-latest
|
|
73
67
|
target: 'armv7-unknown-linux-gnueabihf'
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
build:
|
|
78
|
-
yarn build --platform --target armv7-unknown-linux-gnueabihf --cross-compile
|
|
79
|
-
arm-linux-gnueabihf-strip *.node
|
|
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
|
|
80
72
|
- host: ubuntu-latest
|
|
81
73
|
target: 'aarch64-linux-android'
|
|
82
|
-
build:
|
|
83
|
-
yarn build --platform --target aarch64-linux-android
|
|
84
|
-
\${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
|
|
74
|
+
build: ${packageManager} build --platform --target aarch64-linux-android
|
|
85
75
|
- host: ubuntu-latest
|
|
86
76
|
target: 'armv7-linux-androideabi'
|
|
87
|
-
build:
|
|
88
|
-
yarn build --platform --target armv7-linux-androideabi
|
|
89
|
-
\${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
|
|
77
|
+
build: ${packageManager} build --platform --target armv7-linux-androideabi
|
|
90
78
|
- host: ubuntu-latest
|
|
91
79
|
target: 'aarch64-unknown-linux-musl'
|
|
92
|
-
|
|
93
|
-
build: >-
|
|
94
|
-
set -e &&\n
|
|
95
|
-
rustup target add aarch64-unknown-linux-musl &&\n
|
|
96
|
-
yarn build --platform --target aarch64-unknown-linux-musl &&\n
|
|
97
|
-
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
|
|
80
|
+
build: ${packageManager} build --platform --target aarch64-unknown-linux-musl -x
|
|
98
81
|
- host: windows-latest
|
|
99
82
|
target: 'aarch64-pc-windows-msvc'
|
|
100
|
-
build:
|
|
83
|
+
build: ${packageManager} build --platform --target aarch64-pc-windows-msvc
|
|
101
84
|
- host: ubuntu-latest
|
|
102
85
|
target: 'riscv64gc-unknown-linux-gnu'
|
|
103
86
|
setup: |
|
|
104
87
|
sudo apt-get update
|
|
105
88
|
sudo apt-get install gcc-riscv64-linux-gnu -y
|
|
106
|
-
build:
|
|
107
|
-
|
|
108
|
-
|
|
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}
|
|
109
105
|
|
|
110
|
-
name: stable - \${{ matrix.settings.target }} - node@
|
|
106
|
+
name: stable - \${{ matrix.settings.target }} - node@20
|
|
111
107
|
runs-on: \${{ matrix.settings.host }}
|
|
112
108
|
|
|
113
109
|
steps:
|
|
@@ -115,14 +111,12 @@ jobs:
|
|
|
115
111
|
|
|
116
112
|
- name: Setup node
|
|
117
113
|
uses: actions/setup-node@v4
|
|
118
|
-
if: \${{ !matrix.settings.docker }}
|
|
119
114
|
with:
|
|
120
|
-
node-version:
|
|
121
|
-
cache:
|
|
115
|
+
node-version: 20
|
|
116
|
+
cache: ${packageManager}
|
|
122
117
|
|
|
123
118
|
- name: Install
|
|
124
119
|
uses: dtolnay/rust-toolchain@stable
|
|
125
|
-
if: \${{ !matrix.settings.docker }}
|
|
126
120
|
with:
|
|
127
121
|
toolchain: stable
|
|
128
122
|
targets: \${{ matrix.settings.target }}
|
|
@@ -134,14 +128,15 @@ jobs:
|
|
|
134
128
|
~/.cargo/registry/index/
|
|
135
129
|
~/.cargo/registry/cache/
|
|
136
130
|
~/.cargo/git/db/
|
|
131
|
+
~/.napi-rs
|
|
137
132
|
.cargo-cache
|
|
138
133
|
target/
|
|
139
134
|
key: \${{ matrix.settings.target }}-cargo-\${{ matrix.settings.host }}
|
|
140
135
|
|
|
141
136
|
- uses: goto-bus-stop/setup-zig@v2
|
|
142
|
-
if: \${{ matrix.settings.target
|
|
137
|
+
if: \${{ contains(matrix.settings.target, 'musl') }}
|
|
143
138
|
with:
|
|
144
|
-
version: 0.
|
|
139
|
+
version: 0.12.0
|
|
145
140
|
|
|
146
141
|
- name: Setup toolchain
|
|
147
142
|
run: \${{ matrix.settings.setup }}
|
|
@@ -154,36 +149,35 @@ jobs:
|
|
|
154
149
|
shell: bash
|
|
155
150
|
|
|
156
151
|
- name: 'Install dependencies'
|
|
157
|
-
run:
|
|
152
|
+
run: ${packageManager} install
|
|
158
153
|
|
|
159
154
|
- name: Setup node x86
|
|
160
155
|
uses: actions/setup-node@v4
|
|
161
156
|
if: matrix.settings.target == 'i686-pc-windows-msvc'
|
|
162
157
|
with:
|
|
163
|
-
node-version:
|
|
164
|
-
cache: yarn
|
|
158
|
+
node-version: 20
|
|
165
159
|
architecture: x86
|
|
166
160
|
|
|
167
|
-
- name: Build in docker
|
|
168
|
-
uses: addnab/docker-run-action@v3
|
|
169
|
-
if: \${{ matrix.settings.docker }}
|
|
170
|
-
with:
|
|
171
|
-
image: \${{ matrix.settings.docker }}
|
|
172
|
-
options: --user 0:0 -v \${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v \${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v \${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v \${{ github.workspace }}:/build -w /build
|
|
173
|
-
run: \${{ matrix.settings.build }}
|
|
174
|
-
|
|
175
161
|
- name: 'Build'
|
|
176
162
|
run: \${{ matrix.settings.build }}
|
|
177
|
-
if: \${{ !matrix.settings.docker }}
|
|
178
163
|
shell: bash
|
|
179
164
|
|
|
180
165
|
- name: Upload artifact
|
|
181
|
-
uses: actions/upload-artifact@
|
|
166
|
+
uses: actions/upload-artifact@v4
|
|
167
|
+
if: matrix.settings.target != '${wasiTargetName}'
|
|
182
168
|
with:
|
|
183
169
|
name: bindings-\${{ matrix.settings.target }}
|
|
184
170
|
path: "*.node"
|
|
185
171
|
if-no-files-found: error
|
|
186
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: "*.wasm"
|
|
179
|
+
if-no-files-found: error
|
|
180
|
+
|
|
187
181
|
build-freebsd:
|
|
188
182
|
runs-on: macos-12
|
|
189
183
|
name: Build FreeBSD
|
|
@@ -191,20 +185,21 @@ jobs:
|
|
|
191
185
|
- uses: actions/checkout@v4
|
|
192
186
|
- name: Build
|
|
193
187
|
id: build
|
|
194
|
-
uses: cross-platform-actions/action@v0.
|
|
188
|
+
uses: cross-platform-actions/action@v0.23.0
|
|
189
|
+
timeout-minutes: 30
|
|
195
190
|
env:
|
|
196
191
|
DEBUG: 'napi:*'
|
|
197
192
|
RUSTUP_IO_THREADS: 1
|
|
198
193
|
with:
|
|
199
194
|
operating_system: freebsd
|
|
200
195
|
version: '13.2'
|
|
201
|
-
memory:
|
|
196
|
+
memory: 8G
|
|
202
197
|
cpu_count: 3
|
|
203
198
|
environment_variables: 'DEBUG RUSTUP_IO_THREADS'
|
|
204
199
|
shell: bash
|
|
205
|
-
|
|
200
|
+
run: |
|
|
206
201
|
sudo pkg install -y -f curl node libnghttp2 npm
|
|
207
|
-
sudo npm install -g
|
|
202
|
+
sudo npm install -g ${packageManager} --ignore-scripts
|
|
208
203
|
curl https://sh.rustup.rs -sSf --output rustup.sh
|
|
209
204
|
sh rustup.sh -y --profile minimal --default-toolchain stable
|
|
210
205
|
source "$HOME/.cargo/env"
|
|
@@ -219,15 +214,15 @@ jobs:
|
|
|
219
214
|
whoami
|
|
220
215
|
env
|
|
221
216
|
freebsd-version
|
|
222
|
-
|
|
223
|
-
|
|
217
|
+
${packageManager} install
|
|
218
|
+
${packageManager} build
|
|
224
219
|
strip -x *.node
|
|
225
220
|
yarn test
|
|
226
221
|
rm -rf node_modules
|
|
227
222
|
rm -rf target
|
|
228
223
|
rm -rf .yarn/cache
|
|
229
224
|
- name: Upload artifact
|
|
230
|
-
uses: actions/upload-artifact@
|
|
225
|
+
uses: actions/upload-artifact@v4
|
|
231
226
|
with:
|
|
232
227
|
name: bindings-freebsd
|
|
233
228
|
path: "*.node"
|
|
@@ -245,7 +240,6 @@ jobs:
|
|
|
245
240
|
target: 'x86_64-apple-darwin'
|
|
246
241
|
- host: windows-latest
|
|
247
242
|
target: 'x86_64-pc-windows-msvc'
|
|
248
|
-
node: ['16', '18']
|
|
249
243
|
node: ['18', '20']
|
|
250
244
|
runs-on: \${{ matrix.settings.host }}
|
|
251
245
|
|
|
@@ -256,13 +250,13 @@ jobs:
|
|
|
256
250
|
uses: actions/setup-node@v4
|
|
257
251
|
with:
|
|
258
252
|
node-version: \${{ matrix.node }}
|
|
259
|
-
cache: '
|
|
253
|
+
cache: '${packageManager}'
|
|
260
254
|
|
|
261
255
|
- name: 'Install dependencies'
|
|
262
|
-
run:
|
|
256
|
+
run: ${packageManager} install
|
|
263
257
|
|
|
264
258
|
- name: Download artifacts
|
|
265
|
-
uses: actions/download-artifact@
|
|
259
|
+
uses: actions/download-artifact@v4
|
|
266
260
|
with:
|
|
267
261
|
name: bindings-\${{ matrix.settings.target }}
|
|
268
262
|
path: .
|
|
@@ -272,7 +266,7 @@ jobs:
|
|
|
272
266
|
shell: bash
|
|
273
267
|
|
|
274
268
|
- name: Test bindings
|
|
275
|
-
run:
|
|
269
|
+
run: ${packageManager} test
|
|
276
270
|
|
|
277
271
|
test-linux-x64-gnu-binding:
|
|
278
272
|
name: Test bindings on Linux-x64-gnu - node@\${{ matrix.node }}
|
|
@@ -281,7 +275,6 @@ jobs:
|
|
|
281
275
|
strategy:
|
|
282
276
|
fail-fast: false
|
|
283
277
|
matrix:
|
|
284
|
-
node: ['16', '18']
|
|
285
278
|
node: ['18', '20']
|
|
286
279
|
runs-on: ubuntu-latest
|
|
287
280
|
|
|
@@ -292,13 +285,13 @@ jobs:
|
|
|
292
285
|
uses: actions/setup-node@v4
|
|
293
286
|
with:
|
|
294
287
|
node-version: \${{ matrix.node }}
|
|
295
|
-
cache: '
|
|
288
|
+
cache: '${packageManager}'
|
|
296
289
|
|
|
297
290
|
- name: 'Install dependencies'
|
|
298
|
-
run:
|
|
291
|
+
run: ${packageManager} install
|
|
299
292
|
|
|
300
293
|
- name: Download artifacts
|
|
301
|
-
uses: actions/download-artifact@
|
|
294
|
+
uses: actions/download-artifact@v4
|
|
302
295
|
with:
|
|
303
296
|
name: bindings-x86_64-unknown-linux-gnu
|
|
304
297
|
path: .
|
|
@@ -317,7 +310,6 @@ jobs:
|
|
|
317
310
|
strategy:
|
|
318
311
|
fail-fast: false
|
|
319
312
|
matrix:
|
|
320
|
-
node: ['16', '18']
|
|
321
313
|
node: ['18', '20']
|
|
322
314
|
runs-on: ubuntu-latest
|
|
323
315
|
|
|
@@ -333,10 +325,10 @@ jobs:
|
|
|
333
325
|
- name: 'Install dependencies'
|
|
334
326
|
run: |
|
|
335
327
|
yarn config set supportedArchitectures.libc "musl"
|
|
336
|
-
|
|
328
|
+
${packageManager} install
|
|
337
329
|
|
|
338
330
|
- name: Download artifacts
|
|
339
|
-
uses: actions/download-artifact@
|
|
331
|
+
uses: actions/download-artifact@v4
|
|
340
332
|
with:
|
|
341
333
|
name: bindings-x86_64-unknown-linux-musl
|
|
342
334
|
path: .
|
|
@@ -355,15 +347,14 @@ jobs:
|
|
|
355
347
|
strategy:
|
|
356
348
|
fail-fast: false
|
|
357
349
|
matrix:
|
|
358
|
-
node: ['
|
|
359
|
-
node: ['18', '20']
|
|
350
|
+
node: ['20']
|
|
360
351
|
runs-on: ubuntu-latest
|
|
361
352
|
|
|
362
353
|
steps:
|
|
363
354
|
- uses: actions/checkout@v4
|
|
364
355
|
|
|
365
356
|
- name: Download artifacts
|
|
366
|
-
uses: actions/download-artifact@
|
|
357
|
+
uses: actions/download-artifact@v4
|
|
367
358
|
with:
|
|
368
359
|
name: bindings-aarch64-unknown-linux-gnu
|
|
369
360
|
path: .
|
|
@@ -376,7 +367,7 @@ jobs:
|
|
|
376
367
|
run: |
|
|
377
368
|
yarn config set supportedArchitectures.cpu "arm64"
|
|
378
369
|
yarn config set supportedArchitectures.libc "glibc"
|
|
379
|
-
|
|
370
|
+
${packageManager} install
|
|
380
371
|
|
|
381
372
|
- name: Set up QEMU
|
|
382
373
|
uses: docker/setup-qemu-action@v3
|
|
@@ -389,10 +380,7 @@ jobs:
|
|
|
389
380
|
with:
|
|
390
381
|
image: node:\${{ matrix.node }}-slim
|
|
391
382
|
options: --platform linux/arm64 -v \${{ github.workspace }}:/build -w /build
|
|
392
|
-
run:
|
|
393
|
-
set -e
|
|
394
|
-
yarn test
|
|
395
|
-
ls -la
|
|
383
|
+
run: yarn test
|
|
396
384
|
|
|
397
385
|
test-linux-aarch64-musl-binding:
|
|
398
386
|
name: Test bindings on aarch64-unknown-linux-musl - node@\${{ matrix.node }}
|
|
@@ -401,7 +389,7 @@ jobs:
|
|
|
401
389
|
strategy:
|
|
402
390
|
fail-fast: false
|
|
403
391
|
matrix:
|
|
404
|
-
node: ['
|
|
392
|
+
node: ['18', '20']
|
|
405
393
|
|
|
406
394
|
runs-on: ubuntu-latest
|
|
407
395
|
|
|
@@ -409,7 +397,7 @@ jobs:
|
|
|
409
397
|
- uses: actions/checkout@v4
|
|
410
398
|
|
|
411
399
|
- name: Download artifacts
|
|
412
|
-
uses: actions/download-artifact@
|
|
400
|
+
uses: actions/download-artifact@v4
|
|
413
401
|
with:
|
|
414
402
|
name: bindings-aarch64-unknown-linux-musl
|
|
415
403
|
path: .
|
|
@@ -422,7 +410,7 @@ jobs:
|
|
|
422
410
|
run: |
|
|
423
411
|
yarn config set supportedArchitectures.cpu "arm64"
|
|
424
412
|
yarn config set supportedArchitectures.libc "musl"
|
|
425
|
-
|
|
413
|
+
${packageManager} install
|
|
426
414
|
|
|
427
415
|
- name: Set up QEMU
|
|
428
416
|
uses: docker/setup-qemu-action@v3
|
|
@@ -435,9 +423,7 @@ jobs:
|
|
|
435
423
|
with:
|
|
436
424
|
image: node:\${{ matrix.node }}-alpine
|
|
437
425
|
options: --platform linux/arm64 -v \${{ github.workspace }}:/build -w /build
|
|
438
|
-
run:
|
|
439
|
-
set -e
|
|
440
|
-
yarn test
|
|
426
|
+
run: yarn test
|
|
441
427
|
|
|
442
428
|
test-linux-arm-gnueabihf-binding:
|
|
443
429
|
name: Test bindings on armv7-unknown-linux-gnueabihf - node@\${{ matrix.node }}
|
|
@@ -446,7 +432,6 @@ jobs:
|
|
|
446
432
|
strategy:
|
|
447
433
|
fail-fast: false
|
|
448
434
|
matrix:
|
|
449
|
-
node: ['16', '18']
|
|
450
435
|
node: ['18', '20']
|
|
451
436
|
runs-on: ubuntu-latest
|
|
452
437
|
|
|
@@ -454,7 +439,7 @@ jobs:
|
|
|
454
439
|
- uses: actions/checkout@v4
|
|
455
440
|
|
|
456
441
|
- name: Download artifacts
|
|
457
|
-
uses: actions/download-artifact@
|
|
442
|
+
uses: actions/download-artifact@v4
|
|
458
443
|
with:
|
|
459
444
|
name: bindings-armv7-unknown-linux-gnueabihf
|
|
460
445
|
path: .
|
|
@@ -466,7 +451,7 @@ jobs:
|
|
|
466
451
|
- name: Install dependencies
|
|
467
452
|
run: |
|
|
468
453
|
yarn config set supportedArchitectures.cpu "arm"
|
|
469
|
-
|
|
454
|
+
${packageManager} install
|
|
470
455
|
|
|
471
456
|
- name: Set up QEMU
|
|
472
457
|
uses: docker/setup-qemu-action@v3
|
|
@@ -479,10 +464,7 @@ jobs:
|
|
|
479
464
|
with:
|
|
480
465
|
image: node:\${{ matrix.node }}-bullseye-slim
|
|
481
466
|
options: --platform linux/arm/v7 -v \${{ github.workspace }}:/build -w /build
|
|
482
|
-
run:
|
|
483
|
-
set -e
|
|
484
|
-
yarn test
|
|
485
|
-
ls -la
|
|
467
|
+
run: ${packageManager} test
|
|
486
468
|
|
|
487
469
|
universal-macOS:
|
|
488
470
|
name: Build universal macOS binary
|
|
@@ -496,33 +478,62 @@ jobs:
|
|
|
496
478
|
- name: Setup node
|
|
497
479
|
uses: actions/setup-node@v4
|
|
498
480
|
with:
|
|
499
|
-
node-version:
|
|
500
|
-
cache:
|
|
481
|
+
node-version: 20
|
|
482
|
+
cache: ${packageManager}
|
|
501
483
|
|
|
502
484
|
- name: 'Install dependencies'
|
|
503
|
-
run:
|
|
485
|
+
run: ${packageManager} install
|
|
504
486
|
|
|
505
487
|
- name: Download macOS x64 artifact
|
|
506
|
-
uses: actions/download-artifact@
|
|
488
|
+
uses: actions/download-artifact@v4
|
|
507
489
|
with:
|
|
508
490
|
name: bindings-x86_64-apple-darwin
|
|
509
491
|
path: .
|
|
510
492
|
- name: Download macOS arm64 artifact
|
|
511
|
-
uses: actions/download-artifact@
|
|
493
|
+
uses: actions/download-artifact@v4
|
|
512
494
|
with:
|
|
513
495
|
name: bindings-aarch64-apple-darwin
|
|
514
496
|
path: .
|
|
515
497
|
|
|
516
498
|
- name: Combine binaries
|
|
517
|
-
run:
|
|
499
|
+
run: ${packageManager} napi universalize
|
|
518
500
|
|
|
519
501
|
- name: Upload artifact
|
|
520
|
-
uses: actions/upload-artifact@
|
|
502
|
+
uses: actions/upload-artifact@v4
|
|
521
503
|
with:
|
|
522
504
|
name: bindings-universal-apple-darwin
|
|
523
505
|
path: "*.node"
|
|
524
506
|
if-no-files-found: error
|
|
525
507
|
|
|
508
|
+
test-wasi-nodejs:
|
|
509
|
+
name: Test bindings on wasi - node@\${{ matrix.node }}
|
|
510
|
+
needs:
|
|
511
|
+
- build
|
|
512
|
+
strategy:
|
|
513
|
+
fail-fast: false
|
|
514
|
+
matrix:
|
|
515
|
+
node: ['18', '20']
|
|
516
|
+
runs-on: ubuntu-latest
|
|
517
|
+
steps:
|
|
518
|
+
- uses: actions/checkout@v4
|
|
519
|
+
- name: Download artifacts
|
|
520
|
+
uses: actions/download-artifact@v4
|
|
521
|
+
with:
|
|
522
|
+
name: bindings-${wasiTargetName}
|
|
523
|
+
path: .
|
|
524
|
+
- name: List packages
|
|
525
|
+
run: ls -R .
|
|
526
|
+
- uses: actions/setup-node@v4
|
|
527
|
+
with:
|
|
528
|
+
node-version: \${{ matrix.node }}
|
|
529
|
+
cache: ${packageManager}
|
|
530
|
+
- name: 'Install dependencies'
|
|
531
|
+
run: ${packageManager} install
|
|
532
|
+
- name: Test
|
|
533
|
+
run: ${packageManager} test
|
|
534
|
+
env:
|
|
535
|
+
NAPI_RS_FORCE_WASI: true
|
|
536
|
+
|
|
526
537
|
publish:
|
|
527
538
|
name: Publish
|
|
528
539
|
runs-on: ubuntu-latest
|
|
@@ -533,6 +544,7 @@ jobs:
|
|
|
533
544
|
- test-linux-arm-gnueabihf-binding
|
|
534
545
|
- test-macOS-windows-binding
|
|
535
546
|
- test-linux-aarch64-musl-binding
|
|
547
|
+
- test-wasi-nodejs
|
|
536
548
|
- build-freebsd
|
|
537
549
|
|
|
538
550
|
steps:
|
|
@@ -541,14 +553,15 @@ jobs:
|
|
|
541
553
|
- name: Setup node
|
|
542
554
|
uses: actions/setup-node@v4
|
|
543
555
|
with:
|
|
544
|
-
node-version:
|
|
545
|
-
cache: '
|
|
556
|
+
node-version: 20
|
|
557
|
+
cache: '${packageManager}'
|
|
558
|
+
registry-url: 'https://registry.npmjs.org'
|
|
546
559
|
|
|
547
560
|
- name: 'Install dependencies'
|
|
548
|
-
run:
|
|
561
|
+
run: ${packageManager} install
|
|
549
562
|
|
|
550
563
|
- name: Download all artifacts
|
|
551
|
-
uses: actions/download-artifact@
|
|
564
|
+
uses: actions/download-artifact@v4
|
|
552
565
|
with:
|
|
553
566
|
path: artifacts
|
|
554
567
|
|
|
@@ -561,19 +574,16 @@ jobs:
|
|
|
561
574
|
|
|
562
575
|
- name: Publish
|
|
563
576
|
run: |
|
|
564
|
-
npm config set provenance true
|
|
565
577
|
if git log -1 --pretty=%B | grep "^[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+$";
|
|
566
578
|
then
|
|
567
|
-
|
|
568
|
-
npm publish --access public
|
|
579
|
+
npm publish --access public --provenance
|
|
569
580
|
elif git log -1 --pretty=%B | grep "^[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+";
|
|
570
581
|
then
|
|
571
|
-
|
|
572
|
-
npm publish --tag next --access public
|
|
582
|
+
npm publish --tag next --access public --provenance
|
|
573
583
|
else
|
|
574
584
|
echo "Not a release, skipping publish"
|
|
575
585
|
fi
|
|
576
586
|
env:
|
|
577
587
|
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
578
|
-
|
|
588
|
+
NODE_AUTH_TOKEN: \${{ secrets.NPM_TOKEN }}
|
|
579
589
|
`
|
|
@@ -2,11 +2,12 @@ import { load, dump } from 'js-yaml'
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
NodeArchToCpu,
|
|
5
|
+
type SupportedPackageManager,
|
|
5
6
|
UniArchsByPlatform,
|
|
6
7
|
parseTriple,
|
|
7
8
|
} from '../../utils/index.js'
|
|
8
9
|
|
|
9
|
-
import { YAML } from './ci-template.js'
|
|
10
|
+
import { type WasiTargetName, YAML } from './ci-template.js'
|
|
10
11
|
|
|
11
12
|
const BUILD_FREEBSD = 'build-freebsd'
|
|
12
13
|
const TEST_MACOS_WINDOWS = 'test-macOS-windows-binding'
|
|
@@ -15,9 +16,14 @@ const TEST_LINUX_X64_MUSL = 'test-linux-x64-musl-binding'
|
|
|
15
16
|
const TEST_LINUX_AARCH64_GNU = 'test-linux-aarch64-gnu-binding'
|
|
16
17
|
const TEST_LINUX_AARCH64_MUSL = 'test-linux-aarch64-musl-binding'
|
|
17
18
|
const TEST_LINUX_ARM_GNUEABIHF = 'test-linux-arm-gnueabihf-binding'
|
|
19
|
+
const TEST_WASI = 'test-wasi-nodejs'
|
|
18
20
|
const UNIVERSAL_MACOS = 'universal-macOS'
|
|
19
21
|
|
|
20
|
-
export const createGithubActionsCIYml = (
|
|
22
|
+
export const createGithubActionsCIYml = (
|
|
23
|
+
targets: string[],
|
|
24
|
+
packageManager: SupportedPackageManager,
|
|
25
|
+
wasiTargetName: WasiTargetName,
|
|
26
|
+
) => {
|
|
21
27
|
const allTargets = new Set(
|
|
22
28
|
targets.flatMap((t) => {
|
|
23
29
|
const platform = parseTriple(t)
|
|
@@ -31,7 +37,7 @@ export const createGithubActionsCIYml = (targets: string[]) => {
|
|
|
31
37
|
}),
|
|
32
38
|
)
|
|
33
39
|
|
|
34
|
-
const fullTemplate = load(YAML()) as any
|
|
40
|
+
const fullTemplate = load(YAML(packageManager, wasiTargetName)) as any
|
|
35
41
|
|
|
36
42
|
const requiredSteps = []
|
|
37
43
|
const enableWindowsX86 = allTargets.has('x86_64-pc-windows-msvc')
|
|
@@ -43,6 +49,10 @@ export const createGithubActionsCIYml = (targets: string[]) => {
|
|
|
43
49
|
const enableLinuxArm7 = allTargets.has('armv7-unknown-linux-gnueabihf')
|
|
44
50
|
const enableFreeBSD = allTargets.has('x86_64-unknown-freebsd')
|
|
45
51
|
const enableMacOSUni = allTargets.has('universal-apple-darwin')
|
|
52
|
+
const enableWasi =
|
|
53
|
+
allTargets.has('wasm32-wasi-preview1-threads') ||
|
|
54
|
+
allTargets.has('wasm32-wasip1-threads') ||
|
|
55
|
+
allTargets.has('wasm32-wasip2')
|
|
46
56
|
fullTemplate.jobs.build.strategy.matrix.settings =
|
|
47
57
|
fullTemplate.jobs.build.strategy.matrix.settings.filter(
|
|
48
58
|
({ target }: { target: string }) => allTargets.has(target),
|
|
@@ -111,9 +121,20 @@ export const createGithubActionsCIYml = (targets: string[]) => {
|
|
|
111
121
|
requiredSteps.push(UNIVERSAL_MACOS)
|
|
112
122
|
}
|
|
113
123
|
|
|
124
|
+
if (!enableWasi) {
|
|
125
|
+
delete fullTemplate.jobs[TEST_WASI]
|
|
126
|
+
} else {
|
|
127
|
+
requiredSteps.push(TEST_WASI)
|
|
128
|
+
}
|
|
129
|
+
|
|
114
130
|
fullTemplate.jobs.publish.needs = requiredSteps
|
|
115
131
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
132
|
+
try {
|
|
133
|
+
return dump(fullTemplate, {
|
|
134
|
+
lineWidth: 1000,
|
|
135
|
+
})
|
|
136
|
+
} catch (err) {
|
|
137
|
+
console.info(fullTemplate)
|
|
138
|
+
throw err
|
|
139
|
+
}
|
|
119
140
|
}
|