@@ -24,42 +24,12 @@ jobs:
24
24
- name : Setup node
25
25
uses : actions/setup-node@v1
26
26
with :
27
- node-version : 12
28
-
29
- - name : Cache
30
- uses : actions/cache@v2
31
- with :
32
- path : |
33
- ~/.cargo/
34
- **/target/
35
- key : ${{ runner.os }}-publish-integration
36
-
37
- - name : Set platform name
38
- run : |
39
- export NODE_PLATFORM_NAME=$(node -e "console.log(require('os').platform())")
40
- echo "PLATFORM_NAME=$NODE_PLATFORM_NAME" >> $GITHUB_ENV
41
- shell : bash
42
-
43
- - name : Install llvm
44
- if : matrix.os == 'windows-latest'
45
- run : choco install -y llvm
46
-
47
- - name : Set llvm path
48
- if : matrix.os == 'windows-latest'
49
- uses : allenevans/set-env@v2.0.0
50
- with :
51
- LIBCLANG_PATH : ' C:\\Program Files\\LLVM\\bin'
27
+ node-version : 14
52
28
53
29
- name : Install node dependencies
54
30
run : npm i
55
31
56
32
- name : Build
57
- if : matrix.os != 'macos-latest'
58
- shell : bash
59
- run : npm run build
60
-
61
- - name : Build
62
- if : matrix.os == 'macos-latest'
63
33
shell : bash
64
34
run : npm run build
65
35
env :
@@ -69,17 +39,13 @@ jobs:
69
39
uses : actions/upload-artifact@v2
70
40
with :
71
41
name : bindings
72
- path : swc.${{ env.PLATFORM_NAME }}.node
73
-
74
- - name : List packages
75
- run : ls -R ./scripts/npm/
76
- shell : bash
42
+ path : swc.*.node
77
43
78
44
- name : Test bindings
79
45
run : npm test
80
46
81
- build_musl :
82
- name : stable - linux-musl - node@12
47
+ build-linux-musl :
48
+ name : stable - linux-musl - node@10
83
49
runs-on : ubuntu-latest
84
50
85
51
steps :
@@ -93,45 +59,218 @@ jobs:
93
59
DOCKER_USERNAME : ${{ github.actor }}
94
60
DOCKER_PASSWORD : ${{ secrets.GITHUB_TOKEN }}
95
61
62
+ - name : Cache
63
+ uses : actions/cache@v2
64
+ with :
65
+ path : |
66
+ target/
67
+ key : linux-musl-publish-integration
68
+
96
69
- name : Pull docker image
97
70
run : |
98
- docker pull docker.pkg.github.com/napi-rs/napi-rs/rust- nodejs-alpine:lts
99
- docker tag docker.pkg.github.com/napi-rs/napi-rs/rust- nodejs-alpine:lts builder
71
+ docker pull docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine
72
+ docker tag docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine builder
100
73
- name : " Install dependencies"
101
- run : yarn install --frozen-lockfile --registry https://registry.npmjs.org
74
+ run : npm i
102
75
103
76
- name : " Build"
104
77
run : |
105
- docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/node-rs -w /node-rs builder sh -c "cargo build -p node --release"
106
- docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/node-rs -w /node-rs builder sh -c "./node_modules/.bin/napi build --platform --cargo-name node --musl --release -c ./package.json ./scripts/npm"
78
+ docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/swc -w /swc builder sh -c "./node_modules/.bin/napi build --platform --cargo-name node --release -c ./package.json --cargo-flags='-p node'"
79
+
80
+ - name : Upload artifact
81
+ uses : actions/upload-artifact@v2
82
+ with :
83
+ name : bindings
84
+ path : swc.*.node
85
+
86
+ build-apple-silicon :
87
+ name : nightly - aarch64-apple-darwin - node@14
88
+ runs-on : macos-latest
89
+
90
+ steps :
91
+ - uses : actions/checkout@v2
107
92
108
- - name : List packages
109
- run : ls -R ./scripts/npm/
93
+ - name : Setup node
94
+ uses : actions/setup-node@v1
95
+ with :
96
+ node-version : 14
97
+
98
+ - name : Install
99
+ uses : actions-rs/toolchain@v1
100
+ with :
101
+ toolchain : nightly
102
+ profile : minimal
103
+ override : true
104
+
105
+ - name : Install aarch64 toolchain
106
+ run : rustup target add aarch64-apple-darwin
107
+
108
+ - name : Cache
109
+ uses : actions/cache@v2
110
+ with :
111
+ path : |
112
+ target/
113
+ key : aarch64-apple-darwin-publish-integration
114
+
115
+ - name : Install dependencies
116
+ run : npm i
117
+
118
+ - name : Cross build aarch64
119
+ run : yarn build --target aarch64-apple-darwin
120
+
121
+ - name : Upload artifact
122
+ uses : actions/upload-artifact@v2
123
+ with :
124
+ name : bindings
125
+ path : swc.*.node
126
+
127
+ build-linux-aarch64 :
128
+ name : stable - aarch64-unknown-linux-gnu - node@14
129
+ runs-on : ubuntu-latest
130
+
131
+ steps :
132
+ - run : docker run --rm --privileged multiarch/qemu-user-static:register --reset
133
+
134
+ - uses : actions/checkout@v2
135
+
136
+ - name : Setup node
137
+ uses : actions/setup-node@v1
138
+ with :
139
+ node-version : 14
140
+
141
+ - name : Install
142
+ uses : actions-rs/toolchain@v1
143
+ with :
144
+ toolchain : stable
145
+ profile : minimal
146
+ override : true
147
+
148
+ - name : Install aarch64 toolchain
149
+ run : rustup target add aarch64-unknown-linux-gnu
150
+
151
+ - name : Cache
152
+ uses : actions/cache@v2
153
+ with :
154
+ path : |
155
+ target/
156
+ key : aarch64-linux-gnu-publish-integration
157
+
158
+
159
+ - name : Install cross compile toolchain
160
+ run : |
161
+ sudo apt-get update
162
+ sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y
163
+
164
+ - name : Install dependencies
165
+ run : npm i
166
+
167
+ - name : Cross build aarch64
168
+ run : yarn build --target aarch64-unknown-linux-gnu
169
+
170
+ - name : Upload artifact
171
+ uses : actions/upload-artifact@v2
172
+ with :
173
+ name : bindings
174
+ path : swc.*.node
175
+
176
+ build-linux-arm7 :
177
+ name : stable - arm7-unknown-linux-gnu - node@14
178
+ runs-on : ubuntu-latest
179
+
180
+ steps :
181
+ - run : docker run --rm --privileged multiarch/qemu-user-static:register --reset
182
+
183
+ - uses : actions/checkout@v2
184
+
185
+ - name : Setup node
186
+ uses : actions/setup-node@v1
187
+ with :
188
+ node-version : 14
189
+
190
+ - name : Install
191
+ uses : actions-rs/toolchain@v1
192
+ with :
193
+ toolchain : stable
194
+ profile : minimal
195
+ override : true
196
+
197
+ - name : Install aarch64 toolchain
198
+ run : rustup target add armv7-unknown-linux-gnueabihf
199
+
200
+ - name : Cache
201
+ uses : actions/cache@v2
202
+ with :
203
+ path : |
204
+ target/
205
+ key : arm7-linux-gnu-publish-integration
206
+
207
+ - name : Install cross compile toolchain
208
+ run : |
209
+ sudo apt-get update
210
+ sudo apt-get install gcc-arm-linux-gnueabihf -y
211
+
212
+ - name : Install dependencies
213
+ run : npm i
214
+
215
+ - name : Cross build aarch64
216
+ run : yarn build --target armv7-unknown-linux-gnueabihf
217
+
218
+ - name : Upload artifact
219
+ uses : actions/upload-artifact@v2
220
+ with :
221
+ name : bindings
222
+ path : swc.*.node
223
+
224
+ build-android-aarch64 :
225
+ name : Build - Android - aarch64
226
+ runs-on : macos-latest
227
+ steps :
228
+ - uses : actions/checkout@v2
229
+
230
+ - name : Setup node
231
+ uses : actions/setup-node@v1
232
+ with :
233
+ node-version : 14
234
+
235
+ - name : Install aarch64 toolchain
236
+ run : rustup target add aarch64-linux-android
237
+
238
+ - name : Install node dependencies
239
+ run : npm i
240
+
241
+ - name : Build
110
242
shell : bash
243
+ run : |
244
+ export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang"
245
+ yarn build --target aarch64-linux-android
111
246
112
247
- name : Upload artifact
113
248
uses : actions/upload-artifact@v2
114
249
with :
115
250
name : bindings
116
- path : scripts/npm/swc.linux-musl.node
251
+ path : swc.*.node
252
+
117
253
publish :
118
254
name : npm
119
255
runs-on : ubuntu-latest
120
256
needs :
121
257
- build
122
- - build_musl
258
+ - build-linux-musl
259
+ - build-linux-arm7
260
+ - build-linux-aarch64
261
+ - build-apple-silicon
262
+ - build-android-aarch64
123
263
steps :
124
264
- uses : actions/checkout@v2
125
265
126
266
- name : Setup node
127
267
uses : actions/setup-node@v1
128
268
with :
129
- node-version : 12
269
+ node-version : 14
130
270
131
271
- name : Set release name
132
272
run : echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
133
273
134
- # Do not cache node_modules, or yarn workspace links broken
135
274
- name : Install dependencies
136
275
run : npm i
137
276
@@ -148,6 +287,10 @@ jobs:
148
287
shell : bash
149
288
run : npm run artifacts
150
289
290
+ - name : List npm
291
+ run : ls -R ./scripts/npm
292
+ shell : bash
293
+
151
294
- name : Publish
152
295
run : |
153
296
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
0 commit comments