Skip to content

Commit

Permalink
Merge branch 'canary' into patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegLustenko authored Jul 25, 2024
2 parents 47dc737 + d4eb89d commit bbb019a
Show file tree
Hide file tree
Showing 1,673 changed files with 36,639 additions and 20,885 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test/production/emit-decorator-metadata/**/*.js
!test/**/*.test.*
test/e2e/app-dir/rsc-errors/app/swc/use-client/page.js
test-timings.json
packages/next-swc/crates/**
crates/**
bench/nested-deps/**
bench/nested-deps-app-router/**
bench/heavy-npm-deps/**
Expand Down
20 changes: 20 additions & 0 deletions .eslintrc.cli.json
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"
}
}
]
}
5 changes: 5 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
// This is the default eslint config that is used by IDEs. It does not use
// computation-heavy type-checked rules to ensure maximum responsiveness while
// writing code. In addition, there is .eslintrc.cli.json that does use
// type-checked rules, and it is used when running `pnpm lint-eslint`.
"$schema": "https://json.schemastore.org/eslintrc",
"root": true,
"parser": "@babel/eslint-parser",
"plugins": ["react", "react-hooks", "jest", "import", "jsdoc"],
Expand Down
1 change: 1 addition & 0 deletions .github/.react-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
19.0.0-rc-6230622a1a-20240610
4 changes: 2 additions & 2 deletions .github/actions/next-integration-stat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"strip-ansi": "^7.0.1"
},
"engines": {
"node": ">=18.17.0"
"node": ">=18.18.0"
},
"packageManager": "pnpm@8.15.7"
"packageManager": "pnpm@9.5.0"
}
2 changes: 1 addition & 1 deletion .github/actions/next-stats-action/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN apt install unzip wget curl nano htop screen build-essential pkg-config libs

RUN ln $(which python3) /usr/bin/python

RUN curl -sfLS https://install-node.vercel.app/v18.17.0 | bash -s -- -f
RUN curl -sfLS https://install-node.vercel.app/v18.18.2 | bash -s -- -f
RUN corepack enable

WORKDIR /next-stats
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/next-stats-action/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"typescript": "5.1.6"
},
"engines": {
"node": ">=18.17.0"
"node": ">=18.18.0"
},
"packageManager": "pnpm@8.15.7"
"packageManager": "pnpm@9.5.0"
}
4 changes: 2 additions & 2 deletions .github/actions/upload-turboyet-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@vercel/ncc": "^0.36.0"
},
"engines": {
"node": ">=18.17.0"
"node": ">=18.18.0"
},
"packageManager": "pnpm@8.15.7"
"packageManager": "pnpm@9.5.0"
}
11 changes: 6 additions & 5 deletions .github/labeler.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"examples": ["examples/**"],
"Font (next/font)": ["**/*font*"],
"tests": ["test/**", "bench/**"],
"Turbopack": ["packages/next-swc/crates/next-*/**"],
"Turbopack": ["crates/next-*/**"],
"created-by: Chrome Aurora": [
{ "type": "user", "pattern": "atcastle" },
{ "type": "user", "pattern": "devknoll" },
Expand All @@ -17,15 +17,13 @@
],
"CI approved": [
{ "type": "user", "pattern": "SukkaW" },
{ "type": "user", "pattern": "unstubbable" },
{ "type": "user", "pattern": "vercel-release-bot" }
],
"created-by: Next.js team": [
{ "type": "user", "pattern": "acdlite" },
{ "type": "user", "pattern": "balazsorban44" },
{ "type": "user", "pattern": "devjiwonchoi" },
{ "type": "user", "pattern": "eps1lon" },
{ "type": "user", "pattern": "Ethan-Arrowood" },
{ "type": "user", "pattern": "feedthejim" },
{ "type": "user", "pattern": "gnoff" },
{ "type": "user", "pattern": "huozhi" },
Expand All @@ -39,6 +37,7 @@
{ "type": "user", "pattern": "shuding" },
{ "type": "user", "pattern": "styfle" },
{ "type": "user", "pattern": "timneutkens" },
{ "type": "user", "pattern": "unstubbable" },
{ "type": "user", "pattern": "wyattjoh" },
{ "type": "user", "pattern": "ztanner" }
],
Expand All @@ -55,7 +54,8 @@
{ "type": "user", "pattern": "bgw" },
{ "type": "user", "pattern": "ForsakenHarmony" },
{ "type": "user", "pattern": "kdy1" },
{ "type": "user", "pattern": "kwonoj" },
{ "type": "user", "pattern": "LichuAcu" },
{ "type": "user", "pattern": "mischnic" },
{ "type": "user", "pattern": "padmaia" },
{ "type": "user", "pattern": "sokra" },
{ "type": "user", "pattern": "wbinnssmith" }
Expand All @@ -71,6 +71,7 @@
"packages/next-swc/**",
"packages/next/**",
"packages/react-refresh-utils/**"
]
],
"type: react-sync": [".github/.react-version"]
}
}
123 changes: 90 additions & 33 deletions .github/workflows/build_and_deploy.yml
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
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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 }}
Expand Down Expand Up @@ -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:
Expand Down
Loading

0 comments on commit bbb019a

Please sign in to comment.