diff --git a/.github/workflows/daily-nextjs-integration-test.yml b/.github/workflows/daily-nextjs-integration-test.yml deleted file mode 100644 index a93283746a2df..0000000000000 --- a/.github/workflows/daily-nextjs-integration-test.yml +++ /dev/null @@ -1,67 +0,0 @@ -# A workflow to run next.js integration test with turbopack for each day. -# This runs against main branch with latest Next.js release. -name: Daily Next.js integration test with turbopack - -on: - schedule: - - cron: "0 8 * * *" - workflow_dispatch: - inputs: - version: - description: Next.js version, sha, branch to test - type: string - default: "canary" - - post_to_slack: - description: Post test results to Slack - type: boolean - default: false - -jobs: - # Trigger actual next.js integration tests. - next_js_integration: - name: Execute Next.js integration workflow - permissions: - pull-requests: write - uses: ./.github/workflows/nextjs-integration-test.yml - secrets: inherit - with: - diff_base: "none" - version: ${{ inputs.version || 'canary' }} - skip_post_to_slack: ${{ github.event_name != 'schedule' && inputs.post_to_slack != true }} - - # Upload test results to branch. - upload_test_results: - name: Upload test results - needs: [next_js_integration] - if: always() - uses: ./.github/workflows/upload-nextjs-integration-test-results.yml - secrets: inherit - with: - is_main_branch: true - - post_to_slack: - needs: [next_js_integration] - name: Post results to Slack - runs-on: ubuntu-latest - if: always() - steps: - - name: Download summary.md artifact - uses: actions/download-artifact@v3 - with: - name: test-results - - name: Check if summary file was generated - id: summary_check - run: | - if stat slack-payload.json; then - echo "should_continue=true" >> $GITHUB_OUTPUT - else - echo "should_continue=false" >> $GITHUB_OUTPUT - fi - - name: Send test data to Slack workflow - if: steps.summary_check.outputs.should_continue == 'true' - uses: slackapi/slack-github-action@v1.23.0 - with: - payload-file-path: "./slack-payload.json" - env: - SLACK_WEBHOOK_URL: ${{ secrets.NEXT_TURBO_INTEGRATION_SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/nextjs-integration-test.yml b/.github/workflows/nextjs-integration-test.yml deleted file mode 100644 index 37bdaa07b8063..0000000000000 --- a/.github/workflows/nextjs-integration-test.yml +++ /dev/null @@ -1,200 +0,0 @@ -# Reusable workflow to execute certain version of Next.js integration tests -# with turbopack. -# -# Refer test.yml for how this workflow is being initialized -# - Workflow can specify `inputs.version` to specify which version of next.js to use, otherwise will use latest release version. -name: Turbopack Next.js integration test - -on: - workflow_call: - inputs: - # Allow to specify Next.js version to run integration test against. - # If not specified, will use latest release version including canary. - version: - type: string - # The base of the test results to compare against. If not specified, will try to compare with latest main branch's test results. - diff_base: - type: string - default: "main" - force_post_to_slack: - type: boolean - # Skip posting to slack regardless of the conditions. - skip_post_to_slack: - type: boolean - default: false - -# Workflow-common env variables -env: - # Enabling backtrace will makes snapshot tests fail - RUST_BACKTRACE: 0 - NEXT_TELEMETRY_DISABLED: 1 - TEST_CONCURRENCY: 6 - DATADOG_API_KEY: ${{ secrets.DD_KEY_TURBOPACK }} - DATADOG_TRACE_NEXTJS_TEST: "true" - DD_ENV: "ci" - # Turbopack specific customization for the test runner - TURBOPACK: 1 - __INTERNAL_CUSTOM_TURBOPACK_BINDINGS: ${{ github.workspace }}/packages/next-swc/native/next-swc.linux-x64-gnu.node - NEXT_TEST_SKIP_RETRY_MANIFEST: ${{ github.workspace }}/integration-test-data/test-results/main/failed-test-path-list.json - NEXT_TEST_CONTINUE_ON_ERROR: TRUE - NEXT_E2E_TEST_TIMEOUT: 240000 - NEXT_TEST_JOB: 1 - -jobs: - # First, build next-dev and Next.js both to execute across tests. - setup_nextjs: - name: Setup Next.js build - uses: ./.github/workflows/setup-nextjs-build.yml - with: - version: ${{ inputs.version }} - - # Actual test scheduling. These jobs mimic the same jobs in Next.js repo, - # which we do allow some of duplications to make it easier to update if upstream changes. - # Refer build_and_test.yml in the Next.js repo for more details. - test-dev: - # This job name is being used in github action to collect test results. Do not change it, or should update - # ./.github/actions/next-integration-stat to match the new name. - name: Next.js integration test (Development) - # Currently it is possible test grouping puts large number of failing tests suites in a single group, - # which ends up job timeouts. Temporarily relieve the timeout until we make progresses on the failing suites. - # ref: https://github.com/vercel/turbo/pull/5668 - # timeout-minutes: 180 - runs-on: ubuntu-latest-16-core-oss - needs: [setup_nextjs] - strategy: - fail-fast: false - matrix: - group: [1, 2, 3, 4, 5, 6, 7, 8, 9] - - steps: - - uses: actions/cache/restore@v3 - id: restore-build - with: - path: ./* - key: ${{ inputs.version }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt}}-${{ github.run_number }} - fail-on-cache-miss: true - - - name: Enable corepack and install yarn - run: | - corepack enable - corepack prepare --activate yarn@1.22.19 - - - name: Run test/development - run: | - ls $NEXT_TEST_SKIP_RETRY_MANIFEST - sudo npx playwright install-deps && pnpm playwright install - NEXT_TEST_MODE=dev TURBOPACK=1 node run-tests.js -g ${{ matrix.group }}/9 -c ${TEST_CONCURRENCY} --type development - ls test/turbopack-test-junit-report - # It is currently expected to fail some of next.js integration test, do not fail CI check. - continue-on-error: true - env: - # marker to parse log output, do not delete / change. - NEXT_INTEGRATION_TEST: true - - - name: Upload test reports artifact - uses: actions/upload-artifact@v3 - with: - name: Test trace reports - path: | - test/turbopack-test-junit-report - - test-integration: - name: Next.js integration test (Integration) - needs: [setup_nextjs] - runs-on: ubuntu-latest-16-core-oss - timeout-minutes: 180 - strategy: - fail-fast: false - matrix: - group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] - - steps: - - uses: actions/cache/restore@v3 - id: restore-build - with: - path: ./* - key: ${{ inputs.version }}-${{ github.sha }} - fail-on-cache-miss: true - - - name: Enable corepack and install yarn - run: | - corepack enable - corepack prepare --activate yarn@1.22.19 - - - name: Run test/integration - run: | - sudo npx playwright install-deps && pnpm playwright install - TURBOPACK=1 node run-tests.js -g ${{ matrix.group }}/12 -c ${TEST_CONCURRENCY} --type integration - ls test/turbopack-test-junit-report - continue-on-error: true - env: - NEXT_INTEGRATION_TEST: true - - - name: Upload test reports artifact - uses: actions/upload-artifact@v3 - with: - name: Test trace reports - path: | - test/turbopack-test-junit-report - - # Collect integration test results from execute_tests, - # Store it as github artifact for next step to consume. - collect_nextjs_integration_stat: - needs: [test-dev, test-integration] - name: Next.js integration test status report - runs-on: ubuntu-latest-8-core-oss - if: always() - permissions: - pull-requests: write - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Collect integration test stat - uses: ./.github/actions/next-integration-stat - with: - diff_base: ${{ inputs.diff_base }} - env: - NEXT_TURBO_FORCE_SLACK_UPDATE: "${{ inputs.force_post_to_slack }}" - NEXT_TURBO_FORCE_SKIP_SLACK_UPDATE: "${{ inputs.skip_post_to_slack }}" - - - name: Store artifacts - uses: actions/upload-artifact@v3 - with: - name: test-results - path: | - nextjs-test-results.json - failed-test-path-list.json - passed-test-path-list.json - slack-payload.json - - upload_test_trace: - needs: [test-dev, test-integration] - name: Upload test trace to datadog - runs-on: ubuntu-latest-8-core-oss - if: always() - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Download test reports artifact - id: download-test-reports - uses: actions/download-artifact@v3 - with: - name: Test trace reports - path: test - - name: Upload test trace to datadog - run: | - npm install -g @datadog/datadog-ci@2.18.1 - ls -al ./test/*.xml - # We'll tag this to the Turbopack service, not the next.js - DD_ENV=ci datadog-ci junit upload --tags test.type:turbopack.daily --service Turbopack test - - # For the debugging purpose, upload the test trace to github artifact. - # So we can manually analyze test reports. - - name: Upload test reports artifact - uses: actions/upload-artifact@v3 - with: - name: Merged test trace reports - path: | - nextjs-test-result-junit.xml - ./**/*.xml diff --git a/.github/workflows/on-nextjs-release.yml b/.github/workflows/on-nextjs-release.yml deleted file mode 100644 index 05fbb34629f6f..0000000000000 --- a/.github/workflows/on-nextjs-release.yml +++ /dev/null @@ -1,71 +0,0 @@ -# A workflow supposed to run when there is a new release of Next.js. -# This relies on next.js upstream's `repository_dispatch` workflow. -name: Next.js Release - -on: - repository_dispatch: - # This is the event type defined by next.js upstream's `repository_dispatch` workflow dispatches. - types: [nextjs-release-published] - workflow_dispatch: - inputs: - version: - description: Next.js version - type: string - force_post_to_slack: - description: Post test results to Slack - type: boolean - -jobs: - # Debug purpose, write down release version. - check-release-tag: - name: Check latest release - runs-on: ubuntu-latest - steps: - - name: Print release tag - run: echo "Found a new release via ${{ github.event_name }} -- ${{ inputs.version || github.event.client_payload.version }}" - - # Trigger actual next.js integration tests. - next_js_integration: - name: Execute Next.js integration workflow - permissions: - pull-requests: write - uses: ./.github/workflows/nextjs-integration-test.yml - with: - force_post_to_slack: ${{ inputs.force_post_to_slack || false }} - version: ${{ inputs.version || github.event.client_payload.version }} - diff_base: "release" - - # Upload test results to branch. - upload_test_results: - name: Upload test results - # Don't upload results when this workflow is run manually via workflow_dispatch - if: ${{ github.event_name != 'workflow_dispatch' }} - needs: [next_js_integration] - uses: ./.github/workflows/upload-nextjs-integration-test-results.yml - with: - is_main_branch: false - - post_to_slack: - needs: [next_js_integration] - name: Post results to Slack - runs-on: ubuntu-latest - steps: - - name: Download summary.md artifact - uses: actions/download-artifact@v3 - with: - name: test-results - - name: Check if summary file was generated - id: summary_check - run: | - if stat slack-payload.json; then - echo "should_continue=true" >> $GITHUB_OUTPUT - else - echo "should_continue=false" >> $GITHUB_OUTPUT - fi - - name: Send test data to Slack workflow - if: steps.summary_check.outputs.should_continue == 'true' - uses: slackapi/slack-github-action@v1.23.0 - with: - payload-file-path: "./slack-payload.json" - env: - SLACK_WEBHOOK_URL: ${{ secrets.NEXT_TURBO_INTEGRATION_SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/setup-nextjs-build.yml b/.github/workflows/setup-nextjs-build.yml deleted file mode 100644 index 73b8d9fa22c34..0000000000000 --- a/.github/workflows/setup-nextjs-build.yml +++ /dev/null @@ -1,135 +0,0 @@ -# Reusable workflow to setup next.js integration test environment. -name: Setup Next.js - -on: - workflow_call: - inputs: - # Allow to specify Next.js version to run integration test against. - # If not specified, will use latest release version including canary. - version: - type: string - -jobs: - build_nextjs: - name: Build Next.js for the turbopack integration test - runs-on: ubuntu-latest-16-core-oss - outputs: - output1: ${{ steps.build-next-swc-turbopack-patch.outputs.success }} - steps: - - name: Get number of CPU cores - uses: SimenB/github-actions-cpu-cores@v1 - id: cpu-cores - - - name: "Setup Rust toolchain" - uses: dtolnay/rust-toolchain@stable - - - name: Display runner information - run: echo runner cpu count ${{ steps.cpu-cores.outputs.count }} - - - name: Find Next.js latest release version - env: - GH_TOKEN: ${{ github.token }} - run: | - # Grab the latest release version from next.js repo, including prelease. `/releases/latest` will only return latest stable release. - echo NEXJS_LATEST_VERSION=$(gh release --repo vercel/next.js --limit 1 list | sed -n 1p | awk '{print $1}') >> $GITHUB_ENV - - - name: Set Next.js release version - run: | - echo "NEXTJS_VERSION=${{ inputs.version != '' && inputs.version || env.NEXJS_LATEST_VERSION }}" >> $GITHUB_ENV - - - name: Print Next.js release version to checkout - run: echo "Checking out Next.js ${{ env.NEXTJS_VERSION }}" - - # https://github.com/actions/virtual-environments/issues/1187 - - name: tune linux network - run: sudo ethtool -K eth0 tx off rx off - - - name: Checkout Next.js - uses: actions/checkout@v3 - with: - repository: vercel/next.js - ref: ${{ env.NEXTJS_VERSION }} - - - name: Checkout failed test lists - uses: actions/checkout@v3 - with: - repository: vercel/turbo - ref: nextjs-integration-test-data - path: integration-test-data - - - name: Download binary - uses: actions/download-artifact@v3 - with: - path: artifacts - - - uses: actions/cache/restore@v3 - id: restore-build - with: - path: | - ./* - key: ${{ inputs.version }}-${{ github.sha }} - - - name: Install dependencies - run: | - wget https://github.com/sharkdp/hyperfine/releases/download/v1.16.1/hyperfine_1.16.1_amd64.deb - sudo dpkg -i hyperfine_1.16.1_amd64.deb - corepack enable - pnpm install --loglevel error - - - name: Build next-swc with latest turbopack - id: build-next-swc-turbopack-patch - continue-on-error: true - run: | - export TURBOPACK_REMOTE="https://github.com/vercel/turbo" - # Apply patches to the cargo to the latest turbopack's sha. - # Basic recipe to apply patch to cargo via cli looks like this: - # cargo check --config 'patch."https://github.com/vercel/turbo".$PKG_NAME.git="https://github.com/vercel/turbo.git?rev=$SHA"' - # Careful to preserve quote to allow dot expression can access git url based property key. - export BINDING=$(printf 'patch.\\"%s\\".%s.git=\\"%s?rev=%s\\"' "$TURBOPACK_REMOTE" "turbopack-binding" "$TURBOPACK_REMOTE" "$GITHUB_SHA") - export TASKS=$(printf 'patch.\\"%s\\".%s.git=\\"%s?rev=%s\\"' "$TURBOPACK_REMOTE" "turbo-tasks" "$TURBOPACK_REMOTE" "$GITHUB_SHA") - export TASKS_FS=$(printf 'patch.\\"%s\\".%s.git=\\"%s?rev=%s\\"' "$TURBOPACK_REMOTE" "turbo-tasks-fs" "$TURBOPACK_REMOTE" "$GITHUB_SHA") - - echo "Trying to build next-swc with turbopack $GITHUB_SHA" - hyperfine --min-runs 1 --show-output 'pnpm run --filter=@next/swc build-native --features plugin,rustls-tls --release --cargo-flags="--config $BINDING --config $TASKS --config $TASKS_FS"' - echo "built=pass" >> $GITHUB_OUTPUT - echo "Successfully built next-swc with turbopack $GITHUB_SHA" - - - name: Build next-swc - if: steps.build-next-swc-turbopack-patch.outputs.built != 'pass' - run: | - echo "Looks like we could not apply latest turbopack to next-swc. Trying to build next-swc with published turbopack. This might happen when there is a breaking changes in turbopack, and next.js is not yet updated." - hyperfine --min-runs 1 --show-output 'pnpm run --filter=@next/swc build-native --features plugin,rustls-tls --release' - echo "Successfully built next-swc with published turbopack" - - - name: Build next.js - run: | - pnpm run build - strip packages/next-swc/native/next-swc.*.node - ls -al packages/next-swc/native - # Reduce the size of the cache bit - cd packages/next-swc && cargo clean && cd ../../ - echo NEXT_SWC_FILESIZE: $(stat -c %s packages/next-swc/native/next-swc.linux-x64-gnu.node) - node -e "console.log('Host', require('os').arch(), require('os').platform())" - - # If input version is published release, detect version by running next.js build. - - name: Detects Next.js build version - run: | - # This is being used in github action to collect test results. Do not change it, or should update ./.github/actions/next-integration-test to match. - docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c 'curl https://install-node.vercel.app/v16 | FORCE=1 bash && cd /work && echo RUNNING NEXTJS VERSION: $(packages/next/dist/bin/next --version) && ls -al packages/next-swc/native && node -e "console.log(\"Container\", require(\"os\").arch(), require(\"os\").platform())"' - - - name: Temporary test skip - run: | - rm -rf test/integration/jsconfig-paths/test/index.test.js - - # Once build completes, creates a cache of the build output - # so subsequent job to actually execute tests can reuse it. - # Note that we do not use upload / download artifacts for this - - # it is too heavyweight for the purpose since we do not need to persist - # the cache across multiple runs. - - name: Store next.js build cache with next-swc - uses: actions/cache/save@v3 - id: cache-build - with: - path: | - ./* - key: ${{ inputs.version }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt}}-${{ github.run_number }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fc1701166aa6c..9c783e8f85151 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,9 +56,6 @@ jobs: PATTERNS: | .github/actions/** .github/workflows/test.yml - .github/workflows/setup-nextjs-build.yml - .github/workflows/nextjs-integration-test-results.yml - .github/workflows/upload-nextjs-integration-test-results.yml - name: Root cargo related changes id: cargo diff --git a/.github/workflows/upload-nextjs-integration-test-results.yml b/.github/workflows/upload-nextjs-integration-test-results.yml deleted file mode 100644 index 40e8bb69c6dc1..0000000000000 --- a/.github/workflows/upload-nextjs-integration-test-results.yml +++ /dev/null @@ -1,71 +0,0 @@ -# Reusable workflow to upload next.js integration test result to specific branch `nextjs-integration-test-data` -# This workflow assumes `next-integration-test` workflow has been executed and test results are stored in `test-results/main` directory. -name: Update next.js integration test results - -on: - workflow_call: - inputs: - # Boolean flag to indicate if this workflow is triggered by default branch update. - # If this flag is set to true, then the workflow will upload test results to subpath `/main`. - # Otherwise, the workflow will upload test results to subpath `/${nextjs-version}`. - is_main_branch: - required: true - type: boolean - workflow_dispatch: - -jobs: - upload_test_results: - name: Upload test results - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: nextjs-integration-test-data - - - name: Git pull - run: | - git pull --depth=1 --no-tags origin nextjs-integration-test-data - - # First, grab test results into `test-results/main` directory from artifact stored by `next-integration-test`. - - name: Grab test results - uses: actions/download-artifact@v3 - with: - name: test-results - path: test-results/main - - # Read next.js version from test results, set necessary environment variables. - - name: Print test results - run: | - rm -rf ./test-results/main/slack-payload.json - ls -al ./test-results/main - echo "Print failed test path list:" - cat ./test-results/main/failed-test-path-list.json - echo "Print passed test path list:" - cat ./test-results/main/passed-test-path-list.json - echo "NEXTJS_VERSION=$(cat ./test-results/main/nextjs-test-results.json | jq .nextjsVersion | tr -d '"' | cut -d ' ' -f2)" >> $GITHUB_ENV - echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - echo "RESULT_SUBPATH=$(if ${{ inputs.is_main_branch }}; then echo 'main'; else echo ${{ env.NEXTJS_VERSION }}; fi)" >> $GITHUB_ENV - - # Copy test results to `${date}-${nextjs-version}-${sha-short}.json`. - # If workflow is not coming from main branch update, then we need to move test results to subpath `/${nextjs-version}`. - - name: Congifure subpath - run: | - echo "Configured test result subpath for ${{ env.RESULT_SUBPATH }} / ${{ env.NEXTJS_VERSION }} / ${{ env.SHA_SHORT }}" - mkdir -p test-results/${{ env.RESULT_SUBPATH }} - cp -v test-results/main/nextjs-test-results.json test-results/${{ env.RESULT_SUBPATH }}/$(date '+%Y%m%d%H%M')-${{ env.NEXTJS_VERSION }}-${{ env.SHA_SHORT }}.json - mv -fvn test-results/main/failed-test-path-list.json test-results/${{ env.RESULT_SUBPATH }}/failed-test-path-list.json - ls -al ./test-results - ls -al ./test-results/${{ env.RESULT_SUBPATH }} - - - name: Push data to branch - uses: stefanzweifel/git-auto-commit-action@v4 - with: - file_pattern: test-results/** - commit_message: "test(integration): Integration test results for ${{ env.NEXTJS_VERSION }} (${{ env.SHA_SHORT }})" - - - name: "Upload Are We Turbo Yet data" - env: - TURBOYET_KV_REST_API_URL: ${{ secrets.TURBOYET_KV_REST_API_URL }} - TURBOYET_KV_REST_API_TOKEN: ${{ secrets.TURBOYET_KV_REST_API_TOKEN }} - uses: ./.github/actions/upload-turboyet-data