Skip to content

Commit f984d1f

Browse files
authored
Report tests to Datadog from Job that executed them (#73180)
1 parent a836006 commit f984d1f

File tree

2 files changed

+19
-52
lines changed

2 files changed

+19
-52
lines changed

Diff for: .github/workflows/build_and_test.yml

-41
Original file line numberDiff line numberDiff line change
@@ -615,47 +615,6 @@ jobs:
615615
stepName: 'test-ppr-prod-${{ matrix.group }}'
616616
secrets: inherit
617617

618-
report-test-results-to-datadog:
619-
needs:
620-
[
621-
'changes',
622-
'test-unit',
623-
'test-dev',
624-
'test-prod',
625-
'test-integration',
626-
'test-ppr-dev',
627-
'test-ppr-prod',
628-
'test-ppr-integration',
629-
'test-turbopack-dev',
630-
'test-turbopack-integration',
631-
'test-turbopack-production',
632-
'test-turbopack-production-integration',
633-
]
634-
if: ${{ always() && needs.changes.outputs.docs-only == 'false' && !github.event.pull_request.head.repo.fork }}
635-
636-
runs-on: ubuntu-latest
637-
name: report test results to datadog
638-
steps:
639-
- name: Download test report artifacts
640-
id: download-test-reports
641-
uses: actions/download-artifact@v4
642-
with:
643-
pattern: test-reports-*
644-
path: test
645-
merge-multiple: true
646-
647-
- name: Upload test report to datadog
648-
run: |
649-
if [ -d ./test/test-junit-report ]; then
650-
# Add a `test.type` tag to distinguish between turbopack and next.js runs
651-
DD_ENV=ci npx @datadog/[email protected] junit upload --tags test.type:nextjs --service nextjs ./test/test-junit-report
652-
fi
653-
654-
if [ -d ./test/turbopack-test-junit-report ]; then
655-
# Add a `test.type` tag to distinguish between turbopack and next.js runs
656-
DD_ENV=ci npx @datadog/[email protected] junit upload --tags test.type:turbopack --service nextjs ./test/turbopack-test-junit-report
657-
fi
658-
659618
tests-pass:
660619
needs:
661620
[

Diff for: .github/workflows/build_reusable.yml

+19-11
Original file line numberDiff line numberDiff line change
@@ -243,19 +243,27 @@ jobs:
243243
name: webpack bundle analysis stats-${{ steps.var.outputs.input_step_key }}
244244
path: packages/next/dist/compiled/next-server/report.*.html
245245

246-
- name: Upload test report artifacts
247-
uses: actions/upload-artifact@v4
246+
- name: Upload test report to datadog
248247
if: ${{ inputs.afterBuild && always() }}
249-
with:
250-
name: test-reports-${{ steps.var.outputs.input_step_key }}
251-
path: |
252-
test/test-junit-report
253-
test/turbopack-test-junit-report
254-
test/rspack-test-junit-report
255-
if-no-files-found: ignore
248+
run: |
249+
# Add a `test.type` tag to distinguish between turbopack and next.js runs
250+
# Add a `nextjs.test_session.name` tag to help identify the job
251+
if [ -d ./test/test-junit-report ]; then
252+
npx @datadog/[email protected] junit upload \
253+
--service nextjs \
254+
--tags test.type:nextjs \
255+
--tags test_session.name:"${{ inputs.stepName }}" \
256+
./test/test-junit-report
257+
fi
258+
if [ -d ./test/turbopack-test-junit-report ]; then
259+
npx @datadog/[email protected] junit upload \
260+
--service nextjs \
261+
--tags test.type:turbopack \
262+
--tags test_session.name:"${{ inputs.stepName }}" \
263+
./test/turbopack-test-junit-report
264+
fi
256265
257-
# upload playwright snapshots from failed tests
258-
- name: Upload test report artifacts
266+
- name: Upload Playwright Snapshots
259267
uses: actions/upload-artifact@v4
260268
if: ${{ inputs.afterBuild && always() }}
261269
with:

0 commit comments

Comments
 (0)