@@ -27,87 +27,94 @@ jobs:
27
27
target : x86_64-apple-darwin
28
28
architecture : x64
29
29
build : |
30
- yarn build
30
+ npm run build
31
31
strip -x *.node
32
32
- host : windows-latest
33
- build : yarn build
33
+ build : npm run build
34
34
target : x86_64-pc-windows-msvc
35
35
architecture : x64
36
36
- host : ubuntu-latest
37
37
target : x86_64-unknown-linux-gnu
38
38
architecture : x64
39
- docker : |
40
- docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian
41
- docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian builder
42
- build : |
43
- docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build && strip *.node
39
+ docker : ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine-zig
40
+ build : >-
41
+ set -e &&
42
+ rustup target add x86_64-unknown-linux-gnu &&
43
+ npm run build -- --target x86_64-unknown-linux-gnu --zig --zig-abi-suffix 2.12 &&
44
+ llvm-strip -x *.node
44
45
- host : macos-latest
45
46
target : aarch64-apple-darwin
46
47
build : |
47
- yarn build --target=aarch64-apple-darwin
48
+ npm run build --target=aarch64-apple-darwin
48
49
strip -x *.node
49
50
- host : ubuntu-latest
50
51
architecture : x64
51
52
target : aarch64-unknown-linux-gnu
52
- setup : |
53
- sudo apt-get update
54
- sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu -y
55
- build : |
56
- yarn build --target= aarch64-unknown-linux-gnu
57
- aarch64-linux-gnu- strip *.node
53
+ docker : ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine-zig
54
+ build : >-
55
+ set -e &&
56
+ rustup target add aarch64-unknown-linux-gnu &&
57
+ npm run build -- -- target aarch64-unknown-linux-gnu --zig --zig-abi-suffix 2.17 &&
58
+ llvm- strip -x *.node
58
59
name : stable - ${{ matrix.settings.target }} - node@16
59
60
runs-on : ${{ matrix.settings.host }}
60
61
steps :
61
- - uses : actions/checkout@v2
62
+ - uses : actions/checkout@v3
62
63
- name : Setup node
63
- uses : actions/setup-node@v2
64
+ uses : actions/setup-node@v3
64
65
with :
65
66
node-version : 16
66
67
check-latest : true
67
- cache : yarn
68
+ cache : npm
68
69
architecture : ${{ matrix.settings.architecture }}
69
70
- name : Install
70
71
uses : actions-rs/toolchain@v1
72
+ if : ${{ !matrix.settings.docker }}
71
73
with :
72
74
profile : minimal
73
75
override : true
74
76
toolchain : stable
75
77
target : ${{ matrix.settings.target }}
76
78
- name : Generate Cargo.lock
77
79
uses : actions-rs/cargo@v1
80
+ if : ${{ !matrix.settings.docker }}
78
81
with :
79
82
command : generate-lockfile
80
83
- name : Cache cargo registry
81
- uses : actions/cache@v2
84
+ uses : actions/cache@v3
82
85
with :
83
86
path : ~/.cargo/registry
84
- key : ${{ matrix.settings.target }}-node@16- cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
87
+ key : ${{ matrix.settings.target }}-cargo-registry
85
88
- name : Cache cargo index
86
- uses : actions/cache@v2
89
+ uses : actions/cache@v3
87
90
with :
88
91
path : ~/.cargo/git
89
- key : ${{ matrix.settings.target }}-node@16- cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
92
+ key : ${{ matrix.settings.target }}-cargo-index
90
93
- name : Cache NPM dependencies
91
- uses : actions/cache@v2
94
+ uses : actions/cache@v3
92
95
with :
93
96
path : node_modules
94
- key : npm-cache-${{ matrix.settings.target }}-node@16-${{ hashFiles('yarn.lock') }}
95
- - name : Pull latest image
96
- run : ${{ matrix.settings.docker }}
97
- env :
98
- DOCKER_REGISTRY_URL : ghcr.io
99
- if : ${{ matrix.settings.docker }}
97
+ key : npm-cache-build-${{ matrix.settings.target }}-node@16
100
98
- name : Setup toolchain
101
99
run : ${{ matrix.settings.setup }}
102
100
if : ${{ matrix.settings.setup }}
103
101
shell : bash
104
102
- name : Install dependencies
105
- run : yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
106
- - name : Build
103
+ run : npm clean-install --ignore-scripts
104
+ - name : Build in docker
105
+ uses : addnab/docker-run-action@v3
106
+ if : ${{ matrix.settings.docker }}
107
+ with :
108
+ image : ${{ matrix.settings.docker }}
109
+ options : -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build
110
+ run : ${{ matrix.settings.build }}
111
+
112
+ - name : ' Build'
107
113
run : ${{ matrix.settings.build }}
114
+ if : ${{ !matrix.settings.docker }}
108
115
shell : bash
109
116
- name : Upload artifact
110
- uses : actions/upload-artifact@v2
117
+ uses : actions/upload-artifact@v3
111
118
with :
112
119
name : bindings-${{ matrix.settings.target }}
113
120
path : ${{ env.APP_NAME }}.*.node
@@ -128,30 +135,30 @@ jobs:
128
135
- ' 16'
129
136
runs-on : ${{ matrix.settings.host }}
130
137
steps :
131
- - uses : actions/checkout@v2
138
+ - uses : actions/checkout@v3
132
139
- name : Setup node
133
- uses : actions/setup-node@v2
140
+ uses : actions/setup-node@v3
134
141
with :
135
142
node-version : ${{ matrix.node }}
136
143
check-latest : true
137
- cache : yarn
144
+ cache : npm
138
145
- name : Cache NPM dependencies
139
- uses : actions/cache@v2
146
+ uses : actions/cache@v3
140
147
with :
141
148
path : node_modules
142
- key : npm-cache-test-${{ matrix.settings.target }}-${{ matrix.node }}-${{ hashFiles('yarn. lock') }}
149
+ key : npm-cache-test-${{ matrix.settings.target }}-${{ matrix.node }}-${{ hashFiles('package- lock.json ') }}
143
150
- name : Install dependencies
144
- run : yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
151
+ run : npm clean- install --ignore-scripts
145
152
- name : Download artifacts
146
- uses : actions/download-artifact@v2
153
+ uses : actions/download-artifact@v3
147
154
with :
148
155
name : bindings-${{ matrix.settings.target }}
149
156
path : .
150
157
- name : List packages
151
158
run : ls -R .
152
159
shell : bash
153
160
- name : Test bindings
154
- run : yarn test
161
+ run : npm test
155
162
test-linux-x64-gnu-binding :
156
163
name : Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
157
164
needs :
@@ -171,14 +178,14 @@ jobs:
171
178
with :
172
179
node-version : ${{ matrix.node }}
173
180
check-latest : true
174
- cache : yarn
181
+ cache : npm
175
182
- name : Cache NPM dependencies
176
183
uses : actions/cache@v2
177
184
with :
178
185
path : node_modules
179
- key : npm-cache-test-linux-x64-gnu-${{ matrix.node }}-${{ hashFiles('yarn. lock') }}
186
+ key : npm-cache-test-linux-x64-gnu-${{ matrix.node }}-${{ hashFiles('package- lock.json ') }}
180
187
- name : Install dependencies
181
- run : yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
188
+ run : npm clean- install --ignore-scripts
182
189
- name : Download artifacts
183
190
uses : actions/download-artifact@v2
184
191
with :
@@ -188,7 +195,7 @@ jobs:
188
195
run : ls -R .
189
196
shell : bash
190
197
- name : Test bindings
191
- run : docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
198
+ run : docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim npm test
192
199
test-linux-aarch64-gnu-binding :
193
200
name : Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }}
194
201
needs :
@@ -203,30 +210,30 @@ jobs:
203
210
runs-on : ubuntu-latest
204
211
steps :
205
212
- run : docker run --rm --privileged multiarch/qemu-user-static:register --reset
206
- - uses : actions/checkout@v2
213
+ - uses : actions/checkout@v3
207
214
- name : Download artifacts
208
- uses : actions/download-artifact@v2
215
+ uses : actions/download-artifact@v3
209
216
with :
210
217
name : bindings-aarch64-unknown-linux-gnu
211
218
path : .
212
219
- name : List packages
213
220
run : ls -R .
214
221
shell : bash
215
222
- name : Cache NPM dependencies
216
- uses : actions/cache@v2
223
+ uses : actions/cache@v3
217
224
with :
218
225
path : node_modules
219
- key : npm-cache-test-linux-aarch64-gnu-${{ matrix.node }}-${{ hashFiles('yarn. lock') }}
226
+ key : npm-cache-test-linux-aarch64-gnu-${{ matrix.node }}-${{ hashFiles('package- lock.json ') }}
220
227
- name : Install dependencies
221
- run : yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
228
+ run : npm clean- install --ignore-scripts
222
229
- name : Setup and run tests
223
230
uses : addnab/docker-run-action@v3
224
231
with :
225
232
image : ghcr.io/napi-rs/napi-rs/nodejs:aarch64-${{ matrix.node }}
226
233
options : ' -v ${{ github.workspace }}:/build -w /build'
227
234
run : |
228
235
set -e
229
- yarn test
236
+ npm test
230
237
ls -la
231
238
publish :
232
239
name : Publish
@@ -236,28 +243,28 @@ jobs:
236
243
- test-linux-x64-gnu-binding
237
244
- test-linux-aarch64-gnu-binding
238
245
steps :
239
- - uses : actions/checkout@v2
246
+ - uses : actions/checkout@v3
240
247
- name : Setup node
241
- uses : actions/setup-node@v2
248
+ uses : actions/setup-node@v3
242
249
with :
243
250
node-version : 16
244
251
check-latest : true
245
- cache : yarn
252
+ cache : npm
246
253
- name : Cache NPM dependencies
247
- uses : actions/cache@v2
254
+ uses : actions/cache@v3
248
255
with :
249
256
path : node_modules
250
- key : npm-cache-ubuntu-latest-${{ hashFiles('yarn. lock') }}
257
+ key : npm-cache-ubuntu-latest-${{ hashFiles('package- lock.json ') }}
251
258
restore-keys : |
252
259
npm-cache-
253
260
- name : Install dependencies
254
- run : yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
261
+ run : npm clean- install --ignore-scripts
255
262
- name : Download all artifacts
256
- uses : actions/download-artifact@v2
263
+ uses : actions/download-artifact@v3
257
264
with :
258
265
path : artifacts
259
266
- name : Move artifacts
260
- run : yarn artifacts
267
+ run : npm run artifacts
261
268
- name : List packages
262
269
run : ls -R ./npm
263
270
shell : bash
0 commit comments