2023-10-23 20:48:38 +02:00
|
|
|
# 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.
|
2024-03-19 13:00:33 +01:00
|
|
|
name: Turbopack Next.js production integration tests
|
2023-10-23 20:48:38 +02:00
|
|
|
|
2024-03-18 23:25:09 +01:00
|
|
|
on:
|
2024-03-20 10:05:16 +01:00
|
|
|
schedule:
|
|
|
|
- cron: '0 6 * * *'
|
|
|
|
workflow_dispatch:
|
2024-03-18 23:25:09 +01:00
|
|
|
inputs:
|
|
|
|
# Allow to specify Next.js version to run integration test against.
|
|
|
|
# If not specified, will use latest release version including canary.
|
|
|
|
version:
|
2024-03-20 10:05:16 +01:00
|
|
|
description: Next.js version, sha, branch to test
|
2024-03-18 23:25:09 +01:00
|
|
|
type: string
|
2024-03-20 10:05:16 +01:00
|
|
|
default: 'canary'
|
2024-03-18 23:25:09 +01:00
|
|
|
# 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
|
2024-03-20 10:05:16 +01:00
|
|
|
default: 'none'
|
2024-03-18 23:25:09 +01:00
|
|
|
|
2023-10-23 20:48:38 +02:00
|
|
|
# Workflow-common env variables
|
|
|
|
env:
|
|
|
|
# Enabling backtrace will makes snapshot tests fail
|
|
|
|
RUST_BACKTRACE: 0
|
|
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
|
|
TEST_CONCURRENCY: 6
|
2023-11-23 15:18:03 +01:00
|
|
|
NEXT_JUNIT_TEST_REPORT: 'true'
|
2023-10-23 20:48:38 +02:00
|
|
|
__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:
|
2024-03-19 13:00:33 +01:00
|
|
|
# First, build Next.js to execute across tests.
|
2023-10-23 20:48:38 +02:00
|
|
|
setup_nextjs:
|
|
|
|
name: Setup Next.js build
|
|
|
|
uses: ./.github/workflows/setup-nextjs-build.yml
|
|
|
|
with:
|
2024-03-25 22:36:49 +01:00
|
|
|
version: ${{ inputs.version || 'canary' }}
|
2023-10-23 20:48:38 +02:00
|
|
|
|
|
|
|
# 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.
|
2024-03-19 14:19:49 +01:00
|
|
|
test-production:
|
2023-10-23 20:48:38 +02:00
|
|
|
# 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.
|
2024-03-19 13:00:33 +01:00
|
|
|
name: Next.js integration test (Production)
|
2023-10-23 20:48:38 +02:00
|
|
|
# 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:
|
|
|
|
- 'self-hosted'
|
|
|
|
- 'linux'
|
|
|
|
- 'x64'
|
|
|
|
- 'metal'
|
|
|
|
|
|
|
|
needs: [setup_nextjs]
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2024-04-03 13:38:40 +02:00
|
|
|
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
|
2023-10-23 20:48:38 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/cache/restore@v3
|
|
|
|
id: restore-build
|
|
|
|
with:
|
|
|
|
path: ./*
|
2024-03-25 22:36:49 +01:00
|
|
|
key: ${{ inputs.version || 'canary' }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt}}-${{ github.run_number }}
|
2023-10-23 20:48:38 +02:00
|
|
|
fail-on-cache-miss: true
|
|
|
|
|
|
|
|
- name: Enable corepack and install yarn
|
|
|
|
run: |
|
|
|
|
corepack enable
|
|
|
|
corepack prepare --activate yarn@1.22.19
|
|
|
|
|
2023-12-05 15:41:49 +01:00
|
|
|
- name: Setup playwright
|
|
|
|
run: |
|
|
|
|
pnpm playwright install
|
|
|
|
|
2024-03-19 13:00:33 +01:00
|
|
|
- name: Run test/production
|
2023-10-23 20:48:38 +02:00
|
|
|
run: |
|
2024-04-03 13:38:40 +02:00
|
|
|
NEXT_TEST_MODE=start TURBOPACK=1 TURBOPACK_BUILD=1 node run-tests.js -g ${{ matrix.group }}/12 -c ${TEST_CONCURRENCY} --type production
|
2023-10-23 20:48:38 +02:00
|
|
|
# It is currently expected to fail some of next.js integration test, do not fail CI check.
|
|
|
|
continue-on-error: true
|
|
|
|
|
2023-11-23 15:18:03 +01:00
|
|
|
- name: Upload test report artifacts
|
2024-01-25 09:39:40 +01:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-10-23 20:48:38 +02:00
|
|
|
with:
|
2024-03-19 13:00:33 +01:00
|
|
|
name: test-reports-start-${{ matrix.group }}
|
2024-01-26 11:52:42 +01:00
|
|
|
if-no-files-found: 'error'
|
2023-10-23 20:48:38 +02:00
|
|
|
path: |
|
|
|
|
test/turbopack-test-junit-report
|
|
|
|
|
2024-03-25 21:19:18 +01:00
|
|
|
test-integration-production:
|
2024-03-26 13:45:24 +01:00
|
|
|
name: Next.js integration test (Integration)
|
2024-03-25 21:19:18 +01:00
|
|
|
needs: [setup_nextjs]
|
|
|
|
runs-on:
|
|
|
|
- 'self-hosted'
|
|
|
|
- 'linux'
|
|
|
|
- 'x64'
|
|
|
|
- 'metal'
|
|
|
|
|
|
|
|
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: ./*
|
2024-03-25 22:36:49 +01:00
|
|
|
key: ${{ inputs.version || 'canary' }}-${{ github.sha }}
|
2024-03-25 21:19:18 +01:00
|
|
|
fail-on-cache-miss: true
|
|
|
|
|
|
|
|
- name: Enable corepack and install yarn
|
|
|
|
run: |
|
|
|
|
corepack enable
|
|
|
|
corepack prepare --activate yarn@1.22.19
|
|
|
|
|
|
|
|
- name: Setup playwright
|
|
|
|
run: |
|
|
|
|
pnpm playwright install
|
|
|
|
|
|
|
|
- name: Run test/integration
|
|
|
|
run: |
|
|
|
|
TURBOPACK=1 TURBOPACK_BUILD=1 node run-tests.js -g ${{ matrix.group }}/12 -c ${TEST_CONCURRENCY} --type integration
|
|
|
|
continue-on-error: true
|
|
|
|
|
|
|
|
- name: Upload test report artifacts
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: test-reports-build-integration-${{ matrix.group }}
|
|
|
|
if-no-files-found: 'error'
|
|
|
|
path: |
|
|
|
|
test/turbopack-test-junit-report
|
2023-10-23 20:48:38 +02:00
|
|
|
|
|
|
|
# Collect integration test results from execute_tests,
|
|
|
|
# Store it as github artifact for next step to consume.
|
2024-03-19 14:19:49 +01:00
|
|
|
collect_nextjs_production_integration_stat:
|
2024-03-26 10:41:16 +01:00
|
|
|
needs: [test-production, test-integration-production]
|
2024-03-19 14:19:49 +01:00
|
|
|
name: Next.js integration test production status report
|
2023-10-23 20:48:38 +02:00
|
|
|
runs-on:
|
|
|
|
- 'self-hosted'
|
|
|
|
- 'linux'
|
|
|
|
- 'x64'
|
|
|
|
- 'metal'
|
|
|
|
|
|
|
|
if: always()
|
|
|
|
permissions:
|
|
|
|
pull-requests: write
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-02-01 22:13:29 +01:00
|
|
|
uses: actions/checkout@v4
|
2023-10-23 20:48:38 +02:00
|
|
|
|
|
|
|
- name: Collect integration test stat
|
|
|
|
uses: ./.github/actions/next-integration-stat
|
|
|
|
with:
|
2024-03-25 22:36:49 +01:00
|
|
|
diff_base: ${{ inputs.diff_base || 'none' }}
|
2023-10-23 20:48:38 +02:00
|
|
|
|
|
|
|
- name: Store artifacts
|
2024-01-25 09:39:40 +01:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-10-23 20:48:38 +02:00
|
|
|
with:
|
2024-03-19 17:02:02 +01:00
|
|
|
name: test-results-turbopack-production
|
2023-10-23 20:48:38 +02:00
|
|
|
path: |
|
|
|
|
nextjs-test-results.json
|
|
|
|
failed-test-path-list.json
|
|
|
|
passed-test-path-list.json
|
|
|
|
|
2023-11-23 15:18:03 +01:00
|
|
|
upload_test_report:
|
2024-03-26 10:41:16 +01:00
|
|
|
needs: [test-production, test-integration-production]
|
2023-11-23 15:18:03 +01:00
|
|
|
name: Upload test report to datadog
|
2023-10-23 20:48:38 +02:00
|
|
|
runs-on:
|
|
|
|
- 'self-hosted'
|
|
|
|
- 'linux'
|
|
|
|
- 'x64'
|
|
|
|
- 'metal'
|
|
|
|
|
2024-03-18 17:34:19 +01:00
|
|
|
if: ${{ !cancelled() }}
|
2023-10-23 20:48:38 +02:00
|
|
|
steps:
|
2023-11-23 15:18:03 +01:00
|
|
|
- name: Download test report artifacts
|
2023-10-23 20:48:38 +02:00
|
|
|
id: download-test-reports
|
2024-01-25 09:39:40 +01:00
|
|
|
uses: actions/download-artifact@v4
|
2023-10-23 20:48:38 +02:00
|
|
|
with:
|
2024-01-25 09:39:40 +01:00
|
|
|
pattern: test-reports-*
|
2023-11-23 15:18:03 +01:00
|
|
|
path: test/reports
|
2024-01-25 09:39:40 +01:00
|
|
|
merge-multiple: true
|
2023-11-23 15:18:03 +01:00
|
|
|
|
|
|
|
- name: Upload to datadog
|
2023-12-05 15:41:49 +01:00
|
|
|
env:
|
|
|
|
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
|
|
|
|
DD_ENV: 'ci'
|
2023-10-23 20:48:38 +02:00
|
|
|
run: |
|
2023-11-23 15:18:03 +01:00
|
|
|
# We'll tag this to the "Turbopack" datadog service, not "nextjs"
|
2024-03-20 14:58:01 +01:00
|
|
|
npx @datadog/datadog-ci@2.23.1 junit upload --tags test.type:turbopack-build.daily --service Turbopack-build ./test/reports
|