Skip to content

Commit

Permalink
Merge branch 'canary' into update-react
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoff authored Jun 6, 2023
2 parents 83f4ccd + 65e996b commit 2787e24
Show file tree
Hide file tree
Showing 49 changed files with 537 additions and 2,162 deletions.
6 changes: 2 additions & 4 deletions .github/actions/next-stats-action/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {

// clone PR/newer repository/ref first to get settings
if (!actionInfo.skipClone) {
await cloneRepo(actionInfo.prRepo, diffRepoDir)
await checkoutRef(actionInfo.prRef, diffRepoDir)
await cloneRepo(actionInfo.prRepo, diffRepoDir, actionInfo.prRef)
}

if (actionInfo.isRelease) {
Expand All @@ -67,8 +66,7 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {

// clone main repository/ref
if (!actionInfo.skipClone) {
await cloneRepo(statsConfig.mainRepo, mainRepoDir)
await checkoutRef(statsConfig.mainBranch, mainRepoDir)
await cloneRepo(statsConfig.mainRepo, mainRepoDir, statsConfig.mainBranch)
}
/* eslint-disable-next-line */
actionInfo.commitId = await getCommitId(diffRepoDir)
Expand Down
13 changes: 8 additions & 5 deletions .github/actions/next-stats-action/src/prepare/repo-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ const execa = require('execa')

module.exports = (actionInfo) => {
return {
async cloneRepo(repoPath = '', dest = '') {
async cloneRepo(repoPath = '', dest = '', branch = '', depth = '20') {
await remove(dest)
await exec(`git clone ${actionInfo.gitRoot}${repoPath} ${dest}`)
},
async checkoutRef(ref = '', repoDir = '') {
await exec(`cd ${repoDir} && git fetch && git checkout ${ref}`)
await exec(
`git clone ${actionInfo.gitRoot}${repoPath} --single-branch --branch ${branch} --depth=${depth} ${dest}`
)
},
async getLastStable(repoDir = '', ref) {
const { stdout } = await exec(`cd ${repoDir} && git tag -l`)
Expand Down Expand Up @@ -112,6 +111,10 @@ module.exports = (actionInfo) => {
}

if (pkg === 'next') {
console.log('using swc dep', {
nextSwcVersion,
nextSwcPkg: pkgDatas.get('@next/swc'),
})
if (nextSwcVersion) {
Object.assign(pkgData.dependencies, {
'@next/swc-linux-x64-gnu': nextSwcVersion,
Expand Down
3 changes: 3 additions & 0 deletions .github/labeler.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
{ "type": "user", "pattern": "huozhi" },
{ "type": "user", "pattern": "ijjk" },
{ "type": "user", "pattern": "JanKaifer" },
{ "type": "user", "pattern": "javivelasco" },
{ "type": "user", "pattern": "kikobeats" },
{ "type": "user", "pattern": "leerob" },
{ "type": "user", "pattern": "schniz" },
{ "type": "user", "pattern": "sebmarkbage" },
{ "type": "user", "pattern": "shuding" },
{ "type": "user", "pattern": "styfle" },
Expand Down
35 changes: 32 additions & 3 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,36 @@ jobs:
if: ${{ !matrix.settings.docker }}
shell: bash

- name: Upload artifact
# Trying to upload metrics for the Turbopack to datadog's CI pipeline execution
- name: 'Upload turbopack build metrics'
shell: bash
if: ${{ needs.build.outputs.isRelease == 'true' }}
continue-on-error: true
run: |
npm install -g @datadog/datadog-ci
for filename in packages/next-swc/native/next-swc.*.node; do
# Strip out filename to extract target triple
export FILENAME=$(basename ${filename})
export FILENAME=${FILENAME#*.}
export FILENAME=${FILENAME%.node}
export BYTESIZE=$(wc -c < $filename | xargs)
echo "Reporting $FILENAME:$BYTESIZE for Turbopack bytesize"
datadog-ci metric --no-fail --level pipeline --metrics "turbopack.bytesize.$FILENAME:$BYTESIZE"
done
- name: Upload swc artifact
if: ${{ needs.build.outputs.isRelease == 'true' }}
uses: actions/upload-artifact@v3
with:
name: next-swc-binaries
path: packages/next-swc/native/next-swc.*.node

- name: Upload turbo summary artifact
uses: actions/upload-artifact@v3
with:
name: turbo run summary
path: .turbo/runs

build-wasm:
needs: build
strategy:
Expand Down Expand Up @@ -285,12 +308,18 @@ jobs:
run: node scripts/normalize-version-bump.js

- name: Build
run: turbo run build-wasm -- --target ${{ matrix.target }} --features tracing/release_max_level_info
run: turbo run build-wasm --summarize -- --target ${{ matrix.target }} --features tracing/release_max_level_info

- 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'

- name: Upload artifact
- name: Upload turbo summary artifact
uses: actions/upload-artifact@v3
with:
name: turbo run summary
path: .turbo/runs

- name: Upload swc artifact
uses: actions/upload-artifact@v3
with:
name: wasm-binaries
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ env:
NODE_MAINTENANCE_VERSION: 16
NODE_LTS_VERSION: 18
TEST_CONCURRENCY: 6
# TODO: remove after testing
# NEXT_TEST_CONTINUE_ON_ERROR: 'true'

TURBO_TEAM: 'vercel'
TURBO_REMOTE_ONLY: 'true'
Expand All @@ -29,14 +27,14 @@ env:
jobs:
build:
name: build
uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
secrets: inherit

lint:
name: lint
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: pnpm lint-no-typescript && pnpm check-examples
secrets: inherit
Expand All @@ -45,7 +43,7 @@ jobs:
name: types and precompiled
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: pnpm types-and-precompiled
skipForDocsOnly: 'yes'
Expand All @@ -55,7 +53,7 @@ jobs:
name: test cargo unit
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
skipInstallBuild: 'yes'
Expand All @@ -66,7 +64,7 @@ jobs:
name: rust check
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
skipInstallBuild: 'yes'
Expand All @@ -76,7 +74,7 @@ jobs:
test-turbopack-dev:
name: test turbopack dev
needs: ['build']
uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/packages/next-swc/crates/next-dev-tests/tests-manifest.js" __INTERNAL_NEXT_DEV_TEST_TURBO_DEV=TRUE __INTERNAL_CUSTOM_TURBOPACK_BINDINGS="$(pwd)/packages/next-swc/native/next-swc.linux-x64-gnu.node" __INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH="*" NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=dev node run-tests.js --type development --timings -c ${TEST_CONCURRENCY}
Expand All @@ -86,7 +84,7 @@ jobs:
name: test next-swc wasm
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
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/integration/production/test/index.test.js test/e2e/streaming-ssr/index.test.ts
Expand All @@ -100,7 +98,7 @@ jobs:
matrix:
group: [1, 2, 3]

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
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} --test-pattern '^(development|e2e|unit)/.*\.test\.(js|jsx|ts|tsx)$'
Expand All @@ -114,7 +112,7 @@ jobs:
matrix:
group: [1, 2, 3]

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --test-pattern '^(production|e2e)/.*\.test\.(js|jsx|ts|tsx)$'
Expand All @@ -128,7 +126,7 @@ jobs:
matrix:
group: [1, 2, 3, 4, 5, 6]

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 16
skipForDocsOnly: 'yes'
Expand All @@ -139,7 +137,7 @@ jobs:
name: test firefox and safari
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: pnpm playwright install && BROWSER_NAME=firefox node run-tests.js test/integration/production/test/index.test.js && BROWSER_NAME=safari NEXT_TEST_MODE=start node run-tests.js -c 1 test/integration/production/test/index.test.js 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
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/build_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ on:
required: false
description: 'if nextest rust dep is needed'
type: string
uploadSwcArtifact:
required: false
description: 'if swc artifact needs uploading'
type: string

env:
NAPI_CLI_VERSION: 2.14.7
Expand All @@ -32,8 +36,6 @@ env:
NODE_MAINTENANCE_VERSION: 16
NODE_LTS_VERSION: 18
TEST_CONCURRENCY: 6
# TODO: remove after testing
# NEXT_TEST_CONTINUE_ON_ERROR: 'true'

TURBO_TEAM: 'vercel'
TURBO_REMOTE_ONLY: 'true'
Expand Down Expand Up @@ -86,6 +88,13 @@ jobs:

- run: turbo run build-native-release --summarize -- --target x86_64-unknown-linux-gnu

- name: Upload next-swc artifact
if: ${{ inputs.uploadSwcArtifact == 'yes' }}
uses: actions/upload-artifact@v3
with:
name: next-swc-binary
path: packages/next-swc/native/next-swc.linux-x64-gnu.node

# undo normalize version changes for install/build
- run: git checkout .
if: ${{ inputs.skipInstallBuild != 'yes' }}
Expand Down
96 changes: 19 additions & 77 deletions .github/workflows/pull_request_stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,87 +9,29 @@ env:
TURBO_VERSION: 1.9.6
RUST_TOOLCHAIN: nightly-2023-03-09
PNPM_VERSION: 7.24.3
NODE_MAINTENANCE_VERSION: 16
NODE_LTS_VERSION: 18
TEST_CONCURRENCY: 6

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
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
NEXT_TEST_JOB: 1

jobs:
build-native-dev:
name: Build dev binary for tests
runs-on: ubuntu-latest
steps:
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off

- uses: actions/checkout@v3
with:
fetch-depth: 25

- name: Check non-docs only change
run: echo "DOCS_CHANGE<<EOF" >> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')" >> $GITHUB_OUTPUT; echo 'EOF' >> $GITHUB_OUTPUT
id: docs-change

- name: Cache cargo registry
uses: actions/cache@v3
timeout-minutes: 5
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
path: ~/.cargo/registry
key: stable-ubuntu-latest-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v3
timeout-minutes: 5
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
path: ~/.cargo/git
key: stable-ubuntu-latest-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

# We use week in the turbo cache key to keep the cache from infinitely growing
- id: get-week
run: echo "WEEK=$(date +%U)" >> $GITHUB_OUTPUT

- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
timeout-minutes: 5
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-
turbo-${{ github.job }}-canary-${{ steps.get-week.outputs.WEEK }}-
- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2022-10-24-x64
options: -e RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} -e NAPI_CLI_VERSION=${{ env.NAPI_CLI_VERSION }} -e TURBO_VERSION=${{ env.TURBO_VERSION }} -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build
run: |
set -e &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
unset CC_x86_64_unknown_linux_gnu && unset CC &&
turbo run build-native --cache-dir=".turbo" -- --target x86_64-unknown-linux-gnu &&
strip packages/next-swc/native/next-swc.*.node
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: next-swc-dev-binary
path: packages/next-swc/native/next-swc.linux-x64-gnu.node

- name: Clear the cargo caches
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache
build:
uses: ./.github/workflows/build_reusable.yml
secrets: inherit
with:
uploadSwcArtifact: 'yes'

stats:
name: PR Stats
needs: build-native-dev
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -103,7 +45,7 @@ jobs:
- uses: actions/download-artifact@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
name: next-swc-dev-binary
name: next-swc-binary
path: packages/next-swc/native

- run: cp -r packages/next-swc/native .github/actions/next-stats-action/native
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trigger_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
node-version: 18
check-latest: true

- run: git clone https://ijjk:${{ secrets.START_RELEASE_TOKEN }}@github.com/vercel/next.js.git --depth=25 .
- run: git clone https://github.com/vercel/next.js.git --depth=25 .

- run: git describe || 'echo failed to get tag'

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@babel/plugin-proposal-object-rest-spread": "7.14.7",
"@babel/preset-flow": "7.14.5",
"@babel/preset-react": "7.14.5",
"@edge-runtime/jest-environment": "2.2.0",
"@edge-runtime/jest-environment": "2.2.1",
"@fullhuman/postcss-purgecss": "1.3.0",
"@mdx-js/loader": "2.2.1",
"@mdx-js/react": "2.2.1",
Expand Down
Loading

0 comments on commit 2787e24

Please sign in to comment.