forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(workflow): enable test trace upload (vercel#51107)
### What? WEB-1150. This PR is an attempt to upload next.js's test results into datadog test trace to track its status. Originally it tried to use automatic trace injection (dd-trace/ci/init). However, due to some of custom environments / setup we use it was not compatible out of the box. Instead, this PR injects a new test reportert to generate junit report, then upload it at once at the end of the testing pipeline. The reporter is configured to run when necessary variables set, local run should not be affected. One thing to note is this report will not count retry results, as it'll create duplicated test entry with multiple results since we runts jest per individual test. This'll allow to detect flaky test easier, but also it means we'll get bit of skewed test results compare to the real world as first failure will be accounted as test fail immediately.
- Loading branch information
Showing
7 changed files
with
81 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ env: | |
# canary next-swc binaries in the monorepo | ||
NEXT_SKIP_NATIVE_POSTINSTALL: 1 | ||
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }} | ||
DATADOG_TRACE_NEXTJS_TEST: 'true' | ||
DD_ENV: 'ci' | ||
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }} | ||
NEXT_TEST_JOB: 1 | ||
|
@@ -181,6 +182,27 @@ jobs: | |
afterBuild: pnpm playwright install && BROWSER_NAME=firefox node run-tests.js test/integration/production/test/index.test.js && BROWSER_NAME=safari NEXT_TEST_MODE=start node run-tests.js -c 1 test/integration/production/test/index.test.js test/e2e/basepath.test.ts && BROWSER_NAME=safari DEVICE_NAME='iPhone XR' node run-tests.js -c 1 test/production/prerender-prefetch/index.test.ts | ||
secrets: inherit | ||
|
||
report-test-results: | ||
needs: ['test-dev', 'test-prod', 'test-integration', 'test-turbopack-dev'] | ||
runs-on: [self-hosted, linux, x64] | ||
name: upload test trace to datadog | ||
# We'll not block the CI if the upload fails | ||
continue-on-error: true | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: Test trace reports | ||
path: test | ||
- name: Upload traces | ||
run: | | ||
ls -al ./test | ||
npm install -g [email protected] @datadog/[email protected] | ||
jrm ./nextjs-test-result-junit.xml "test/test-junit-report/**/*.xml" | ||
jrm ./turbopack-test-result-junit.xml "test/turbopack-test-junit-report/**/*.xml" | ||
# Put a separate tag for the tests with turbopack to distinguish between same test names | ||
DD_ENV=ci datadog-ci junit upload --tags test.type:nextjs --service nextjs ./nextjs-test-result-junit.xml | ||
DD_ENV=ci datadog-ci junit upload --tags test.type:turbopack --service nextjs ./turbopack-test-result-junit.xml | ||
tests-pass: | ||
needs: | ||
[ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
.vscode | ||
|
||
e2e/**/tsconfig.json | ||
test-junit-report/ | ||
turbopack-test-junit-report/ |