2023-05-28 06:02:31 +02:00
|
|
|
name: build-and-test
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: ['canary']
|
2023-05-28 07:57:45 +02:00
|
|
|
pull_request:
|
2023-05-28 06:02:31 +02:00
|
|
|
types: [opened, synchronize]
|
|
|
|
|
|
|
|
env:
|
|
|
|
NAPI_CLI_VERSION: 2.14.7
|
2024-06-28 10:15:22 +02:00
|
|
|
TURBO_VERSION: 2.0.6-canary.0
|
2023-11-02 11:43:18 +01:00
|
|
|
NODE_MAINTENANCE_VERSION: 18
|
2023-10-16 23:41:38 +02:00
|
|
|
NODE_LTS_VERSION: 20
|
2023-08-11 23:05:11 +02:00
|
|
|
TEST_CONCURRENCY: 8
|
2023-06-07 18:53:50 +02:00
|
|
|
# disable backtrace for test snapshots
|
|
|
|
RUST_BACKTRACE: 0
|
2023-05-28 06:02:31 +02:00
|
|
|
|
|
|
|
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
|
2023-06-08 12:52:49 +02:00
|
|
|
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
|
2023-11-23 15:18:03 +01:00
|
|
|
NEXT_JUNIT_TEST_REPORT: 'true'
|
2023-06-08 12:52:49 +02:00
|
|
|
DD_ENV: 'ci'
|
2023-05-28 06:02:31 +02:00
|
|
|
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
|
|
|
|
NEXT_TEST_JOB: 1
|
|
|
|
|
|
|
|
jobs:
|
2023-11-29 19:25:01 +01:00
|
|
|
changes:
|
|
|
|
name: Determine changes
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
steps:
|
2024-02-01 22:13:29 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-11-29 19:25:01 +01:00
|
|
|
with:
|
|
|
|
fetch-depth: 25
|
|
|
|
|
|
|
|
- name: check for docs only change
|
|
|
|
id: docs-change
|
|
|
|
run: |
|
|
|
|
echo "DOCS_ONLY<<EOF" >> $GITHUB_OUTPUT;
|
|
|
|
echo "$(node scripts/run-for-change.js --not --type docs --exec echo 'false')" >> $GITHUB_OUTPUT;
|
|
|
|
echo 'EOF' >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: check for release
|
|
|
|
id: is-release
|
|
|
|
run: |
|
|
|
|
if [[ $(node ./scripts/check-is-release.js 2> /dev/null || :) = v* ]];
|
|
|
|
then
|
|
|
|
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
|
|
|
|
else
|
|
|
|
echo "IS_RELEASE=false" >> $GITHUB_OUTPUT
|
|
|
|
fi
|
|
|
|
|
|
|
|
outputs:
|
|
|
|
docs-only: ${{ steps.docs-change.outputs.DOCS_ONLY != 'false' }}
|
|
|
|
is-release: ${{ steps.is-release.outputs.IS_RELEASE == 'true' }}
|
|
|
|
|
2023-06-12 16:47:43 +02:00
|
|
|
build-native:
|
|
|
|
name: build-native
|
2023-06-06 18:57:09 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
2023-06-12 16:47:43 +02:00
|
|
|
with:
|
|
|
|
skipInstallBuild: 'yes'
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'build-native'
|
2023-06-12 16:47:43 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
build-next:
|
|
|
|
name: build-next
|
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
|
|
|
skipNativeBuild: 'yes'
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'build-next'
|
2023-05-28 06:02:31 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
lint:
|
|
|
|
name: lint
|
2023-06-12 16:47:43 +02:00
|
|
|
needs: ['build-native', 'build-next']
|
2023-05-28 06:02:31 +02:00
|
|
|
|
2023-06-06 18:57:09 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
2023-05-28 06:02:31 +02:00
|
|
|
with:
|
|
|
|
afterBuild: pnpm lint-no-typescript && pnpm check-examples
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'lint'
|
2023-05-28 06:02:31 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
2023-07-24 21:35:21 +02:00
|
|
|
validate-docs-links:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-02-01 22:13:29 +01:00
|
|
|
- uses: actions/checkout@v4
|
2024-02-04 23:06:28 +01:00
|
|
|
- uses: actions/setup-node@v4
|
2023-07-24 21:35:21 +02:00
|
|
|
with:
|
|
|
|
node-version: 18
|
2023-10-07 00:15:59 +02:00
|
|
|
- run: corepack enable
|
2023-07-24 21:35:21 +02:00
|
|
|
- name: 'Run link checker'
|
2023-12-04 16:18:42 +01:00
|
|
|
run: node ./.github/actions/validate-docs-links/dist/index.js
|
2023-07-24 21:35:21 +02:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-05-28 06:02:31 +02:00
|
|
|
check-types-precompiled:
|
|
|
|
name: types and precompiled
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes', 'build-native', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
2023-05-28 06:02:31 +02:00
|
|
|
|
2023-06-06 18:57:09 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
2023-05-28 06:02:31 +02:00
|
|
|
with:
|
|
|
|
afterBuild: pnpm types-and-precompiled
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'types-and-precompiled'
|
2023-05-28 06:02:31 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
test-cargo-unit:
|
|
|
|
name: test cargo unit
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
2023-05-28 06:02:31 +02:00
|
|
|
|
2023-06-06 18:57:09 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
2023-05-28 06:02:31 +02:00
|
|
|
with:
|
2023-06-12 16:47:43 +02:00
|
|
|
needsRust: 'yes'
|
2023-05-28 06:02:31 +02:00
|
|
|
skipInstallBuild: 'yes'
|
2023-06-12 16:47:43 +02:00
|
|
|
skipNativeBuild: 'yes'
|
2023-05-28 06:02:31 +02:00
|
|
|
afterBuild: turbo run test-cargo-unit
|
2023-06-22 10:03:44 +02:00
|
|
|
mold: 'yes'
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-cargo-unit'
|
2023-05-28 06:02:31 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
rust-check:
|
|
|
|
name: rust check
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
2023-05-28 06:02:31 +02:00
|
|
|
|
2023-06-06 18:57:09 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
2023-05-28 06:02:31 +02:00
|
|
|
with:
|
2023-06-12 16:47:43 +02:00
|
|
|
needsRust: 'yes'
|
2023-05-28 06:02:31 +02:00
|
|
|
skipInstallBuild: 'yes'
|
2023-06-12 16:47:43 +02:00
|
|
|
skipNativeBuild: 'yes'
|
2023-05-28 06:02:31 +02:00
|
|
|
afterBuild: turbo run rust-check
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'rust-check'
|
2023-05-28 06:02:31 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
2024-02-13 00:14:36 +01:00
|
|
|
rust-doc-check:
|
|
|
|
name: rustdoc check
|
|
|
|
needs: ['changes', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
|
|
|
needsRust: 'yes'
|
|
|
|
skipInstallBuild: 'yes'
|
|
|
|
skipNativeBuild: 'yes'
|
2024-02-15 17:05:48 +01:00
|
|
|
afterBuild: ./scripts/deploy-turbopack-docs.sh
|
2024-02-13 00:14:36 +01:00
|
|
|
stepName: 'rust-doc-check'
|
|
|
|
secrets: inherit
|
|
|
|
|
2024-06-18 20:11:15 +02:00
|
|
|
devlow-bench:
|
|
|
|
name: Run devlow benchmarks
|
|
|
|
needs: ['changes', 'build-next', 'build-native']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
mode:
|
|
|
|
- '--turbopack=false'
|
|
|
|
- '--turbopack=true'
|
|
|
|
selector:
|
|
|
|
- '--scenario=heavy-npm-deps --page=homepage'
|
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
|
|
|
afterBuild: pnpm install && ./node_modules/.bin/devlow-bench ./scripts/devlow-bench.mjs --datadog=ubuntu-latest-16-core ${{ matrix.mode }} ${{ matrix.selector }}
|
2024-06-19 14:56:13 +02:00
|
|
|
stepName: 'devlow-bench-${{ matrix.mode }}-${{ matrix.selector }}'
|
2024-06-18 20:11:15 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
2023-05-28 06:02:31 +02:00
|
|
|
test-turbopack-dev:
|
|
|
|
name: test turbopack dev
|
2024-04-11 18:54:36 +02:00
|
|
|
needs: ['changes', 'build-next', 'build-native']
|
2023-11-29 19:25:01 +01:00
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2023-09-08 19:30:07 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-12-06 02:10:00 +01:00
|
|
|
group: [1/5, 2/5, 3/5, 4/5, 5/5]
|
2023-06-06 18:57:09 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
2023-05-28 06:02:31 +02:00
|
|
|
with:
|
2024-03-25 10:28:35 +01:00
|
|
|
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-dev-tests-manifest.json" TURBOPACK=1 TURBOPACK_DEV=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 }} -c ${TEST_CONCURRENCY}
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-turbopack-dev-${{ matrix.group }}'
|
2023-08-02 14:31:52 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
2023-07-04 09:40:50 +02:00
|
|
|
test-turbopack-integration:
|
2024-03-19 10:26:14 +01:00
|
|
|
name: test turbopack development integration
|
2024-04-11 18:54:36 +02:00
|
|
|
needs: ['changes', 'build-next', 'build-native']
|
2023-11-29 19:25:01 +01:00
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2023-07-04 09:40:50 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-12-06 02:10:00 +01:00
|
|
|
group: [1/5, 2/5, 3/5, 4/5, 5/5]
|
2023-07-04 09:40:50 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
2024-07-05 11:21:57 +02:00
|
|
|
nodeVersion: 18.18.2
|
2024-03-25 10:28:35 +01:00
|
|
|
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-dev-tests-manifest.json" TURBOPACK=1 TURBOPACK_DEV=1 node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type integration
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-turbopack-integration-${{ matrix.group }}'
|
2023-07-04 09:40:50 +02:00
|
|
|
secrets: inherit
|
2023-09-06 19:46:54 +02:00
|
|
|
|
2024-03-19 10:26:14 +01:00
|
|
|
test-turbopack-production:
|
|
|
|
name: test turbopack production
|
2024-04-11 18:54:36 +02:00
|
|
|
needs: ['changes', 'build-next', 'build-native']
|
2024-03-19 10:26:14 +01:00
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
group: [1/5, 2/5, 3/5, 4/5, 5/5]
|
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
2024-07-05 11:21:57 +02:00
|
|
|
nodeVersion: 18.18.2
|
2024-03-19 14:40:56 +01:00
|
|
|
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-build-tests-manifest.json" TURBOPACK=1 TURBOPACK_BUILD=1 NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
|
2024-03-19 10:26:14 +01:00
|
|
|
stepName: 'test-turbopack-production-${{ matrix.group }}'
|
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
test-turbopack-production-integration:
|
|
|
|
name: test turbopack production integration
|
2024-04-11 18:54:36 +02:00
|
|
|
needs: ['changes', 'build-next', 'build-native']
|
2024-03-19 10:26:14 +01:00
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
group: [1/5, 2/5, 3/5, 4/5, 5/5]
|
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
2024-07-05 11:21:57 +02:00
|
|
|
nodeVersion: 18.18.2
|
2024-03-19 10:26:14 +01:00
|
|
|
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-build-tests-manifest.json" TURBOPACK=1 TURBOPACK_BUILD=1 node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type integration
|
|
|
|
stepName: 'test-turbopack-production-integration-${{ matrix.group }}'
|
|
|
|
secrets: inherit
|
|
|
|
|
2023-11-02 22:00:54 +01:00
|
|
|
test-next-swc-wasm:
|
|
|
|
name: test next-swc wasm
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2023-11-02 22:00:54 +01:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
2024-02-28 18:13:54 +01:00
|
|
|
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 && 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
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-next-swc-wasm'
|
2023-11-02 22:00:54 +01:00
|
|
|
secrets: inherit
|
2023-05-28 06:02:31 +02:00
|
|
|
|
feat(next-swc): support wasm32-* build target (#61586)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:
## For Contributors
### Improving Documentation
- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide
### Adding or Updating Examples
- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md
### Fixing a bug
- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md
### Adding a feature
- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md
## For Maintainers
- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change
### How?
Closes NEXT-
Fixes #
-->
### What?
This PR introduces a ground work to generate wasm bindings package from
our napi bindings. This doesn't actually replace anything yet, however
aim to establish our napi bindings package can be built against wasm32
target.
### Why?
We currently have two bindings package to generate native / wasm target
support, one for napi and one other for wasm. Recently napi-rs started
to support to generate bindings for the wasm directly - which means we
can get rid of the wasm-pack based bindings code entirely and maintain a
single bindings code only.
This'll makes our `next-swc` simpler as well, since the invocation to
the bindings now becomes identical we don't have to additional wasm
specific logics to invoke functions (i.e transform, transformsync..).
Also napi generates wasi-supported wasm bindings, provides few more
features to the current wasm bindings.
#### Good
- Async napi binding fn works transparently (`transform`, `minify`...)
- (Experimental) thread supports depends on node.js runtime
- Wasi support: i.e it can even read filesystem directly!
#### Things to consider
- node.js's wasi support is experimental yet
- napi-rs's wasm support is in beta yet, specifically `packaging`
generated wasm output.
Due to `things to consider` reasons, this PR does not replace existing
wasm target yet. We should be able to plan out things later.
**What happens to the turbopack api in napi bindings?**
Simply put, this **does not support turbopack in wasm**. Build works by
disabling turbopack (more notably, underlying dependency doesn't support
wasm) features. It is something to explore separately.
Closes PACK-2367
There is a branch at https://github.com/vercel/next.js/pull/61586 shows
quick demo for importing, running sync / async / read external files.
2024-02-06 19:15:13 +01:00
|
|
|
#[NOTE] currently this only checks building wasi target
|
|
|
|
test-next-swc-napi-wasi:
|
|
|
|
name: test next-swc wasi
|
|
|
|
needs: ['changes', 'build-next']
|
2024-04-05 01:28:02 +02:00
|
|
|
# TODO: Re-enable this when https://github.com/napi-rs/napi-rs/issues/2009 is addressed.
|
|
|
|
# Specifically, the `platform` value is now `threads` in
|
|
|
|
# https://github.com/napi-rs/napi-rs/blob/e4ad4767efaf093fdff3dc768856f6100a6e3f72/cli/src/api/build.ts#L530
|
|
|
|
if: false
|
|
|
|
# if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
feat(next-swc): support wasm32-* build target (#61586)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:
## For Contributors
### Improving Documentation
- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide
### Adding or Updating Examples
- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md
### Fixing a bug
- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md
### Adding a feature
- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md
## For Maintainers
- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change
### How?
Closes NEXT-
Fixes #
-->
### What?
This PR introduces a ground work to generate wasm bindings package from
our napi bindings. This doesn't actually replace anything yet, however
aim to establish our napi bindings package can be built against wasm32
target.
### Why?
We currently have two bindings package to generate native / wasm target
support, one for napi and one other for wasm. Recently napi-rs started
to support to generate bindings for the wasm directly - which means we
can get rid of the wasm-pack based bindings code entirely and maintain a
single bindings code only.
This'll makes our `next-swc` simpler as well, since the invocation to
the bindings now becomes identical we don't have to additional wasm
specific logics to invoke functions (i.e transform, transformsync..).
Also napi generates wasi-supported wasm bindings, provides few more
features to the current wasm bindings.
#### Good
- Async napi binding fn works transparently (`transform`, `minify`...)
- (Experimental) thread supports depends on node.js runtime
- Wasi support: i.e it can even read filesystem directly!
#### Things to consider
- node.js's wasi support is experimental yet
- napi-rs's wasm support is in beta yet, specifically `packaging`
generated wasm output.
Due to `things to consider` reasons, this PR does not replace existing
wasm target yet. We should be able to plan out things later.
**What happens to the turbopack api in napi bindings?**
Simply put, this **does not support turbopack in wasm**. Build works by
disabling turbopack (more notably, underlying dependency doesn't support
wasm) features. It is something to explore separately.
Closes PACK-2367
There is a branch at https://github.com/vercel/next.js/pull/61586 shows
quick demo for importing, running sync / async / read external files.
2024-02-06 19:15:13 +01:00
|
|
|
|
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
2024-04-05 01:28:02 +02:00
|
|
|
afterBuild: rustup target add wasm32-wasip1-threads && turbo run build-native-wasi
|
feat(next-swc): support wasm32-* build target (#61586)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:
## For Contributors
### Improving Documentation
- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide
### Adding or Updating Examples
- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md
### Fixing a bug
- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md
### Adding a feature
- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md
## For Maintainers
- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change
### How?
Closes NEXT-
Fixes #
-->
### What?
This PR introduces a ground work to generate wasm bindings package from
our napi bindings. This doesn't actually replace anything yet, however
aim to establish our napi bindings package can be built against wasm32
target.
### Why?
We currently have two bindings package to generate native / wasm target
support, one for napi and one other for wasm. Recently napi-rs started
to support to generate bindings for the wasm directly - which means we
can get rid of the wasm-pack based bindings code entirely and maintain a
single bindings code only.
This'll makes our `next-swc` simpler as well, since the invocation to
the bindings now becomes identical we don't have to additional wasm
specific logics to invoke functions (i.e transform, transformsync..).
Also napi generates wasi-supported wasm bindings, provides few more
features to the current wasm bindings.
#### Good
- Async napi binding fn works transparently (`transform`, `minify`...)
- (Experimental) thread supports depends on node.js runtime
- Wasi support: i.e it can even read filesystem directly!
#### Things to consider
- node.js's wasi support is experimental yet
- napi-rs's wasm support is in beta yet, specifically `packaging`
generated wasm output.
Due to `things to consider` reasons, this PR does not replace existing
wasm target yet. We should be able to plan out things later.
**What happens to the turbopack api in napi bindings?**
Simply put, this **does not support turbopack in wasm**. Build works by
disabling turbopack (more notably, underlying dependency doesn't support
wasm) features. It is something to explore separately.
Closes PACK-2367
There is a branch at https://github.com/vercel/next.js/pull/61586 shows
quick demo for importing, running sync / async / read external files.
2024-02-06 19:15:13 +01:00
|
|
|
stepName: 'test-next-swc-napi-wasi'
|
|
|
|
secrets: inherit
|
|
|
|
|
2023-09-20 02:34:38 +02:00
|
|
|
test-unit:
|
|
|
|
name: test unit
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2023-09-20 02:34:38 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
2023-11-02 11:43:18 +01:00
|
|
|
matrix:
|
|
|
|
node: [18, 20] # TODO: use env var like [env.NODE_MAINTENANCE_VERSION, env.NODE_LTS_VERSION]
|
2023-09-20 02:34:38 +02:00
|
|
|
|
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
2023-11-02 11:43:18 +01:00
|
|
|
nodeVersion: ${{ matrix.node }}
|
2023-09-20 03:09:26 +02:00
|
|
|
afterBuild: node run-tests.js -c ${TEST_CONCURRENCY} --type unit
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-unit-${{ matrix.node }}'
|
2023-09-20 02:34:38 +02:00
|
|
|
|
|
|
|
secrets: inherit
|
|
|
|
|
2024-04-02 20:40:27 +02:00
|
|
|
test-new-tests-dev:
|
|
|
|
name: Test new tests for flakes (dev)
|
2024-04-01 22:15:43 +02:00
|
|
|
needs: ['changes', 'build-native', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2024-06-19 16:01:24 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
group: [1/4, 2/4, 3/4, 4/4]
|
|
|
|
|
2024-04-01 22:15:43 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
2024-06-19 16:01:24 +02:00
|
|
|
afterBuild: node scripts/test-new-tests.mjs --dev-mode --group ${{ matrix.group }}
|
|
|
|
stepName: 'test-new-tests-dev-${{matrix.group}}'
|
2024-04-02 20:40:27 +02:00
|
|
|
|
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
test-new-tests-start:
|
|
|
|
name: Test new tests for flakes (prod)
|
|
|
|
needs: ['changes', 'build-native', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2024-06-19 16:01:24 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
group: [1/4, 2/4, 3/4, 4/4]
|
|
|
|
|
2024-04-02 20:40:27 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
2024-06-19 16:01:24 +02:00
|
|
|
afterBuild: node scripts/test-new-tests.mjs --prod-mode --group ${{ matrix.group }}
|
|
|
|
stepName: 'test-new-tests-start-${{matrix.group}}'
|
2024-04-01 22:15:43 +02:00
|
|
|
|
|
|
|
secrets: inherit
|
|
|
|
|
2023-05-28 06:02:31 +02:00
|
|
|
test-dev:
|
|
|
|
name: test dev
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes', 'build-native', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2023-05-28 06:02:31 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-12-06 02:10:00 +01:00
|
|
|
group: [1/4, 2/4, 3/4, 4/4]
|
2023-06-06 18:57:09 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
2023-05-28 06:02:31 +02:00
|
|
|
with:
|
2023-12-06 02:10:00 +01:00
|
|
|
afterBuild: NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type development
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-dev-${{ matrix.group }}'
|
2023-05-28 06:02:31 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
test-prod:
|
|
|
|
name: test prod
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes', 'build-native', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2023-05-28 06:02:31 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-12-06 02:10:00 +01:00
|
|
|
group: [1/5, 2/5, 3/5, 4/5, 5/5]
|
2023-06-06 18:57:09 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
2023-05-28 06:02:31 +02:00
|
|
|
with:
|
2023-12-06 02:10:00 +01:00
|
|
|
afterBuild: NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-prod-${{ matrix.group }}'
|
2023-05-28 06:02:31 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
test-integration:
|
|
|
|
name: test integration
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes', 'build-native', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2023-05-28 06:02:31 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-12-06 02:10:00 +01:00
|
|
|
group:
|
|
|
|
- 1/12
|
|
|
|
- 2/12
|
|
|
|
- 3/12
|
|
|
|
- 4/12
|
|
|
|
- 5/12
|
|
|
|
- 6/12
|
|
|
|
- 7/12
|
|
|
|
- 8/12
|
|
|
|
- 9/12
|
|
|
|
- 10/12
|
|
|
|
- 11/12
|
|
|
|
- 12/12
|
2023-06-06 18:57:09 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
2023-05-28 06:02:31 +02:00
|
|
|
with:
|
2024-07-05 11:21:57 +02:00
|
|
|
nodeVersion: 18.18.2
|
2023-12-12 00:33:23 +01:00
|
|
|
afterBuild: node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type integration
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-integration-${{ matrix.group }}'
|
2023-05-28 06:02:31 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
test-firefox-safari:
|
|
|
|
name: test firefox and safari
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes', 'build-native', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
2023-05-28 06:02:31 +02:00
|
|
|
|
2023-06-06 18:57:09 +02:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
2023-05-28 06:02:31 +02:00
|
|
|
with:
|
2023-09-26 15:38:50 +02:00
|
|
|
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
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-firefox-safari'
|
2023-05-28 06:02:31 +02:00
|
|
|
secrets: inherit
|
|
|
|
|
2023-11-29 04:22:45 +01:00
|
|
|
# TODO: remove these jobs once PPR is the default
|
|
|
|
# Manifest generated via: https://gist.github.com/wyattjoh/2ceaebd82a5bcff4819600fd60126431
|
|
|
|
test-ppr-integration:
|
|
|
|
name: test ppr integration
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes', 'build-native', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2023-11-29 04:22:45 +01:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
2024-07-05 11:21:57 +02:00
|
|
|
nodeVersion: 18.18.2
|
2023-12-06 02:10:00 +01:00
|
|
|
afterBuild: __NEXT_EXPERIMENTAL_PPR=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" node run-tests.js --timings -c ${TEST_CONCURRENCY} --type integration
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-ppr-integration'
|
2023-11-29 04:22:45 +01:00
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
test-ppr-dev:
|
|
|
|
name: test ppr dev
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes', 'build-native', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2023-11-29 04:22:45 +01:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-12-06 02:10:00 +01:00
|
|
|
group: [1/4, 2/4, 3/4, 4/4]
|
2023-11-29 04:22:45 +01:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
2023-12-06 02:10:00 +01:00
|
|
|
afterBuild: __NEXT_EXPERIMENTAL_PPR=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type development
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-ppr-dev-${{ matrix.group }}'
|
2023-11-29 04:22:45 +01:00
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
test-ppr-prod:
|
|
|
|
name: test ppr prod
|
2023-11-29 19:25:01 +01:00
|
|
|
needs: ['changes', 'build-native', 'build-next']
|
|
|
|
if: ${{ needs.changes.outputs.docs-only == 'false' }}
|
|
|
|
|
2023-11-29 04:22:45 +01:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-12-06 02:10:00 +01:00
|
|
|
group: [1/4, 2/4, 3/4, 4/4]
|
2023-11-29 04:22:45 +01:00
|
|
|
uses: ./.github/workflows/build_reusable.yml
|
|
|
|
with:
|
2023-12-06 02:10:00 +01:00
|
|
|
afterBuild: __NEXT_EXPERIMENTAL_PPR=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
|
2024-01-25 09:39:40 +01:00
|
|
|
stepName: 'test-ppr-prod-${{ matrix.group }}'
|
2023-11-29 04:22:45 +01:00
|
|
|
secrets: inherit
|
|
|
|
|
2024-03-19 10:26:14 +01:00
|
|
|
report-test-results-to-datadog:
|
2023-09-21 08:14:29 +02:00
|
|
|
needs:
|
|
|
|
[
|
2023-11-29 19:25:01 +01:00
|
|
|
'changes',
|
2023-09-21 08:14:29 +02:00
|
|
|
'test-unit',
|
|
|
|
'test-dev',
|
|
|
|
'test-prod',
|
|
|
|
'test-integration',
|
2023-11-29 04:22:45 +01:00
|
|
|
'test-ppr-dev',
|
|
|
|
'test-ppr-prod',
|
|
|
|
'test-ppr-integration',
|
2023-09-21 08:14:29 +02:00
|
|
|
'test-turbopack-dev',
|
|
|
|
'test-turbopack-integration',
|
2024-03-19 10:26:14 +01:00
|
|
|
'test-turbopack-production',
|
|
|
|
'test-turbopack-production-integration',
|
2023-09-21 08:14:29 +02:00
|
|
|
]
|
2023-11-29 19:25:01 +01:00
|
|
|
if: ${{ always() && needs.changes.outputs.docs-only == 'false' && !github.event.pull_request.head.repo.fork }}
|
|
|
|
|
2023-11-23 15:18:03 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: report test results to datadog
|
|
|
|
steps:
|
|
|
|
- name: Download test report artifacts
|
|
|
|
id: download-test-reports
|
2024-01-25 09:39:40 +01:00
|
|
|
uses: actions/download-artifact@v4
|
2023-11-23 15:18:03 +01:00
|
|
|
with:
|
2024-01-25 09:39:40 +01:00
|
|
|
pattern: test-reports-*
|
2023-11-23 15:18:03 +01:00
|
|
|
path: test
|
2024-01-25 09:39:40 +01:00
|
|
|
merge-multiple: true
|
2023-11-23 15:18:03 +01:00
|
|
|
|
|
|
|
- name: Upload test report to datadog
|
|
|
|
run: |
|
|
|
|
if [ -d ./test/test-junit-report ]; then
|
|
|
|
# Add a `test.type` tag to distinguish between turbopack and next.js runs
|
|
|
|
DD_ENV=ci npx @datadog/datadog-ci@2.23.1 junit upload --tags test.type:nextjs --service nextjs ./test/test-junit-report
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d ./test/turbopack-test-junit-report ]; then
|
|
|
|
# Add a `test.type` tag to distinguish between turbopack and next.js runs
|
|
|
|
DD_ENV=ci npx @datadog/datadog-ci@2.23.1 junit upload --tags test.type:turbopack --service nextjs ./test/turbopack-test-junit-report
|
|
|
|
fi
|
2023-06-12 19:14:13 +02:00
|
|
|
|
2023-05-28 06:02:31 +02:00
|
|
|
tests-pass:
|
|
|
|
needs:
|
|
|
|
[
|
2023-06-12 16:47:43 +02:00
|
|
|
'build-native',
|
|
|
|
'build-next',
|
2023-05-28 06:02:31 +02:00
|
|
|
'lint',
|
2023-07-24 21:35:21 +02:00
|
|
|
'validate-docs-links',
|
2023-05-28 06:02:31 +02:00
|
|
|
'check-types-precompiled',
|
2023-09-20 02:34:38 +02:00
|
|
|
'test-unit',
|
2023-05-28 06:02:31 +02:00
|
|
|
'test-dev',
|
|
|
|
'test-prod',
|
|
|
|
'test-integration',
|
2024-03-26 20:44:31 +01:00
|
|
|
'test-firefox-safari',
|
2023-11-29 04:22:45 +01:00
|
|
|
'test-ppr-dev',
|
|
|
|
'test-ppr-prod',
|
|
|
|
'test-ppr-integration',
|
2023-05-28 06:02:31 +02:00
|
|
|
'test-cargo-unit',
|
|
|
|
'rust-check',
|
2023-11-02 22:00:54 +01:00
|
|
|
'test-next-swc-wasm',
|
2023-05-28 06:02:31 +02:00
|
|
|
'test-turbopack-dev',
|
2023-07-04 15:01:33 +02:00
|
|
|
'test-turbopack-integration',
|
2024-04-03 19:21:08 +02:00
|
|
|
'test-new-tests-dev',
|
|
|
|
'test-new-tests-start',
|
2024-04-15 23:53:23 +02:00
|
|
|
'test-turbopack-production',
|
|
|
|
'test-turbopack-production-integration',
|
2023-05-28 06:02:31 +02:00
|
|
|
]
|
2023-05-31 15:51:13 +02:00
|
|
|
|
|
|
|
if: always()
|
2023-07-04 01:07:28 +02:00
|
|
|
runs-on: ubuntu-latest
|
2023-05-28 06:02:31 +02:00
|
|
|
name: thank you, next
|
|
|
|
steps:
|
2023-05-31 15:51:13 +02:00
|
|
|
- run: exit 1
|
2023-11-29 19:25:01 +01:00
|
|
|
if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
|