-
Notifications
You must be signed in to change notification settings - Fork 1.7k
264 lines (243 loc) · 12 KB
/
nextjs-integration-test.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# 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
# Path to the next-dev binary located in **docker container** image.
# To use this, set __INTERNAL_CUSTOM_TURBOPACK_BINARY to the path. Not being used currently.
NEXT_DEV_BIN: /work/next-dev
# Path to the custom next-swc bindings located in **docker container** image.
NEXT_BINDINGS_BIN: /work/packages/next-swc/native/next-swc.linux-x64-gnu.node
FAILED_TEST_LIST_PATH: /work/integration-test-data/test-results/main/failed-test-path-list.json
# Glob pattern to run specific tests with --turbo.
NEXT_DEV_TEST_GLOB: "*"
# pnpm version should match to what upstream next.js uses
PNPM_VERSION: 7.24.3
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_test_deploy.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)
runs-on: ubuntu-latest-8-core-oss
needs: [setup_nextjs]
strategy:
matrix:
node: [16, 18]
group: [1, 2, 3, 4, 5]
steps:
- uses: actions/cache/restore@v3
id: restore-build
with:
path: ./*
key: ${{ inputs.version }}-${{ github.sha }}
fail-on-cache-miss: true
# This step is quite same as upstream next.js integration execution, but with some differences:
# Sets `__INTERNAL_CUSTOM_TURBOPACK_BINARY`, `__INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH` to setup custom turbopack.
# Sets `NEXT_TEST_SKIP_RETRY_MANIFEST`, `NEXT_TEST_CONTINUE_ON_ERROR` to continue on error but do not retry on the known failed tests.
# Do not set --timings flag
- run: |
docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && ls && curl https://install-node.vercel.app/v${{ matrix.node }} | FORCE=1 bash && node -v && npm i -g pnpm@${PNPM_VERSION} && __INTERNAL_NEXT_DEV_TEST_TURBO_DEV=TRUE __INTERNAL_CUSTOM_TURBOPACK_BINDINGS=${NEXT_BINDINGS_BIN} __INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH=${NEXT_DEV_TEST_GLOB} NEXT_TEST_SKIP_RETRY_MANIFEST=${FAILED_TEST_LIST_PATH} NEXT_TEST_CONTINUE_ON_ERROR=TRUE NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_JOB=1 NEXT_TEST_MODE=dev xvfb-run node run-tests.js --type development -g ${{ matrix.group }}/5 -c 1 >> /proc/1/fd/1"
name: Run test/development
# It is currently expected to fail some of next.js integration test, do not fail CI check.
continue-on-error: true
env:
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDev / Group ${{ matrix.group }}
# marker to parse log output, do not delete / change.
NEXT_INTEGRATION_TEST: true
test_dev_e2e:
# 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 (e2e/Development)
runs-on: ubuntu-latest-8-core-oss
needs: [setup_nextjs]
strategy:
matrix:
node: [16, 18]
group: [1, 2, 3, 4, 5, 6, 7]
steps:
- uses: actions/cache/restore@v3
id: restore-build
with:
path: ./*
key: ${{ inputs.version }}-${{ github.sha }}
fail-on-cache-miss: true
- run: |
docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && ls && curl https://install-node.vercel.app/v${{ matrix.node }} | FORCE=1 bash && node -v && npm i -g pnpm@${PNPM_VERSION} && __INTERNAL_NEXT_DEV_TEST_TURBO_DEV=TRUE __INTERNAL_CUSTOM_TURBOPACK_BINDINGS=${NEXT_BINDINGS_BIN} __INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH=${NEXT_DEV_TEST_GLOB} NEXT_TEST_SKIP_RETRY_MANIFEST=${FAILED_TEST_LIST_PATH} NEXT_TEST_CONTINUE_ON_ERROR=TRUE NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_JOB=1 NEXT_TEST_MODE=dev xvfb-run node run-tests.js --type e2e -g ${{ matrix.group }}/7 -c 1 >> /proc/1/fd/1"
name: Run test/e2e (dev)
continue-on-error: true
env:
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDevE2E / Group ${{ matrix.group }} / Node ${{ matrix.node }}
NEXT_TEST_MODE: dev
RECORD_REPLAY_TEST_METRICS: 1
NEXT_INTEGRATION_TEST: true
test_cna:
# 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 (Create Next App) (No group)
runs-on: ubuntu-latest-8-core-oss
needs: [setup_nextjs]
steps:
- uses: actions/cache/restore@v3
id: restore-build
with:
path: ./*
key: ${{ inputs.version }}-${{ github.sha }}
fail-on-cache-miss: true
# TODO: This test currently seems to load wasm/swc and does not load the next-dev binary.
# Temporary disabled until figure out details.
#- run: |
# docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v16 | FORCE=1 bash && npm i -g pnpm@${PNPM_VERSION} > /dev/null && __INTERNAL_NEXT_DEV_TEST_TURBO_DEV=TRUE __INTERNAL_CUSTOM_TURBOPACK_BINDINGS=${NEXT_BINDINGS_BIN} __INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH=${NEXT_DEV_TEST_GLOB} NEXT_TEST_SKIP_RETRY_MANIFEST=${FAILED_TEST_LIST_PATH} NEXT_TEST_CONTINUE_ON_ERROR=TRUE NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_JOB=1 NEXT_TEST_CNA=1 xvfb-run node run-tests.js test/integration/create-next-app/index.test.ts test/integration/create-next-app/templates.test.ts -c 1 >> /proc/1/fd/1"
# name: Run test/e2e (create-next-app)
# continue-on-error: true
# env:
# RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDevE2E / Group ${{ matrix.group }} / Node ${{ matrix.node }}
# NEXT_TEST_MODE: dev
# RECORD_REPLAY_TEST_METRICS: 1
# NEXT_INTEGRATION_TEST: true
test_integration:
# 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 (integration)
runs-on: ubuntu-latest-8-core-oss
needs: [setup_nextjs]
strategy:
fail-fast: false
matrix:
group:
[
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,
]
steps:
- uses: actions/cache/restore@v3
id: restore-build
with:
path: |
./*
key: ${{ inputs.version }}-${{ github.sha }}
fail-on-cache-miss: true
- run: |
docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && ls && curl https://install-node.vercel.app/v16 | FORCE=1 bash && node -v && npm i -g pnpm@${PNPM_VERSION} && __INTERNAL_NEXT_DEV_TEST_TURBO_DEV=TRUE __INTERNAL_CUSTOM_TURBOPACK_BINDINGS=${NEXT_BINDINGS_BIN} __INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH=${NEXT_DEV_TEST_GLOB} NEXT_TEST_SKIP_RETRY_MANIFEST=${FAILED_TEST_LIST_PATH} NEXT_TEST_CONTINUE_ON_ERROR=TRUE NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_JOB=1 xvfb-run node run-tests.js -g ${{ matrix.group }}/28 -c 1 >> /proc/1/fd/1"
name: Test Integration
continue-on-error: true
env:
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testIntegration / Group ${{ matrix.group }}
NEXT_INTEGRATION_TEST: true
test_flaky_subset:
# 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 (FLAKY_SUBSET)
runs-on: ubuntu-latest
needs: [setup_nextjs]
env:
# List of test files to run that expected to pass always. Whole test suite should pass.
TEST_FILES_LIST: |
test/development/acceptance-app/dynamic-error.test.ts \
test/development/acceptance-app/unsupported-app-features.test.ts \
test/development/acceptance-app/ReactRefresh.test.ts \
test/development/basic/legacy-decorators.test.ts \
test/integration/plugin-mdx-rs/test/index.test.js \
test/e2e/app-dir/underscore-ignore-app-paths/underscore-ignore-app-paths.test.ts
strategy:
matrix:
node: [16]
steps:
- uses: actions/cache/restore@v3
id: restore-build
with:
path: ./*
key: ${{ inputs.version }}-${{ github.sha }}
fail-on-cache-miss: true
- run: |
docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && ls packages/next-swc/native && curl https://install-node.vercel.app/v${{ matrix.node }} | FORCE=1 bash && node -v && npm i -g pnpm@${PNPM_VERSION} && node scripts/install-native.mjs && __INTERNAL_NEXT_DEV_TEST_TURBO_DEV=TRUE __INTERNAL_CUSTOM_TURBOPACK_BINDINGS=${NEXT_BINDINGS_BIN} __INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH=${NEXT_DEV_TEST_GLOB} NEXT_TEST_CONTINUE_ON_ERROR=TRUE NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_JOB=1 NEXT_TEST_MODE=dev xvfb-run node run-tests.js --type development -c 1 $TEST_FILES_LIST >> /proc/1/fd/1"
name: Run test/flaky_subset
# This should not fail, but if fails collect result to update dashboard.
continue-on-error: true
env:
# marker to parse log output, do not delete / change.
NEXT_INTEGRATION_TEST: true
# 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_dev_e2e, test_cna, test_integration, test_flaky_subset]
name: Next.js integration test status report
runs-on: ubuntu-latest-8-core-oss
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
slack-payload.json