Skip to content

Commit ea30af4

Browse files
authored
chore(CI): Run rspack tests in build_and_test.yml (vercel#78757)
This is mostly a copy-paste of the turbopack tests in `build_and_test.yml`. - Only runs tests on PRs with the `Rspack` label. - Only runs the tests listed as passing in the manifest files. We want to identify regressions, but shouldn't report failures on known broken tests. - Don't bother with the code for running tests against React 18. The cost of running those tests is high, and the value is pretty low. Most users should be on React 19. - Rspack test failures are not yet blocking. We need to run continuously against canary to have confidence in blocking on this. Current problems (I don't think these are blocking for this PR): - The manifests are out of date. I'm working on this! The tests aren't blocking though, so it shouldn't be an issue for this PR. - If the label is added *after* the PR is created, the rspack tests won't run until you push a new revision of the PR. I discussed this with @ijjk and the solution will likely involve moving these tests into a separate workflow that can subscribe to label changes. I'll experiment with this in a follow-up PR.
1 parent 5dfd866 commit ea30af4

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

.github/workflows/build_and_test.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ jobs:
4949
outputs:
5050
docs-only: ${{ steps.docs-change.outputs.DOCS_ONLY != 'false' }}
5151
is-release: ${{ steps.is-release.outputs.IS_RELEASE == 'true' }}
52+
rspack: >-
53+
${{
54+
github.event_name == 'pull_request' &&
55+
contains(github.event.pull_request.labels.*.name, 'Rspack')
56+
}}
5257
5358
build-native:
5459
name: build-native
@@ -338,6 +343,124 @@ jobs:
338343
stepName: 'test-turbopack-production-integration-${{ matrix.group }}'
339344
secrets: inherit
340345

346+
test-rspack-dev:
347+
name: test rspack dev
348+
needs: ['optimize-ci', 'changes', 'build-next', 'build-native']
349+
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' && needs.changes.outputs.rspack == 'true' }}
350+
strategy:
351+
fail-fast: false
352+
matrix:
353+
group: [1/5, 2/5, 3/5, 4/5, 5/5]
354+
uses: ./.github/workflows/build_reusable.yml
355+
with:
356+
afterBuild: |
357+
export NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/rspack-dev-tests-manifest.json"
358+
export NEXT_TEST_MODE=dev
359+
360+
# rspack flags
361+
export NEXT_RSPACK=1
362+
export NEXT_TEST_USE_RSPACK=1
363+
364+
# HACK: Despite the name, this environment variable is only used to gate
365+
# tests, so it's applicable to rspack
366+
export TURBOPACK_DEV=1
367+
368+
node run-tests.js \
369+
--test-pattern '^(test\/(development|e2e))/.*\.test\.(js|jsx|ts|tsx)$' \
370+
--timings \
371+
-g ${{ matrix.group }}
372+
stepName: 'test-rspack-dev-react-${{ matrix.react }}-${{ matrix.group }}'
373+
secrets: inherit
374+
375+
test-rspack-integration:
376+
name: test rspack development integration
377+
needs: ['optimize-ci', 'changes', 'build-next', 'build-native']
378+
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' && needs.changes.outputs.rspack == 'true' }}
379+
strategy:
380+
fail-fast: false
381+
matrix:
382+
group: [1/6, 2/6, 3/6, 4/6, 5/6, 6/6]
383+
uses: ./.github/workflows/build_reusable.yml
384+
with:
385+
nodeVersion: 18.18.2
386+
afterBuild: |
387+
export NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/rspack-dev-tests-manifest.json"
388+
389+
# rspack flags
390+
export NEXT_RSPACK=1
391+
export NEXT_TEST_USE_RSPACK=1
392+
393+
# HACK: Despite the name, this environment variable is only used to gate
394+
# tests, so it's applicable to rspack
395+
export TURBOPACK_DEV=1
396+
397+
node run-tests.js \
398+
--timings \
399+
-g ${{ matrix.group }} \
400+
--type integration
401+
stepName: 'test-rspack-integration-react-${{ matrix.react }}-${{ matrix.group }}'
402+
secrets: inherit
403+
404+
test-rspack-production:
405+
name: test rspack production
406+
needs: ['optimize-ci', 'changes', 'build-next', 'build-native']
407+
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' && needs.changes.outputs.rspack == 'true' }}
408+
strategy:
409+
fail-fast: false
410+
matrix:
411+
exclude:
412+
# Excluding React 18 tests unless on `canary` branch until budget is approved.
413+
- react: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'run-react-18-tests') && '18.3.1' }}
414+
group: [1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 7/7]
415+
# Empty value uses default
416+
uses: ./.github/workflows/build_reusable.yml
417+
with:
418+
nodeVersion: 18.18.2
419+
afterBuild: |
420+
export NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/rspack-build-tests-manifest.json"
421+
export NEXT_TEST_MODE=start
422+
423+
# rspack flags
424+
export NEXT_RSPACK=1
425+
export NEXT_TEST_USE_RSPACK=1
426+
427+
# HACK: Despite the name, this environment variable is only used to gate
428+
# tests, so it's applicable to rspack
429+
export TURBOPACK_BUILD=1
430+
431+
node run-tests.js --timings -g ${{ matrix.group }} --type production
432+
stepName: 'test-rspack-production-react-${{ matrix.react }}-${{ matrix.group }}'
433+
secrets: inherit
434+
435+
test-rspack-production-integration:
436+
name: test rspack production integration
437+
needs: ['optimize-ci', 'changes', 'build-next', 'build-native']
438+
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' && needs.changes.outputs.rspack == 'true' }}
439+
strategy:
440+
fail-fast: false
441+
matrix:
442+
group: [1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 7/7]
443+
uses: ./.github/workflows/build_reusable.yml
444+
with:
445+
nodeVersion: 18.18.2
446+
afterBuild: |
447+
export NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/rspack-build-tests-manifest.json"
448+
449+
# rspack flags
450+
export NEXT_RSPACK=1
451+
export NEXT_TEST_USE_RSPACK=1
452+
453+
# HACK: Despite the name, this environment variable is only used to gate
454+
# tests, so it's applicable to rspack
455+
export TURBOPACK_BUILD=1
456+
457+
node run-tests.js \
458+
--timings \
459+
-g ${{ matrix.group }} \
460+
--type integration
461+
stepName: 'test-rspack-production-integration-${{ matrix.group }}'
462+
secrets: inherit
463+
341464
test-next-swc-wasm:
342465
name: test next-swc wasm
343466
needs: ['optimize-ci', 'changes', 'build-next']

0 commit comments

Comments
 (0)