-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,673 changed files
with
36,639 additions
and
20,885 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/eslintrc", | ||
"extends": [".eslintrc.json"], | ||
"overrides": [ | ||
{ | ||
// This override adds type-checked rules. | ||
"files": ["**/*.ts", "**/*.tsx"], | ||
// Linting with type-checked rules is very slow and needs a lot of memory, | ||
// so we exclude non-essential files. | ||
"excludedFiles": ["examples/**/*", "test/**/*", "**/*.d.ts"], | ||
"parserOptions": { | ||
"project": true | ||
}, | ||
"rules": { | ||
// TODO: enable in follow-up PR | ||
"@typescript-eslint/no-floating-promises": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
19.0.0-rc-6230622a1a-20240610 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,63 @@ | ||
# Update all mentions of this name in vercel-packages when changing. | ||
name: build-and-deploy | ||
|
||
on: | ||
push: | ||
branches: ['canary'] | ||
# TODO: Run only on canary pushes but PR syncs. | ||
# Requires checking if CI is approved | ||
workflow_dispatch: | ||
|
||
env: | ||
NAPI_CLI_VERSION: 2.16.2 | ||
TURBO_VERSION: 2.0.3 | ||
TURBO_VERSION: 2.0.7 | ||
NODE_LTS_VERSION: 20 | ||
CARGO_PROFILE_RELEASE_LTO: 'true' | ||
TURBO_TEAM: 'vercel' | ||
TURBO_REMOTE_ONLY: 'true' | ||
|
||
jobs: | ||
deploy-target: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
value: ${{ steps.deploy-target.outputs.value }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_LTS_VERSION }} | ||
check-latest: true | ||
- run: corepack enable | ||
- name: Determine deploy target | ||
# 'force-preview' performs a full preview build but only if acknowledged i.e. workflow_dispatch | ||
# 'automated-preview' for pushes on branches other than 'canary' for integration testing. | ||
# 'staging' for canary branch since that will eventually be published i.e. become the production build. | ||
id: deploy-target | ||
run: | | ||
if [[ $(node ./scripts/check-is-release.js 2> /dev/null || :) = v* ]]; | ||
then | ||
echo "value=production" >> $GITHUB_OUTPUT | ||
elif [ '${{ github.ref }}' == 'refs/heads/canary' ] | ||
then | ||
echo "value=staging" >> $GITHUB_OUTPUT | ||
elif [ '${{ github.event_name }}' == 'workflow_dispatch' ] | ||
then | ||
echo "value=force-preview" >> $GITHUB_OUTPUT | ||
else | ||
echo "value=automated-preview" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Print deploy target | ||
run: echo "Deploy target is '${{ steps.deploy-target.outputs.value }}'" | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
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 | ||
outputs: | ||
isRelease: ${{ steps.check-release.outputs.IS_RELEASE }} | ||
steps: | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
|
@@ -52,31 +87,35 @@ jobs: | |
|
||
- run: pnpm run build | ||
|
||
- id: check-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 | ||
- uses: actions/cache@v4 | ||
timeout-minutes: 5 | ||
id: cache-build | ||
with: | ||
path: ./* | ||
key: ${{ github.sha }}-${{ github.run_number }} | ||
key: ${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt}} | ||
|
||
# Build binaries for publishing | ||
build-native: | ||
needs: | ||
- deploy-target | ||
defaults: | ||
run: | ||
shell: bash -leo pipefail {0} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
exclude: | ||
# Exclude slow builds for automated previews | ||
# These are rarely needed for the standard preview usage (e.g. Front sync) | ||
- settings: | ||
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'i686-pc-windows-msvc' }} | ||
- settings: | ||
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'aarch64-pc-windows-msvc' }} | ||
- settings: | ||
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'aarch64-unknown-linux-musl' }} | ||
- settings: | ||
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'x86_64-unknown-linux-musl' }} | ||
settings: | ||
- host: | ||
- 'self-hosted' | ||
|
@@ -390,7 +429,7 @@ jobs: | |
run: turbo run build-wasm -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target ${{ matrix.target }} | ||
|
||
- name: Add target to folder name | ||
run: '[[ -d "packages/next-swc/crates/wasm/pkg" ]] && mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-${{ matrix.target }} || ls packages/next-swc/crates/wasm' | ||
run: '[[ -d "crates/wasm/pkg" ]] && mv crates/wasm/pkg crates/wasm/pkg-${{ matrix.target }} || ls crates/wasm' | ||
|
||
- name: Upload turbo summary artifact | ||
uses: actions/upload-artifact@v4 | ||
|
@@ -402,19 +441,17 @@ jobs: | |
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wasm-binaries-${{matrix.target}} | ||
path: packages/next-swc/crates/wasm/pkg-* | ||
path: crates/wasm/pkg-* | ||
|
||
deployTarball: | ||
if: ${{ needs.build.outputs.isRelease != 'true' }} | ||
name: Deploy tarball | ||
deploy-tarball: | ||
if: ${{ needs.deploy-target.outputs.value != 'production' }} | ||
name: Deploy preview tarball | ||
runs-on: ubuntu-latest | ||
needs: | ||
- deploy-target | ||
- build | ||
- build-wasm | ||
- build-native | ||
env: | ||
VERCEL_TEST_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }} | ||
VERCEL_TEST_TEAM: vtest314-next-e2e-tests | ||
steps: | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
|
@@ -432,7 +469,12 @@ jobs: | |
id: restore-build | ||
with: | ||
path: ./* | ||
key: ${{ github.sha }}-${{ github.run_number }} | ||
# Cache includes repo checkout which is required for later scripts | ||
fail-on-cache-miss: true | ||
key: ${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }} | ||
restore-keys: | | ||
${{ github.sha }}-${{ github.run_number }} | ||
${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt}} | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
|
@@ -444,17 +486,24 @@ jobs: | |
with: | ||
pattern: wasm-binaries-* | ||
merge-multiple: true | ||
path: packages/next-swc/crates/wasm | ||
path: crates/wasm | ||
|
||
- run: npm i -g vercel@latest | ||
- name: Create tarballs | ||
run: node scripts/create-preview-tarballs.js "${{ github.sha }}" "${{ runner.temp }}/preview-tarballs" | ||
|
||
- run: node ./scripts/deploy-tarball.js | ||
- name: Upload tarballs | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
# Update all mentions of this name in vercel-packages when changing. | ||
name: preview-tarballs | ||
path: ${{ runner.temp }}/preview-tarballs/* | ||
|
||
publishRelease: | ||
if: ${{ needs.build.outputs.isRelease == 'true' }} | ||
if: ${{ needs.deploy-target.outputs.value == 'production' }} | ||
name: Potentially publish release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- deploy-target | ||
- build | ||
- build-wasm | ||
- build-native | ||
|
@@ -480,7 +529,12 @@ jobs: | |
id: restore-build | ||
with: | ||
path: ./* | ||
key: ${{ github.sha }}-${{ github.run_number }} | ||
# Cache includes repo checkout which is required for later scripts | ||
fail-on-cache-miss: true | ||
key: ${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }} | ||
restore-keys: | | ||
${{ github.sha }}-${{ github.run_number }} | ||
${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt}} | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
|
@@ -492,7 +546,7 @@ jobs: | |
with: | ||
pattern: wasm-binaries-* | ||
merge-multiple: true | ||
path: packages/next-swc/crates/wasm | ||
path: crates/wasm | ||
|
||
- run: npm i -g [email protected] # need latest version for provenance (pinning to avoid bugs) | ||
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | ||
|
@@ -509,23 +563,25 @@ jobs: | |
path: /home/runner/.npm/_logs/* | ||
|
||
deployExamples: | ||
if: ${{ needs.deploy-target.outputs.value != 'automated-preview' }} | ||
name: Deploy examples | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
needs: [build, deploy-target] | ||
steps: | ||
- run: echo '${{ needs.deploy-target.outputs.value }}' | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 25 | ||
- name: Install Vercel CLI | ||
run: npm i -g vercel@latest | ||
- name: Deploy preview examples | ||
if: ${{ needs.build.outputs.isRelease != 'true' }} | ||
if: ${{ needs.deploy-target.outputs.value != 'production' }} | ||
run: ./scripts/deploy-examples.sh | ||
env: | ||
VERCEL_API_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} | ||
DEPLOY_ENVIRONMENT: preview | ||
- name: Deploy production examples | ||
if: ${{ needs.build.outputs.isRelease == 'true' }} | ||
if: ${{ needs.deploy-target.outputs.value == 'production' }} | ||
run: ./scripts/deploy-examples.sh | ||
env: | ||
VERCEL_API_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} | ||
|
@@ -560,9 +616,10 @@ jobs: | |
NEXT_SKIP_NATIVE_POSTINSTALL: 1 | ||
|
||
upload_turbopack_bytesize: | ||
if: ${{ needs.deploy-target.outputs.value != 'automated-preview'}} | ||
name: Upload Turbopack Bytesize metrics to Datadog | ||
runs-on: ubuntu-latest | ||
needs: [build-native] | ||
needs: [build-native, deploy-target] | ||
env: | ||
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }} | ||
steps: | ||
|
Oops, something went wrong.