Skip to content

Add CodeBoarding architecture analysis #1

Add CodeBoarding architecture analysis

Add CodeBoarding architecture analysis #1

Workflow file for this run

name: Tests
on:
pull_request:
branches:
- main
permissions:
contents: read
checks: read
deployments: read
issues: write
pull-requests: write
statuses: write
env:
VERCEL_TELEMETRY_DISABLED: '1'
TURBO_REMOTE_ONLY: 'true'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
setup:
name: Find Changes
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
statuses: write
outputs:
unitTests: ${{ steps['set-tests'].outputs['unitTests'] }}
e2eTests: ${{ steps['set-tests'].outputs['e2eTests'] }}
baseSha: ${{ steps.pr-context.outputs.baseSha }}
headSha: ${{ steps.pr-context.outputs.headSha }}
prNumber: ${{ steps.pr-context.outputs.prNumber }}
affectedPackages: ${{ steps['affected-packages'].outputs['packages'] }}
testStrategy: ${{ steps['affected-packages'].outputs['strategy'] }}
affectedCount: ${{ steps['affected-packages'].outputs['count'] }}
totalCount: ${{ steps['affected-packages'].outputs['total'] }}
allPackages: ${{ steps['affected-packages'].outputs['allPackages'] }}
steps:
- name: Resolve PR context
id: pr-context
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER="${{ github.event.pull_request.number }}"
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
echo "prNumber=$PR_NUMBER" >> $GITHUB_OUTPUT
echo "baseSha=$BASE_SHA" >> $GITHUB_OUTPUT
echo "headSha=$HEAD_SHA" >> $GITHUB_OUTPUT
# The `context` here MUST exactly match the one written by the
# `Report status to PR commit` step in the `summary` job below.
# GitHub commit statuses are upserted by `(sha, context)`, so a
# mismatch would create a second row instead of overwriting this
# pending one with the final result.
- name: Post pending Summary status to PR commit
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: '${{ steps.pr-context.outputs.headSha }}',
state: 'pending',
context: 'Summary',
target_url: `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`,
description: 'Tests in progress',
});
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ steps.pr-context.outputs.headSha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Turborepo Remote Cache
uses: vercel/setup-turborepo-remote-cache-action@3df3d75a5268bbe2a4ee66048f56f3a86d6e21b7
with:
team: ${{ vars.TURBO_TEAM }}
- uses: actions/setup-node@v4
with:
node-version: 22
- name: install turbo@2.10.8
run: npm i -g turbo@2.10.8
- id: affected-packages
run: |
# Set base SHA for affected package detection
export TURBO_BASE_SHA="${{ steps.pr-context.outputs.baseSha }}"
# Get affected packages info for PR comment
AFFECTED_OUTPUT=$(node utils/test-affected.js "${{ steps.pr-context.outputs.baseSha }}" 2>&1)
# Extract affected packages count and total packages count
PACKAGE_COUNT=$(echo "$AFFECTED_OUTPUT" | grep -o "Found [0-9]* affected packages" | grep -o "[0-9]*" | head -1 || echo "0")
TOTAL_COUNT=$(echo "$AFFECTED_OUTPUT" | grep -o "Total packages with tests: [0-9]*" | grep -o "[0-9]*" | head -1 || echo "0")
if echo "$AFFECTED_OUTPUT" | grep -q "config or workflow changes detected"; then
STRATEGY="all-e2e"
elif echo "$AFFECTED_OUTPUT" | grep -q "test-all result detected"; then
STRATEGY="test-all"
elif [ "$PACKAGE_COUNT" -gt "0" ]; then
STRATEGY="affected-only"
else
STRATEGY="no-tests"
fi
# Get the list of affected packages
PACKAGES=$(echo "$AFFECTED_OUTPUT" | sed -n '/Affected packages that would be tested:/,/This would result in the following turbo filters:/p' | grep " - " | sed 's/ - //' | tr '\n' ',' | sed 's/,$//')
# Get all packages (trim whitespace and newlines)
ALL_PACKAGES=$(echo "$AFFECTED_OUTPUT" | grep "All packages with tests:" | sed 's/All packages with tests: //' | head -1 | xargs)
# Debug output
echo "PACKAGE_COUNT=$PACKAGE_COUNT"
echo "TOTAL_COUNT=$TOTAL_COUNT"
echo "STRATEGY=$STRATEGY"
echo "strategy=$STRATEGY" >> $GITHUB_OUTPUT
echo "packages=$PACKAGES" >> $GITHUB_OUTPUT
echo "count=$PACKAGE_COUNT" >> $GITHUB_OUTPUT
echo "total=$TOTAL_COUNT" >> $GITHUB_OUTPUT
echo "allPackages=$ALL_PACKAGES" >> $GITHUB_OUTPUT
- id: set-tests
run: |
UNIT_TESTS_ARRAY=$(TEST_TYPE=unit node utils/chunk-tests.js)
E2E_TESTS_ARRAY=$(TEST_TYPE=e2e node utils/chunk-tests.js)
echo "Unit tests to run:"
echo "$UNIT_TESTS_ARRAY"
echo "E2E tests to run:"
echo "$E2E_TESTS_ARRAY"
echo "unitTests=$UNIT_TESTS_ARRAY" >> $GITHUB_OUTPUT
echo "e2eTests=$E2E_TESTS_ARRAY" >> $GITHUB_OUTPUT
env:
TURBO_BASE_SHA: ${{ steps.pr-context.outputs.baseSha }}
comment-test-strategy:
name: Comment Test Strategy
runs-on: ubuntu-latest
continue-on-error: true
needs:
- setup
steps:
- name: Comment PR with test strategy
uses: actions/github-script@v7
with:
script: |
const strategy = '${{ needs.setup.outputs.testStrategy }}';
const packages = '${{ needs.setup.outputs.affectedPackages }}';
const allPackages = '${{ needs.setup.outputs.allPackages }}';
const affectedCount = parseInt('${{ needs.setup.outputs.affectedCount }}') || 0;
const totalCount = parseInt('${{ needs.setup.outputs.totalCount }}') || 0;
const baseSha = '${{ needs.setup.outputs.baseSha }}';
const headSha = '${{ needs.setup.outputs.headSha }}';
const prNumber = ${{ needs.setup.outputs.prNumber }};
const percentage = totalCount > 0 ? Math.round((affectedCount / totalCount) * 100) : 0;
const unaffectedCount = totalCount - affectedCount;
const unaffectedPercentage = totalCount > 0 ? Math.round((unaffectedCount / totalCount) * 100) : 0;
const affectedSet = packages ? new Set(packages.split(',').map(p => p.trim())) : new Set();
const allPackagesList = allPackages ? allPackages.split(',').map(p => p.trim()) : [];
const unaffectedPackages = allPackagesList.filter(pkg => !affectedSet.has(pkg));
const unaffectedList = unaffectedPackages.map(p => `1. \`${p}\``).join('\n');
let message = '## 🧪 Unit Test Strategy\n\n';
message += `**Comparing**: [\`${baseSha.substring(0, 7)}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${baseSha}) → [\`${headSha.substring(0, 7)}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${headSha}) ([view diff](https://github.com/${context.repo.owner}/${context.repo.repo}/compare/${baseSha}...${headSha}))\n\n`;
if (strategy === 'all-e2e') {
message += '**Strategy**: Code changed outside of a package - running all unit tests\n\n';
message += '⚠️ All unit tests will run because global code changes could impact all packages.\n\n';
if (packages) {
const packageList = packages.split(',').map(p => `1. \`${p.trim()}\``).join('\n');
message += `<details>\n<summary>Affected packages - ${affectedCount} (${percentage}%)</summary>\n\n${packageList}\n\n</details>\n\n`;
}
if (unaffectedCount > 0) {
message += `<details>\n<summary>Unaffected packages - ${unaffectedCount} (${unaffectedPercentage}%)</summary>\n\n${unaffectedList || '_No unaffected packages_'}\n\n</details>\n\n`;
}
message += '### Results\n\n';
message += '- **Unit tests**: All affected packages will run unit tests\n';
message += '- **E2E tests**: Running in parallel in this workflow\n';
message += '- **Type checks**: All affected packages will run type checks';
} else if (strategy === 'affected-only') {
message += '**Strategy**: Affected packages only\n\n';
message += '✅ Only testing packages that have been modified or depend on modified packages.\n\n';
if (packages) {
const packageList = packages.split(',').map(p => `1. \`${p.trim()}\``).join('\n');
message += `<details>\n<summary>Affected packages - ${affectedCount} (${percentage}%)</summary>\n\n${packageList}\n\n</details>\n\n`;
}
if (unaffectedCount > 0) {
message += `<details>\n<summary>Unaffected packages - ${unaffectedCount} (${unaffectedPercentage}%)</summary>\n\n${unaffectedList || '_No unaffected packages_'}\n\n</details>\n\n`;
}
message += '### Results\n\n';
message += '- **Unit tests**: Only affected packages will run unit tests\n';
message += '- **E2E tests**: Running in parallel in this workflow\n';
message += '- **Type checks**: Only affected packages will run type checks';
} else if (strategy === 'no-tests') {
message += '**Strategy**: No tests needed\n\n';
message += '✨ No packages affected - skipping tests\n\n';
message += '### Results\n\n';
message += '- **Unit tests**: None\n';
message += '- **E2E tests**: Running in parallel in this workflow\n';
message += '- **Type checks**: None';
} else if (strategy === 'test-all') {
message += '**Strategy**: Full unit test suite\n\n';
message += '🔄 Running all unit tests (unable to determine affected packages)\n\n';
if (packages) {
const packageList = packages.split(',').map(p => `1. \`${p.trim()}\``).join('\n');
message += `<details>\n<summary>Affected packages - ${affectedCount} (${percentage}%)</summary>\n\n${packageList}\n\n</details>\n\n`;
}
if (unaffectedCount > 0) {
message += `<details>\n<summary>Unaffected packages - ${unaffectedCount} (${unaffectedPercentage}%)</summary>\n\n${unaffectedList || '_No unaffected packages_'}\n\n</details>\n\n`;
}
message += '### Results\n\n';
message += '- **Unit tests**: All packages will run unit tests\n';
message += '- **E2E tests**: Running in parallel in this workflow\n';
message += '- **Type checks**: All packages will run type checks';
} else {
message += '**Strategy**: Unknown\n\n';
message += `⚠️ Unknown strategy: ${strategy}\n\n`;
message += '### Results\n\n';
message += '- **Unit tests**: Unknown\n';
message += '- **E2E tests**: Running in parallel in this workflow\n';
message += '- **Type checks**: Unknown';
}
message += '\n\n---\n*This comment is automatically generated based on the [affected testing strategy](.github/AFFECTED_TESTING.md)*';
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
const existingComment = comments.find(comment =>
comment.user.login === 'github-actions[bot]' &&
(comment.body.includes('## 🧪 Unit Test Strategy') || comment.body.includes('## 🧪 Test Strategy'))
);
if (existingComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: message
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: message
});
}
unit-test:
timeout-minutes: 120
runs-on: ${{ matrix.runner }}
name: Unit / ${{ matrix.label }}
permissions:
contents: read
id-token: write
if: ${{ needs.setup.outputs['unitTests'] != '[]' }}
needs:
- setup
strategy:
fail-fast: false
max-parallel: 75
matrix:
include: ${{ fromJson(needs.setup.outputs['unitTests']) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.setup.outputs.headSha }}
- name: Setup Turborepo Remote Cache
uses: vercel/setup-turborepo-remote-cache-action@3df3d75a5268bbe2a4ee66048f56f3a86d6e21b7
with:
team: ${{ vars.TURBO_TEAM }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.nodeVersion }}
- name: Setup Go toolchain
if: ${{ matrix.needsGo == true }}
uses: actions/setup-go@v6
with:
go-version: '1.23.12'
cache: false
- name: Setup Rust toolchain
if: ${{ matrix.needsRust == true }}
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: '1.96.1'
targets: wasm32-wasip2
# yarn 1.22.21 introduced a Corepack bug when running tests.
# this can be removed once https://github.com/yarnpkg/yarn/issues/9015 is resolved
- name: install yarn@1.22.19
run: npm i -g yarn@1.22.19
- name: install pnpm@10.29.3
run: npm i -g pnpm@10.29.3
- name: install uv@0.10.11
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
version: '0.10.11'
- run: pnpm install
- name: "Print test manifest (chunk ${{matrix.chunkNumber}}/${{matrix.allChunksLength}})"
shell: bash
env:
VITEST_TEST_FILES: ${{ matrix.useEnvPaths == true && join(matrix.testPaths, ' ') || '' }}
run: |
# Resolve the file list the same way the test step does
if [ -n "$VITEST_TEST_FILES" ]; then
files="$VITEST_TEST_FILES"
source="VITEST_TEST_FILES env var"
else
files="${{ join(matrix.testPaths, ' ') }}"
source="CLI args"
fi
count=$(echo "$files" | tr ' ' '\n' | grep -c .)
echo "Chunk ${{matrix.chunkNumber}} of ${{matrix.allChunksLength}} — $count files via $source"
echo "$files" | tr ' ' '\n' | grep . | sort | sed 's/^/ /'
{
echo "## Chunk ${{matrix.chunkNumber}}/${{matrix.allChunksLength}} — \`${{matrix.packageName}}\`"
echo "| | |"
echo "|---|---|"
echo "| Runner | \`${{matrix.runner}}\` / Node v\`${{matrix.nodeVersion}}\` |"
echo "| Files | $count (via $source) |"
echo ""
echo "<details><summary>File list</summary>"
echo ""
echo '```'
echo "$files" | tr ' ' '\n' | grep . | sort
echo '```'
echo "</details>"
} >> "$GITHUB_STEP_SUMMARY"
- name: Test ${{matrix.packageName}}
timeout-minutes: 25
run: |
attempt=1
max_attempts=2
export NODE_OPTIONS="--require=${GITHUB_WORKSPACE}/utils/dd-trace-ci-init.js"
while [ "$attempt" -le "$max_attempts" ]; do
echo "Running tests (attempt $attempt/$max_attempts): ${{matrix.testScript}} ${{matrix.packageName}}"
# When VITEST_TEST_FILES is set, the test script reads paths from that env var
# instead of CLI args, avoiding the Windows cmd.exe ~8191 char arg limit.
if [ -n "$VITEST_TEST_FILES" ]; then
run_cmd="node utils/gen.js && node_modules/.bin/turbo run ${{matrix.testScript}} --summarize --cache-dir='.turbo' --log-order=stream --filter=${{matrix.packageName}}"
else
run_cmd="node utils/gen.js && node_modules/.bin/turbo run ${{matrix.testScript}} --summarize --cache-dir='.turbo' --log-order=stream --filter=${{matrix.packageName}} -- ${{ join(matrix.testPaths, ' ') }}"
fi
if eval "$run_cmd"; then
exit 0
fi
if [ "$attempt" -eq "$max_attempts" ]; then
echo "Tests failed after $max_attempts attempts."
exit 1
fi
echo "Tests failed; retrying once..."
attempt=$((attempt+1))
done
shell: bash
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_TEAM_ID: ${{ secrets.VERCEL_TEAM_ID }}
TURBO_BASE_SHA: ${{ needs.setup.outputs.baseSha }}
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
FORCE_COLOR: '1'
VITEST_TEST_FILES: ${{ matrix.useEnvPaths == true && join(matrix.testPaths, ' ') || '' }}
# Datadog Test Optimization: emit per-test spans correlated to the
# GitHub Actions job span, replacing the previous post-hoc JUnit
# upload. See test/lib/deployment/metrics.js for the legacy
# DATADOG_API_KEY consumer (custom transient-error metrics).
DD_CIVISIBILITY_AGENTLESS_ENABLED: 'true'
DD_API_KEY: ${{ secrets.DATADOG_API_KEY_CLI }}
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_CLI }}
DD_ENV: ci
DD_SERVICE: vercel-cli
DD_PROFILING_ENABLED: 'false'
DD_NATIVE_METRICS: 'false'
e2e-test:
timeout-minutes: 120
runs-on: ${{ matrix.runner }}
name: E2E / ${{ matrix.label }}
permissions:
contents: read
deployments: read
id-token: write
statuses: read
if: ${{ needs.setup.outputs['e2eTests'] != '[]' }}
needs:
- setup
strategy:
fail-fast: false
max-parallel: 75
matrix:
include: ${{ fromJson(needs.setup.outputs['e2eTests']) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.setup.outputs.headSha }}
- name: Setup Turborepo Remote Cache
uses: vercel/setup-turborepo-remote-cache-action@3df3d75a5268bbe2a4ee66048f56f3a86d6e21b7
with:
team: ${{ vars.TURBO_TEAM }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.nodeVersion }}
- name: Setup Go toolchain
if: ${{ matrix.needsGo == true }}
uses: actions/setup-go@v6
with:
go-version: '1.23.12'
cache: false
- name: Setup Rust toolchain
if: ${{ matrix.needsRust == true }}
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: '1.96.1'
targets: wasm32-wasip2
# yarn 1.22.21 introduced a Corepack bug when running tests.
# this can be removed once https://github.com/yarnpkg/yarn/issues/9015 is resolved
- name: install yarn@1.22.19
run: npm i -g yarn@1.22.19
- name: install pnpm@10.29.3
run: npm i -g pnpm@10.29.3
- name: Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
version: '0.10.11'
- name: Install Ruby + Bundler
if: ${{ matrix.packageName == 'vercel' }}
uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0
with:
ruby-version: '3.3'
- run: pnpm install
- name: Wait for deployment tarballs
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_SHA: ${{ needs.setup.outputs.headSha }}
run: |
set -euo pipefail
# E2E needs the CLI and Python wheel tarballs produced by the Vercel
# preview deployment, but the workflow now starts on pull_request so
# tests can begin before the deployment-ready repository_dispatch.
# Vercel already reports successful deployments back to GitHub via
# deployment statuses and commit statuses. We poll those GitHub-owned
# records for candidate public URLs, then trust a URL only after the
# actual tarball endpoint responds. That final HTTP check is the
# readiness gate, so stale/unrelated status URLs are harmless.
validate_deployment_url() {
local url="${1%/}"
if [ -z "$url" ]; then
return 1
fi
if curl -fsI "$url/tarballs/vercel.tgz" >/dev/null; then
echo "DPL_URL=$url" >> "$GITHUB_ENV"
echo "VERCEL_CLI_VERSION=$url/tarballs/vercel.tgz" >> "$GITHUB_ENV"
echo "Deployment tarball is ready at $url/tarballs/vercel.tgz"
return 0
fi
return 1
}
get_candidate_urls() {
gh api "repos/${GITHUB_REPOSITORY}/deployments?sha=${HEAD_SHA}&per_page=20" \
--jq '.[].id' | while IFS= read -r deployment_id; do
gh api "repos/${GITHUB_REPOSITORY}/deployments/${deployment_id}/statuses" \
--jq '.[] | select(.state == "success" and .environment_url != null and .environment_url != "") | .environment_url'
done
gh api "repos/${GITHUB_REPOSITORY}/commits/${HEAD_SHA}/status" \
--jq '.statuses[] | select(.state == "success" and .target_url != null and .target_url != "") | .target_url'
}
for attempt in {1..120}; do
while IFS= read -r candidate_url; do
if validate_deployment_url "$candidate_url"; then
exit 0
fi
done < <(get_candidate_urls | sort -u)
echo "Deployment tarball is not ready yet (attempt $attempt/120)."
sleep 10
done
echo "Timed out waiting for deployment tarball."
exit 1
- name: Resolve Python wheel URLs
shell: bash
run: |
DEPLOYMENT_URL="$DPL_URL"
PACKAGES_JSON="$(node utils/get-python-packages.js)"
if [ -z "$PACKAGES_JSON" ] || [ "$PACKAGES_JSON" = "[]" ]; then
echo "No Python packages discovered; skipping wheel URL resolution."
exit 0
fi
echo "$PACKAGES_JSON" | jq -c '.[]' | while IFS= read -r package; do
package_slug="$(echo "$package" | jq -r '.packageDir')"
package_name="$(echo "$package" | jq -r '.packageName')"
wheel_name="$(curl -sf "$DEPLOYMENT_URL/tarballs/$package_slug-wheel.json" | jq -r '.filename' || echo "")"
if [ -z "$wheel_name" ]; then
continue
fi
env_var="$(printf '%s' "$package_name" | tr -c '[:alnum:]' '_' | tr '[:lower:]' '[:upper:]')_PYTHON"
echo "$env_var=$package_name @ $DEPLOYMENT_URL/tarballs/$wheel_name" >> "$GITHUB_ENV"
done
- name: Test ${{matrix.packageName}}
timeout-minutes: 35
run: |
attempt=1
max_attempts=2
export NODE_OPTIONS="--require=${GITHUB_WORKSPACE}/utils/dd-trace-ci-init.js"
while [ "$attempt" -le "$max_attempts" ]; do
echo "Running tests (attempt $attempt/$max_attempts): ${{matrix.testScript}} ${{matrix.packageName}}"
if node utils/gen.js && node_modules/.bin/turbo run ${{matrix.testScript}} --summarize --cache-dir=".turbo" --log-order=stream --filter=${{matrix.packageName}} -- ${{ join(matrix.testPaths, ' ') }}; then
exit 0
fi
if [ "$attempt" -eq "$max_attempts" ]; then
echo "Tests failed after $max_attempts attempts."
exit 1
fi
echo "Tests failed; retrying once..."
attempt=$((attempt+1))
done
shell: bash
env:
# Per-package pip install specs (e.g. VERCEL_RUNTIME_PYTHON,
# VERCEL_WORKERS_PYTHON) are also available here, injected into
# $GITHUB_ENV by the "Resolve Python wheel URLs" step above.
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_TEAM_ID: ${{ secrets.VERCEL_TEAM_ID }}
TURBO_BASE_SHA: ${{ needs.setup.outputs.baseSha }}
FORCE_COLOR: '1'
# Datadog Test Optimization: emit per-test spans correlated to the
# GitHub Actions job span, replacing the previous post-hoc JUnit
# upload. See test/lib/deployment/metrics.js for the legacy
# DATADOG_API_KEY consumer (custom transient-error metrics).
DD_CIVISIBILITY_AGENTLESS_ENABLED: 'true'
DD_API_KEY: ${{ secrets.DATADOG_API_KEY_CLI }}
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_CLI }}
DD_ENV: ci
DD_SERVICE: vercel-cli
DD_PROFILING_ENABLED: 'false'
DD_NATIVE_METRICS: 'false'
summary:
name: Summary
runs-on: ubuntu-latest
timeout-minutes: 5
if: always()
needs:
- setup
- unit-test
- e2e-test
permissions:
statuses: write
steps:
- name: Check All
id: check-all
continue-on-error: true
run: |-
for status in ${{ join(needs.*.result, ' ') }}
do
if [ "$status" != "success" ] && [ "$status" != "skipped" ]
then
echo "Some checks failed"
echo "state=failure" >> $GITHUB_OUTPUT
exit 1
fi
done
echo "state=success" >> $GITHUB_OUTPUT
# The `context` here MUST exactly match the one written by the
# `Post pending Summary status to PR commit` step in the `setup`
# job above so this final write overwrites that pending row
# instead of creating a duplicate.
- name: Report status to PR commit
if: ${{ always() && needs.setup.outputs.headSha }}
uses: actions/github-script@v7
env:
CHECK_STATE: ${{ steps.check-all.outputs.state }}
with:
script: |
const state = process.env.CHECK_STATE === 'success' ? 'success' : 'failure';
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: '${{ needs.setup.outputs.headSha }}',
state,
context: 'Summary',
target_url: `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`,
description: state === 'success' ? 'All checks passed' : 'Some checks failed',
});
- name: Fail the job if Check All failed
if: ${{ steps.check-all.outcome == 'failure' }}
run: exit 1