@@ -153,92 +153,17 @@ jobs:
153
153
pnpm run test-browser
154
154
pnpm build-browser-bundle --npmDir npm-dir
155
155
156
- # NAPI tests are slow, so we shard them into multiple jobs.
157
- # But we want to build all the packages together, so they share a single build cache.
158
- #
159
- # * `napi-build` - build all packages, and upload build files as an artifact.
160
- # * In parallel:
161
- # * `napi-test` (sharded - 1 job per package)
162
- # * `napi-test-e2e`
163
- # * `napi-cleanup` - deletes build files artifact
164
- napi-build :
165
- name : Build NAPI packages
166
- runs-on : ubuntu-latest
167
- steps :
168
- - uses : taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
169
- - uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
170
- id : filter
171
- with :
172
- predicate-quantifier : " every"
173
- filters : |
174
- src:
175
- - '!crates/oxc_linter/**'
176
- - '!crates/oxc_language_server/**'
177
- - '!editors/**'
178
- - uses : oxc-project/setup-rust@cd82e1efec7fef815e2c23d296756f31c7cdc03d # v1.0.0
179
- if : steps.filter.outputs.src == 'true'
180
- with :
181
- cache-key : napi
182
- save-cache : ${{ github.ref_name == 'main' }}
183
- - uses : oxc-project/setup-node@f42e3bda950c7454575e78ee4eaac880a077700c # v1.0.0
184
- if : steps.filter.outputs.src == 'true'
185
- - name : Install wasm32-wasip1-threads
186
- if : steps.filter.outputs.src == 'true'
187
- run : |
188
- rustup target add wasm32-wasip1-threads
189
- - name : Build minify
190
- if : steps.filter.outputs.src == 'true'
191
- working-directory : napi/minify
192
- run : |
193
- pnpm run build-test
194
- - name : Build oxlint2
195
- if : steps.filter.outputs.src == 'true'
196
- working-directory : napi/oxlint2
197
- run : |
198
- pnpm run build-test
199
- - name : Build parser
200
- if : steps.filter.outputs.src == 'true'
201
- working-directory : napi/parser
202
- run : |
203
- pnpm run build-test
204
- - name : Build playground
205
- if : steps.filter.outputs.src == 'true'
206
- working-directory : napi/playground
207
- run : |
208
- pnpm run build-test
209
- - name : Build transform
210
- if : steps.filter.outputs.src == 'true'
211
- working-directory : napi/transform
212
- run : |
213
- pnpm run build-test
214
- - name : Check no uncommitted files
215
- if : steps.filter.outputs.src == 'true'
216
- run : |
217
- git diff --exit-code # Must commit everything
218
- - name : Upload build files
219
- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
220
- with :
221
- if-no-files-found : error
222
- name : napi
223
- path : |
224
- napi/minify/*.node
225
- napi/oxlint2/dist/
226
- napi/parser/*.node
227
- napi/transform/*.node
228
- retention-days : 1
229
-
230
- napi-test :
156
+ # Sharded because these tests are slow
157
+ test-napi :
231
158
name : Test NAPI
232
159
runs-on : ubuntu-latest
233
- needs : napi-build
234
160
strategy :
235
161
fail-fast : true
236
162
matrix :
237
163
component :
238
- - minify
239
164
- oxlint2
240
165
- parser
241
- - transform
166
+ - playground
242
167
steps :
243
168
- uses : taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
244
169
- uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
@@ -250,32 +175,40 @@ jobs:
250
175
- '!crates/oxc_linter/**'
251
176
- '!crates/oxc_language_server/**'
252
177
- '!editors/**'
253
- - uses : oxc-project/setup-node@f42e3bda950c7454575e78ee4eaac880a077700c # v1.0.0
254
- if : steps.filter.outputs.src == 'true'
255
- - name : Download build files
256
- uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
257
- with :
258
- name : napi
259
- path : napi
260
- pattern : ${{ matrix.component }}/**/*
261
178
# Submodules only needed for parser tests
262
179
- uses : ./.github/actions/clone-submodules
263
180
if : steps.filter.outputs.src == 'true' && matrix.component == 'parser'
264
181
with :
265
182
babel : false
266
183
prettier : false
267
- - name : Run tests
184
+ - uses : oxc-project/setup-rust@cd82e1efec7fef815e2c23d296756f31c7cdc03d # v1.0.0
268
185
if : steps.filter.outputs.src == 'true'
186
+ with :
187
+ cache-key : napi-${{ matrix.component }}
188
+ save-cache : ${{ github.ref_name == 'main' }}
189
+ - uses : oxc-project/setup-node@f42e3bda950c7454575e78ee4eaac880a077700c # v1.0.0
190
+ if : steps.filter.outputs.src == 'true'
191
+ - if : steps.filter.outputs.src == 'true'
192
+ name : Build
193
+ working-directory : napi/${{ matrix.component }}
194
+ run : |
195
+ rustup target add wasm32-wasip1-threads
196
+ pnpm run build-test
197
+ - if : steps.filter.outputs.src == 'true' && matrix.component != 'playground'
198
+ name : Run tests
269
199
working-directory : napi/${{ matrix.component }}
270
200
env :
271
201
RUN_RAW_TESTS : " true"
272
202
run : |
273
203
pnpm run test
204
+ - if : steps.filter.outputs.src == 'true'
205
+ run : |
206
+ git diff --exit-code # Must commit everything
274
207
275
- napi-test-e2e :
208
+ # Includes transformer and minifier
209
+ test-napi-e2e :
276
210
name : Test NAPI (e2e)
277
211
runs-on : ubuntu-latest
278
- needs : napi-build
279
212
steps :
280
213
- uses : taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
281
214
- uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
@@ -287,34 +220,46 @@ jobs:
287
220
- '!crates/oxc_linter/**'
288
221
- '!crates/oxc_language_server/**'
289
222
- '!editors/**'
290
- - uses : oxc-project/setup-node@f42e3bda950c7454575e78ee4eaac880a077700c # v1.0.0
223
+ - uses : oxc-project/setup-rust@cd82e1efec7fef815e2c23d296756f31c7cdc03d # v1.0.0
291
224
if : steps.filter.outputs.src == 'true'
292
- - name : Download build files
293
- uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
294
225
with :
295
- name : napi
296
- path : napi
297
- pattern : " {minify,transform}/*.node"
298
- - name : Install NPM packages
226
+ cache-key : napi-e2e
227
+ save-cache : ${{ github.ref_name == 'main' }}
228
+ - uses : oxc-project/setup-node@f42e3bda950c7454575e78ee4eaac880a077700c # v1.0.0
299
229
if : steps.filter.outputs.src == 'true'
300
- working-directory : tasks/e2e
230
+ - if : steps.filter.outputs.src == 'true'
231
+ name : Install wasm32-wasip1-threads
301
232
run : |
302
- pnpm install --frozen-lockfile
303
- - name : Run tests
304
- if : steps.filter.outputs.src == 'true'
233
+ rustup target add wasm32-wasip1-threads
234
+ - if : steps.filter.outputs.src == 'true'
235
+ name : Build transformer
236
+ working-directory : napi/transform
237
+ run : |
238
+ pnpm run build-test
239
+ - if : steps.filter.outputs.src == 'true'
240
+ name : Run transformer tests
241
+ working-directory : napi/transform
242
+ run : |
243
+ pnpm run test
244
+ - if : steps.filter.outputs.src == 'true'
245
+ name : Build minifier
246
+ working-directory : napi/minify
247
+ run : |
248
+ pnpm run build-test
249
+ - if : steps.filter.outputs.src == 'true'
250
+ name : Run minifier tests
251
+ working-directory : napi/minify
252
+ run : |
253
+ pnpm run test
254
+ - if : steps.filter.outputs.src == 'true'
255
+ name : Run e2e tests
305
256
working-directory : tasks/e2e
306
257
run : |
258
+ pnpm install --frozen-lockfile
307
259
pnpm run test
308
-
309
- napi-cleanup :
310
- name : Delete NAPI build artifacts
311
- runs-on : ubuntu-latest
312
- needs : [napi-test, napi-test-e2e]
313
- steps :
314
- - uses : geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0
315
- with :
316
- name : napi
317
- failOnError : false
260
+ - if : steps.filter.outputs.src == 'true'
261
+ run : |
262
+ git diff --exit-code # Must commit everything
318
263
319
264
typos :
320
265
name : Spell Check
0 commit comments