forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
201 lines (177 loc) · 6.53 KB
/
turbopack-nextjs-build-integration-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# 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 production integration tests
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
inputs:
# Allow to specify Next.js version to run integration test against.
# If not specified, will use latest release version including canary.
version:
description: Next.js version, sha, branch to test
type: string
default: 'canary'
# 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: 'none'
# Workflow-common env variables
env:
# Enabling backtrace will makes snapshot tests fail
RUST_BACKTRACE: 0
NEXT_TELEMETRY_DISABLED: 1
TEST_CONCURRENCY: 6
NEXT_JUNIT_TEST_REPORT: 'true'
__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.js to execute across tests.
setup_nextjs:
name: Setup Next.js build
uses: ./.github/workflows/setup-nextjs-build.yml
with:
version: ${{ inputs.version || 'canary' }}
# 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-production:
# 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 (Production)
# 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:
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 || 'canary' }}-${{ 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 [email protected]
- name: Setup playwright
run: |
pnpm playwright install
- name: Run test/production
run: |
NEXT_TEST_MODE=start TURBOPACK=1 TURBOPACK_BUILD=1 node run-tests.js -g ${{ matrix.group }}/12 -c ${TEST_CONCURRENCY} --type production
# It is currently expected to fail some of next.js integration test, do not fail CI check.
continue-on-error: true
- name: Upload test report artifacts
uses: actions/upload-artifact@v4
with:
name: test-reports-start-${{ matrix.group }}
if-no-files-found: 'error'
path: |
test/turbopack-test-junit-report
test-integration-production:
name: Next.js integration test (Integration)
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: ./*
key: ${{ inputs.version || 'canary' }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Enable corepack and install yarn
run: |
corepack enable
corepack prepare --activate [email protected]
- 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
# Collect integration test results from execute_tests,
# Store it as github artifact for next step to consume.
collect_nextjs_production_integration_stat:
needs: [test-production, test-integration-production]
name: Next.js integration test production status report
runs-on:
- 'self-hosted'
- 'linux'
- 'x64'
- 'metal'
if: always()
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Collect integration test stat
uses: ./.github/actions/next-integration-stat
with:
diff_base: ${{ inputs.diff_base || 'none' }}
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: test-results-turbopack-production
path: |
nextjs-test-results.json
failed-test-path-list.json
passed-test-path-list.json
upload_test_report:
needs: [test-production, test-integration-production]
name: Upload test report to datadog
runs-on:
- 'self-hosted'
- 'linux'
- 'x64'
- 'metal'
if: ${{ !cancelled() }}
steps:
- name: Download test report artifacts
id: download-test-reports
uses: actions/download-artifact@v4
with:
pattern: test-reports-*
path: test/reports
merge-multiple: true
- name: Upload to datadog
env:
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
DD_ENV: 'ci'
run: |
# We'll tag this to the "Turbopack" datadog service, not "nextjs"
npx @datadog/[email protected] junit upload --tags test.type:turbopack-build.daily --service Turbopack-build ./test/reports