rsnext/.github/workflows/build_and_test.yml
Maia Teegarden f412c8a991
Remove wasm target (#57437)
This PR removes the wasm target for the next-swc build for the next major version.  The main motivation is that Turbopack does not support targeting wasm yet, and it would be a significant amount of work to add. We plan to make Turbopack the default zero-config experience in a minor version, possibly before we are able to support a wasm target, so we need to make this breaking change now. We also plan to make more improvements to the webpack experience with shared Rust code, which we have so far been blocked from implementing because of the current wasm restrictions. We would like to support a wasm target again in the future, but cannot say at this time when that would be.


Closes WEB-1865
2023-10-26 02:29:07 +00:00

270 lines
7.9 KiB
YAML

name: build-and-test
on:
push:
branches: ['canary']
pull_request:
types: [opened, synchronize]
env:
NAPI_CLI_VERSION: 2.14.7
TURBO_VERSION: 1.10.9
NODE_LTS_VERSION: 20
TEST_CONCURRENCY: 8
# disable backtrace for test snapshots
RUST_BACKTRACE: 0
TURBO_TEAM: 'vercel'
TURBO_REMOTE_ONLY: 'true'
NEXT_TELEMETRY_DISABLED: 1
# we build a dev binary for use in CI so skip downloading
# canary next-swc binaries in the monorepo
NEXT_SKIP_NATIVE_POSTINSTALL: 1
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
DATADOG_TRACE_NEXTJS_TEST: 'true'
DD_ENV: 'ci'
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
NEXT_TEST_JOB: 1
jobs:
build-native:
name: build-native
uses: ./.github/workflows/build_reusable.yml
with:
skipInstallBuild: 'yes'
secrets: inherit
build-next:
name: build-next
uses: ./.github/workflows/build_reusable.yml
with:
skipNativeBuild: 'yes'
secrets: inherit
lint:
name: lint
needs: ['build-native', 'build-next']
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: pnpm lint-no-typescript && pnpm check-examples
secrets: inherit
validate-docs-links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: corepack enable
- name: 'Run link checker'
run: node ./.github/actions/validate-docs-links/lib
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
check-types-precompiled:
name: types and precompiled
needs: ['build-native', 'build-next']
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: pnpm types-and-precompiled
skipForDocsOnly: 'yes'
secrets: inherit
test-cargo-unit:
name: test cargo unit
needs: ['build-next']
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
needsRust: 'yes'
skipInstallBuild: 'yes'
skipNativeBuild: 'yes'
afterBuild: turbo run test-cargo-unit
mold: 'yes'
secrets: inherit
test-cargo-integration:
name: test cargo integration
needs: ['build-next']
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
needsNextest: 'yes'
needsRust: 'yes'
skipNativeBuild: 'yes'
afterBuild: xvfb-run turbo run test-cargo-integration
test-cargo-bench:
name: test cargo benchmarks
needs: ['build-next']
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
skipForRelease: 'yes'
needsRust: 'yes'
skipNativeBuild: 'yes'
afterBuild: xvfb-run turbo run test-cargo-bench
rust-check:
name: rust check
needs: ['build-next']
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
needsRust: 'yes'
skipInstallBuild: 'yes'
skipNativeBuild: 'yes'
afterBuild: turbo run rust-check
secrets: inherit
test-turbopack-dev:
name: test turbopack dev
needs: ['build-native', 'build-next']
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5]
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-tests-manifest.json" TURBOPACK=1 NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=dev node run-tests.js --test-pattern '^(test\/(development|e2e))/.*\.test\.(js|jsx|ts|tsx)$' --timings -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY}
secrets: inherit
test-turbopack-integration:
name: test turbopack integration
needs: ['build-native', 'build-next']
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5]
uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 18.17.0
skipForDocsOnly: 'yes'
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-tests-manifest.json" TURBOPACK=1 node run-tests.js --timings -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY} --type integration
secrets: inherit
# test-next-swc-wasm:
# name: test next-swc wasm
# needs: ['build-native', 'build-next']
# uses: ./.github/workflows/build_reusable.yml
# with:
# skipForDocsOnly: 'yes'
# afterBuild: rustup target add wasm32-unknown-unknown && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh && node ./scripts/normalize-version-bump.js && turbo run build-wasm -- --target nodejs --features tracing/release_max_level_info && git checkout . && mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-nodejs && node ./scripts/setup-wasm.mjs && NEXT_TEST_MODE=start TEST_WASM=true node run-tests.js test/production/pages-dir/production/test/index.test.ts test/e2e/streaming-ssr/index.test.ts
# secrets: inherit
test-unit:
name: test unit
strategy:
fail-fast: false
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: node run-tests.js -c ${TEST_CONCURRENCY} --type unit
secrets: inherit
test-dev:
name: test dev
needs: ['build-native', 'build-next']
strategy:
fail-fast: false
matrix:
group: [1, 2, 3]
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --type development
secrets: inherit
test-prod:
name: test prod
needs: ['build-native', 'build-next']
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5]
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY} --type production
secrets: inherit
test-integration:
name: test integration
needs: ['build-native', 'build-next']
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 18.17.0
skipForDocsOnly: 'yes'
afterBuild: node run-tests.js --timings -g ${{ matrix.group }}/12 -c ${TEST_CONCURRENCY} --type integration
secrets: inherit
test-firefox-safari:
name: test firefox and safari
needs: ['build-native', 'build-next']
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: pnpm playwright install && BROWSER_NAME=firefox node run-tests.js test/production/pages-dir/production/test/index.test.ts && BROWSER_NAME=safari NEXT_TEST_MODE=start node run-tests.js -c 1 test/production/pages-dir/production/test/index.test.ts test/e2e/basepath.test.ts && BROWSER_NAME=safari DEVICE_NAME='iPhone XR' node run-tests.js -c 1 test/production/prerender-prefetch/index.test.ts
secrets: inherit
report-test-results:
needs:
[
'test-unit',
'test-dev',
'test-prod',
'test-integration',
'test-turbopack-dev',
'test-turbopack-integration',
]
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
uploadTestTrace: 'yes'
secrets: inherit
tests-pass:
needs:
[
'build-native',
'build-next',
'lint',
'validate-docs-links',
'check-types-precompiled',
'test-unit',
'test-dev',
'test-prod',
'test-integration',
'test-cargo-unit',
'test-cargo-integration',
'test-cargo-bench',
'rust-check',
'test-turbopack-dev',
'test-turbopack-integration',
]
if: always()
runs-on: ubuntu-latest
name: thank you, next
steps:
- run: exit 1
if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled')) }}