Skip to content

Commit

Permalink
Report tests to Datadog from Job that executed them (vercel#73180)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Feb 19, 2025
1 parent a836006 commit f984d1f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 52 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -615,47 +615,6 @@ jobs:
stepName: 'test-ppr-prod-${{ matrix.group }}'
secrets: inherit

report-test-results-to-datadog:
needs:
[
'changes',
'test-unit',
'test-dev',
'test-prod',
'test-integration',
'test-ppr-dev',
'test-ppr-prod',
'test-ppr-integration',
'test-turbopack-dev',
'test-turbopack-integration',
'test-turbopack-production',
'test-turbopack-production-integration',
]
if: ${{ always() && needs.changes.outputs.docs-only == 'false' && !github.event.pull_request.head.repo.fork }}

runs-on: ubuntu-latest
name: report test results to datadog
steps:
- name: Download test report artifacts
id: download-test-reports
uses: actions/download-artifact@v4
with:
pattern: test-reports-*
path: test
merge-multiple: true

- name: Upload test report to datadog
run: |
if [ -d ./test/test-junit-report ]; then
# Add a `test.type` tag to distinguish between turbopack and next.js runs
DD_ENV=ci npx @datadog/[email protected] junit upload --tags test.type:nextjs --service nextjs ./test/test-junit-report
fi
if [ -d ./test/turbopack-test-junit-report ]; then
# Add a `test.type` tag to distinguish between turbopack and next.js runs
DD_ENV=ci npx @datadog/[email protected] junit upload --tags test.type:turbopack --service nextjs ./test/turbopack-test-junit-report
fi
tests-pass:
needs:
[
Expand Down
30 changes: 19 additions & 11 deletions .github/workflows/build_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,19 +243,27 @@ jobs:
name: webpack bundle analysis stats-${{ steps.var.outputs.input_step_key }}
path: packages/next/dist/compiled/next-server/report.*.html

- name: Upload test report artifacts
uses: actions/upload-artifact@v4
- name: Upload test report to datadog
if: ${{ inputs.afterBuild && always() }}
with:
name: test-reports-${{ steps.var.outputs.input_step_key }}
path: |
test/test-junit-report
test/turbopack-test-junit-report
test/rspack-test-junit-report
if-no-files-found: ignore
run: |
# Add a `test.type` tag to distinguish between turbopack and next.js runs
# Add a `nextjs.test_session.name` tag to help identify the job
if [ -d ./test/test-junit-report ]; then
npx @datadog/[email protected] junit upload \
--service nextjs \
--tags test.type:nextjs \
--tags test_session.name:"${{ inputs.stepName }}" \
./test/test-junit-report
fi
if [ -d ./test/turbopack-test-junit-report ]; then
npx @datadog/[email protected] junit upload \
--service nextjs \
--tags test.type:turbopack \
--tags test_session.name:"${{ inputs.stepName }}" \
./test/turbopack-test-junit-report
fi
# upload playwright snapshots from failed tests
- name: Upload test report artifacts
- name: Upload Playwright Snapshots
uses: actions/upload-artifact@v4
if: ${{ inputs.afterBuild && always() }}
with:
Expand Down

0 comments on commit f984d1f

Please sign in to comment.