Skip to content

Commit b0649f6

Browse files
authored
ci(workflow): upload daily next.js test trace (#5254)
### Description WEB-1194. This PR revises daily test workflow, and upload traces to datadog. It skips one test affected by #5294, once resolved will be reenabled. Signed-off-by: OJ Kwon <[email protected]>
1 parent 6d572e9 commit b0649f6

File tree

3 files changed

+100
-145
lines changed

3 files changed

+100
-145
lines changed

.github/workflows/daily-nextjs-integration-test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
permissions:
2525
pull-requests: write
2626
uses: ./.github/workflows/nextjs-integration-test.yml
27+
secrets: inherit
2728
with:
2829
diff_base: "none"
2930
version: ${{ inputs.version || 'canary' }}

.github/workflows/nextjs-integration-test.yml

+94-144
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,19 @@ env:
2828
# Enabling backtrace will makes snapshot tests fail
2929
RUST_BACKTRACE: 0
3030
NEXT_TELEMETRY_DISABLED: 1
31-
# Path to the next-dev binary located in **docker container** image.
32-
# To use this, set __INTERNAL_CUSTOM_TURBOPACK_BINARY to the path. Not being used currently.
33-
NEXT_DEV_BIN: /work/next-dev
34-
# Path to the custom next-swc bindings located in **docker container** image.
35-
NEXT_BINDINGS_BIN: /work/packages/next-swc/native/next-swc.linux-x64-gnu.node
36-
FAILED_TEST_LIST_PATH: /work/integration-test-data/test-results/main/failed-test-path-list.json
37-
# Glob pattern to run specific tests with --turbo.
38-
NEXT_DEV_TEST_GLOB: "*"
31+
TEST_CONCURRENCY: 6
3932
# pnpm version should match to what upstream next.js uses
4033
PNPM_VERSION: 7.24.3
34+
DATADOG_API_KEY: ${{ secrets.DD_KEY_TURBOPACK }}
35+
DATADOG_TRACE_NEXTJS_TEST: 'true'
36+
DD_ENV: 'ci'
37+
# Turbopack specific customization for the test runner
38+
__INTERNAL_NEXT_DEV_TEST_TURBO_DEV: TRUE
39+
__INTERNAL_CUSTOM_TURBOPACK_BINDINGS: ${{ github.workspace }}/packages/next-swc/native/next-swc.linux-x64-gnu.node
40+
NEXT_TEST_SKIP_RETRY_MANIFEST: ${{ github.workspace }}/integration-test-data/test-results/main/failed-test-path-list.json
41+
NEXT_TEST_CONTINUE_ON_ERROR: TRUE
42+
NEXT_E2E_TEST_TIMEOUT: 240000
43+
NEXT_TEST_JOB: 1
4144

4245
jobs:
4346
# First, build next-dev and Next.js both to execute across tests.
@@ -49,50 +52,57 @@ jobs:
4952

5053
# Actual test scheduling. These jobs mimic the same jobs in Next.js repo,
5154
# which we do allow some of duplications to make it easier to update if upstream changes.
52-
# Refer build_test_deploy.yml in the Next.js repo for more details.
53-
test_dev:
55+
# Refer build_and_test.yml in the Next.js repo for more details.
56+
test-dev:
5457
# This job name is being used in github action to collect test results. Do not change it, or should update
5558
# ./.github/actions/next-integration-stat to match the new name.
5659
name: Next.js integration test (Development)
57-
runs-on: ubuntu-latest-8-core-oss
60+
timeout-minutes: 180
61+
runs-on: ubuntu-latest-16-core-oss
5862
needs: [setup_nextjs]
5963
strategy:
64+
fail-fast: false
6065
matrix:
61-
node: [16, 18]
62-
group: [1, 2, 3, 4, 5]
66+
group: [1, 2, 3]
6367

6468
steps:
6569
- uses: actions/cache/restore@v3
6670
id: restore-build
6771
with:
6872
path: ./*
69-
key: ${{ inputs.version }}-${{ github.sha }}
73+
key: ${{ inputs.version }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt}}-${{ github.run_number }}
7074
fail-on-cache-miss: true
71-
72-
# This step is quite same as upstream next.js integration execution, but with some differences:
73-
# Sets `__INTERNAL_CUSTOM_TURBOPACK_BINARY`, `__INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH` to setup custom turbopack.
74-
# Sets `NEXT_TEST_SKIP_RETRY_MANIFEST`, `NEXT_TEST_CONTINUE_ON_ERROR` to continue on error but do not retry on the known failed tests.
75-
# Do not set --timings flag
76-
- run: |
77-
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"
78-
name: Run test/development
75+
- name: Run test/development
76+
run: |
77+
ls $NEXT_TEST_SKIP_RETRY_MANIFEST
78+
npm i -g pnpm@$PNPM_VERSION && pnpm --version
79+
npm i -g yarn
80+
sudo npx playwright install-deps && pnpm playwright install
81+
NEXT_TEST_MODE=dev node run-tests.js -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --test-pattern '^(development|e2e|unit)/.*\.test\.(js|jsx|ts|tsx)$'
82+
ls test
83+
ls test/turbopack-test-junit-report
7984
# It is currently expected to fail some of next.js integration test, do not fail CI check.
8085
continue-on-error: true
8186
env:
82-
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDev / Group ${{ matrix.group }}
8387
# marker to parse log output, do not delete / change.
8488
NEXT_INTEGRATION_TEST: true
89+
- name: Upload test reports artifact
90+
uses: actions/upload-artifact@v3
91+
with:
92+
name: Test trace reports
93+
path: |
94+
test/turbopack-test-junit-report
95+
if-no-files-found: ignore
8596

86-
test_dev_e2e:
87-
# This job name is being used in github action to collect test results. Do not change it, or should update
88-
# ./.github/actions/next-integration-stat to match the new name.
89-
name: Next.js integration test (e2e/Development)
90-
runs-on: ubuntu-latest-8-core-oss
97+
test-prod:
98+
name: Next.js integration test (Production)
9199
needs: [setup_nextjs]
100+
runs-on: ubuntu-latest-16-core-oss
101+
timeout-minutes: 180
92102
strategy:
103+
fail-fast: false
93104
matrix:
94-
node: [16, 18]
95-
group: [1, 2, 3, 4, 5, 6, 7]
105+
group: [1, 2, 3]
96106

97107
steps:
98108
- uses: actions/cache/restore@v3
@@ -101,121 +111,32 @@ jobs:
101111
path: ./*
102112
key: ${{ inputs.version }}-${{ github.sha }}
103113
fail-on-cache-miss: true
104-
105-
- run: |
106-
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"
107-
name: Run test/e2e (dev)
114+
- name: Run test/production
115+
run: |
116+
npm i -g pnpm@$PNPM_VERSION && pnpm --version
117+
npm i -g yarn
118+
sudo npx playwright install-deps && pnpm playwright install
119+
NEXT_TEST_MODE=start node run-tests.js -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --test-pattern '^(production|e2e)/.*\.test\.(js|jsx|ts|tsx)$'
108120
continue-on-error: true
109121
env:
110-
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDevE2E / Group ${{ matrix.group }} / Node ${{ matrix.node }}
111-
NEXT_TEST_MODE: dev
112-
RECORD_REPLAY_TEST_METRICS: 1
113122
NEXT_INTEGRATION_TEST: true
114-
115-
test_cna:
116-
# This job name is being used in github action to collect test results. Do not change it, or should update
117-
# ./.github/actions/next-integration-stat to match the new name.
118-
name: Next.js integration test (Create Next App) (No group)
119-
runs-on: ubuntu-latest-8-core-oss
120-
needs: [setup_nextjs]
121-
steps:
122-
- uses: actions/cache/restore@v3
123-
id: restore-build
124-
with:
125-
path: ./*
126-
key: ${{ inputs.version }}-${{ github.sha }}
127-
fail-on-cache-miss: true
128-
129-
# TODO: This test currently seems to load wasm/swc and does not load the next-dev binary.
130-
# Temporary disabled until figure out details.
131-
#- run: |
132-
# 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"
133-
# name: Run test/e2e (create-next-app)
134-
# continue-on-error: true
135-
# env:
136-
# RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDevE2E / Group ${{ matrix.group }} / Node ${{ matrix.node }}
137-
# NEXT_TEST_MODE: dev
138-
# RECORD_REPLAY_TEST_METRICS: 1
139-
# NEXT_INTEGRATION_TEST: true
140-
141-
test_integration:
142-
# This job name is being used in github action to collect test results. Do not change it, or should update
143-
# ./.github/actions/next-integration-stat to match the new name.
144-
name: Next.js integration test (integration)
145-
runs-on: ubuntu-latest-8-core-oss
146-
needs: [setup_nextjs]
147-
strategy:
148-
fail-fast: false
149-
matrix:
150-
group:
151-
[
152-
1,
153-
2,
154-
3,
155-
4,
156-
5,
157-
6,
158-
7,
159-
8,
160-
9,
161-
10,
162-
11,
163-
12,
164-
13,
165-
14,
166-
15,
167-
16,
168-
17,
169-
18,
170-
19,
171-
20,
172-
21,
173-
22,
174-
23,
175-
24,
176-
25,
177-
26,
178-
27,
179-
28,
180-
]
181-
182-
steps:
183-
- uses: actions/cache/restore@v3
184-
id: restore-build
123+
- name: Upload test reports artifact
124+
uses: actions/upload-artifact@v3
185125
with:
126+
name: Test trace reports
186127
path: |
187-
./*
188-
key: ${{ inputs.version }}-${{ github.sha }}
189-
fail-on-cache-miss: true
128+
test/turbopack-test-junit-report
129+
if-no-files-found: ignore
190130

191-
- run: |
192-
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"
193-
name: Test Integration
194-
continue-on-error: true
195-
env:
196-
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testIntegration / Group ${{ matrix.group }}
197-
NEXT_INTEGRATION_TEST: true
198-
199-
test_flaky_subset:
200-
# This job name is being used in github action to collect test results. Do not change it, or should update
201-
# ./.github/actions/next-integration-stat to match the new name.
202-
name: Next.js integration test (FLAKY_SUBSET)
203-
runs-on: ubuntu-latest
131+
test-integration:
132+
name: Next.js integration test (Integration)
204133
needs: [setup_nextjs]
205-
env:
206-
# List of test files to run that expected to pass always. Whole test suite should pass.
207-
TEST_FILES_LIST: |
208-
test/development/acceptance-app/dynamic-error.test.ts \
209-
test/development/acceptance-app/unsupported-app-features.test.ts \
210-
test/development/acceptance-app/ReactRefresh.test.ts \
211-
test/development/basic/legacy-decorators.test.ts \
212-
test/integration/plugin-mdx-rs/test/index.test.js \
213-
test/e2e/app-dir/underscore-ignore-app-paths/underscore-ignore-app-paths.test.ts \
214-
test/e2e/app-dir/app-alias/app-alias.test.ts
215-
134+
runs-on: ubuntu-latest-16-core-oss
135+
timeout-minutes: 180
216136
strategy:
137+
fail-fast: false
217138
matrix:
218-
node: [16]
139+
group: [1, 2, 3, 4, 5, 6]
219140

220141
steps:
221142
- uses: actions/cache/restore@v3
@@ -224,21 +145,27 @@ jobs:
224145
path: ./*
225146
key: ${{ inputs.version }}-${{ github.sha }}
226147
fail-on-cache-miss: true
227-
228-
- run: |
229-
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"
230-
name: Run test/flaky_subset
231-
# This should not fail, but if fails collect result to update dashboard.
148+
- name: Run test/integration
149+
run: |
150+
npm i -g pnpm@$PNPM_VERSION && pnpm --version
151+
npm i -g yarn
152+
sudo npx playwright install-deps && pnpm playwright install
153+
node run-tests.js -g ${{ matrix.group }}/6 -c ${TEST_CONCURRENCY} --test-pattern '^(integration)/.*\.test\.(js|jsx|ts|tsx)$'
232154
continue-on-error: true
233155
env:
234-
# marker to parse log output, do not delete / change.
235156
NEXT_INTEGRATION_TEST: true
157+
- name: Upload test reports artifact
158+
uses: actions/upload-artifact@v3
159+
with:
160+
name: Test trace reports
161+
path: |
162+
test/turbopack-test-junit-report
163+
if-no-files-found: ignore
236164

237165
# Collect integration test results from execute_tests,
238166
# Store it as github artifact for next step to consume.
239167
collect_nextjs_integration_stat:
240-
needs:
241-
[test_dev, test_dev_e2e, test_cna, test_integration, test_flaky_subset]
168+
needs: [test-dev, test-prod, test-integration]
242169
name: Next.js integration test status report
243170
runs-on: ubuntu-latest-8-core-oss
244171
permissions:
@@ -263,3 +190,26 @@ jobs:
263190
nextjs-test-results.json
264191
failed-test-path-list.json
265192
slack-payload.json
193+
194+
upload_test_trace:
195+
needs: [test-dev, test-prod, test-integration]
196+
name: Upload test trace to datadog
197+
runs-on: ubuntu-latest-8-core-oss
198+
steps:
199+
- name: Checkout
200+
uses: actions/checkout@v3
201+
- name: Download test reports artifact
202+
id: download-test-reports
203+
uses: actions/download-artifact@v3
204+
continue-on-error: true
205+
with:
206+
name: Test trace reports
207+
path: test
208+
- name: Upload test trace to datadog
209+
continue-on-error: true
210+
run: |
211+
npm install -g [email protected] @datadog/[email protected]
212+
jrm ./nextjs-test-result-junit.xml "test/**/*.xml"
213+
ls -al ./*.xml
214+
# We'll tag this to the Turbopack service, not the next.js
215+
DD_ENV=ci datadog-ci junit upload --tags test.type:turbopack.daily --service Turbopack ./nextjs-test-result-junit.xml

.github/workflows/setup-nextjs-build.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ jobs:
121121
# 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.
122122
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())"'
123123
124+
- name: Temporary test skip
125+
run: |
126+
rm -rf test/integration/jsconfig-paths/test/index.test.js
127+
124128
# Once build completes, creates a cache of the build output
125129
# so subsequent job to actually execute tests can reuse it.
126130
# Note that we do not use upload / download artifacts for this -
@@ -132,4 +136,4 @@ jobs:
132136
with:
133137
path: |
134138
./*
135-
key: ${{ inputs.version }}-${{ github.sha }}
139+
key: ${{ inputs.version }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt}}-${{ github.run_number }}

0 commit comments

Comments
 (0)