Commit 6137f4e2 authored by Benjamin Woodruff's avatar Benjamin Woodruff

CI: Download and run self-contained datadog-ci instead of using pnpm dlx or npx

parent 1d8e326d
name: 'Setup Datadog CI'
description: 'Installs the datadog-ci binary and sets $DATADOG_CI_PATH'
runs:
using: 'composite'
steps:
- name: 'Install datadog-ci'
shell: bash
run: |
echo "DATADOG_CI_PATH=/bin/false" >> $GITHUB_ENV
DATADOG_CI_VERSION=v5.12.1
DATADOG_CI_PATH="/tmp/nextjs-ci-bin-datadog-ci-$DATADOG_CI_VERSION"
DATADOG_CI_SHA256=86fcf24d5211f5ae714e947354ccb621e74e2bba4162247890454c6461e74ca5
if [[ ! -x "$DATADOG_CI_PATH" ]]; then
echo "Downloading $DATADOG_CI_PATH"
curl -L --fail --retry 2 -o "$DATADOG_CI_PATH" "https://github.com/DataDog/datadog-ci/releases/download/$DATADOG_CI_VERSION/datadog-ci_linux-x64"
if ! echo "$DATADOG_CI_SHA256 $DATADOG_CI_PATH" | sha256sum --check --status; then
echo "Checksum mismatch of $DATADOG_CI_PATH"
rm -f "$DATADOG_CI_PATH"
exit 1
fi
chmod +x "$DATADOG_CI_PATH"
fi
echo "DATADOG_CI_PATH=$DATADOG_CI_PATH" >> $GITHUB_ENV
......@@ -588,14 +588,17 @@ jobs:
merge-multiple: true
path: turbopack-bin-size
- name: Install datadog-ci
uses: ./.github/actions/setup-datadog-ci
- name: Upload to Datadog
run: |
ls -al turbopack-bin-size
for filename in turbopack-bin-size/*; do
export BYTESIZE+=" --metrics $(cat $filename)"
export BYTESIZE+=" --measures $(cat $filename)"
done
echo "Reporting $BYTESIZE"
npx @datadog/datadog-ci@2.23.1 metric --no-fail --level pipeline $BYTESIZE
"$DATADOG_CI_PATH" measure --no-fail --level pipeline $BYTESIZE
......@@ -353,13 +353,17 @@ jobs:
name: webpack bundle analysis stats-${{ steps.var.outputs.input_step_key }}
path: packages/next/dist/compiled/next-server/report.*.html
- name: Install datadog-ci
if: ${{ inputs.afterBuild && always() && !github.event.pull_request.head.repo.fork }}
uses: ./.github/actions/setup-datadog-ci
- name: Upload test report to datadog
if: ${{ inputs.afterBuild && always() && !github.event.pull_request.head.repo.fork }}
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
pnpm dlx @datadog/datadog-ci@2.45.1 junit upload \
"$DATADOG_CI_PATH" junit upload \
--service nextjs \
--tags test.type:nextjs \
--tags test_session.name:"${{ inputs.stepName }}" \
......@@ -367,7 +371,7 @@ jobs:
./test/test-junit-report
fi
if [ -d ./test/turbopack-test-junit-report ]; then
pnpm dlx @datadog/datadog-ci@2.45.1 junit upload \
"$DATADOG_CI_PATH" junit upload \
--service nextjs \
--tags test.type:turbopack \
--tags test_session.name:"${{ inputs.stepName }}" \
......
......@@ -233,17 +233,19 @@ jobs:
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: Install datadog-ci
uses: ./.github/actions/setup-datadog-ci
- name: Upload test report to datadog
run: |
if [ -d ./test/test-junit-report ]; then
DD_ENV=ci npx @datadog/datadog-ci@2.23.1 junit upload --tags test.type:deploy --service nextjs ./test/test-junit-report
DD_ENV=ci "$DATADOG_CI_PATH" junit upload --tags test.type:deploy --service nextjs ./test/test-junit-report
fi
upload-adapter-test-results:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment