@@ -130,7 +130,7 @@ jobs:
130130 run : |
131131 node <<'NODE'
132132 const fs = require('node:fs');
133- const known = ['front-door-conformance', 'verify-integration-build', 'test', 'canary-go', 'impacted-go-tests', 'native-javascript-tests', 'build', 'build-wasm', 'validate-yaml', 'bench', ' check-validator-sizes', 'lint-go-format', 'lint-go-golangci', 'lint-go-govulncheck', 'lint-go-custom', 'lint-error-messages', 'actions-build', 'fuzz', 'security', 'security-scan', 'mcp-server-compile-test', 'cross-platform-build', 'alpine-container-test', 'safe-outputs-conformance'];
133+ const known = ['front-door-conformance', 'verify-integration-build', 'test', 'canary-go', 'impacted-go-tests', 'native-javascript-tests', 'build', 'build-wasm', 'validate-yaml', 'check-validator-sizes', 'lint-go-format', 'lint-go-golangci', 'lint-go-govulncheck', 'lint-go-custom', 'lint-error-messages', 'actions-build', 'fuzz', 'security', 'security-scan', 'mcp-server-compile-test', 'cross-platform-build', 'alpine-container-test', 'safe-outputs-conformance'];
134134 const dependencies = {test: ['verify-integration-build'], 'canary-go': ['test'], security: ['build'], 'security-scan': ['build'], 'cross-platform-build': ['build']};
135135 let suiteIds = '';
136136 try {
@@ -1278,182 +1278,6 @@ jobs:
12781278
12791279 core.info(`✅ ${CONFIG_FILE} passes all structural and cross-row invariant checks`);
12801280
1281- bench :
1282- # PR relevance comes from frontdoor; retain main-only performance tracking otherwise.
1283- if : always() && !cancelled() && needs.checkout-cache.result == 'success' && (github.event_name == 'pull_request' || github.ref == 'refs/heads/main') && (github.event_name != 'pull_request' || needs.front-door-decision.result != 'success' || !needs.front-door-decision.outputs.suite_ids || contains(fromJSON(needs.front-door-decision.outputs.suite_ids), 'bench'))
1284- needs : [checkout-cache, front-door-decision]
1285- runs-on : ubuntu-latest
1286- timeout-minutes : 20
1287- permissions :
1288- contents : read
1289- actions : read
1290- concurrency :
1291- group : ci-${{ github.ref }}-bench
1292- cancel-in-progress : true
1293- steps :
1294- - name : Restore checkout
1295- id : restore-checkout
1296- uses : actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
1297- with :
1298- path : .
1299- key : checkout-cgo-${{ github.run_id }}-${{ github.sha }}
1300- - name : Checkout on cache miss
1301- if : steps.restore-checkout.outputs.cache-hit != 'true'
1302- uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1303- with :
1304- ref : ${{ github.sha }}
1305- fetch-depth : 2
1306- persist-credentials : false
1307-
1308- - name : Set up Go
1309- id : setup-go
1310- uses : actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v6
1311- with :
1312- go-version-file : go.mod
1313- cache : true
1314-
1315- - name : Report Go cache status
1316- run : |
1317- if [ "${{ steps.setup-go.outputs.cache-hit }}" == "true" ]; then
1318- echo "✅ Go cache hit" >> $GITHUB_STEP_SUMMARY
1319- else
1320- echo "⚠️ Go cache miss" >> $GITHUB_STEP_SUMMARY
1321- fi
1322-
1323- - name : Download dependencies with retry
1324- if : steps.setup-go.outputs.cache-hit != 'true'
1325- run : |
1326- set -e
1327- MAX_RETRIES=3
1328- RETRY_DELAY=5
1329-
1330- for i in $(seq 1 $MAX_RETRIES); do
1331- echo "Attempt $i of $MAX_RETRIES: Downloading Go modules..."
1332- if go mod download; then
1333- echo "✅ Successfully downloaded Go modules"
1334- break
1335- else
1336- if [ $i -eq $MAX_RETRIES ]; then
1337- echo "❌ Failed to download Go modules after $MAX_RETRIES attempts"
1338- echo "This may indicate that proxy.golang.org is unreachable"
1339- echo "Please check network connectivity or consider vendoring dependencies"
1340- exit 1
1341- fi
1342- echo "⚠️ Download failed, retrying in ${RETRY_DELAY}s..."
1343- sleep $RETRY_DELAY
1344- fi
1345- done
1346-
1347- - name : Verify dependencies
1348- run : go mod verify
1349-
1350- - name : Install benchstat
1351- run : go install golang.org/x/perf/cmd/benchstat@v0.0.0-20260615155930-9e4b9ddef5b6
1352-
1353- - name : Download previous benchmark baseline
1354- id : baseline
1355- env :
1356- GH_TOKEN : ${{ github.token }}
1357- run : |
1358- set +e
1359- echo "Looking for previous benchmark-results artifact..."
1360- # The bench job only runs on main, so any benchmark-results artifact is from main.
1361- # The artifacts API includes workflow_run.head_branch; filter for main as an extra safeguard.
1362- artifact_id=$(gh api \
1363- "repos/$GITHUB_REPOSITORY/actions/artifacts?name=benchmark-results&per_page=10" \
1364- --jq '[.artifacts[] | select(.workflow_run.head_branch? == "main")] | .[0].id // empty' 2>/dev/null)
1365-
1366- if [ -n "$artifact_id" ]; then
1367- echo "Found artifact ID: $artifact_id"
1368- mkdir -p baseline
1369- if gh api "repos/$GITHUB_REPOSITORY/actions/artifacts/$artifact_id/zip" \
1370- --output baseline.zip 2>/dev/null; then
1371- if unzip -q baseline.zip -d baseline 2>/dev/null && [ -f baseline/bench_results.txt ]; then
1372- echo "✅ Downloaded baseline benchmark results"
1373- echo "has_baseline=true" >> "$GITHUB_OUTPUT"
1374- else
1375- echo "⚠️ Failed to extract baseline artifact or bench_results.txt not found"
1376- echo "has_baseline=false" >> "$GITHUB_OUTPUT"
1377- fi
1378- else
1379- echo "⚠️ Failed to download baseline artifact"
1380- echo "has_baseline=false" >> "$GITHUB_OUTPUT"
1381- fi
1382- else
1383- echo "ℹ️ No previous benchmark results found — skipping regression check on first run"
1384- echo "has_baseline=false" >> "$GITHUB_OUTPUT"
1385- fi
1386-
1387- - name : Run benchmarks
1388- run : make bench
1389-
1390- - name : Run benchstat regression check
1391- if : steps.baseline.outputs.has_baseline == 'true'
1392- run : |
1393- echo "## 📈 Benchmark Regression Check" >> $GITHUB_STEP_SUMMARY
1394- echo "" >> $GITHUB_STEP_SUMMARY
1395-
1396- if ! benchstat_out=$(benchstat baseline/bench_results.txt bench_results.txt 2>&1); then
1397- echo "$benchstat_out"
1398- echo '```' >> $GITHUB_STEP_SUMMARY
1399- echo "$benchstat_out" >> $GITHUB_STEP_SUMMARY
1400- echo '```' >> $GITHUB_STEP_SUMMARY
1401- echo "" >> $GITHUB_STEP_SUMMARY
1402- echo "❌ **benchstat failed to compare benchmark results.** Check the output above." >> $GITHUB_STEP_SUMMARY
1403- echo "::error::benchstat failed to compare benchmark results"
1404- exit 1
1405- fi
1406-
1407- echo "$benchstat_out"
1408-
1409- echo '```' >> $GITHUB_STEP_SUMMARY
1410- echo "$benchstat_out" >> $GITHUB_STEP_SUMMARY
1411- echo '```' >> $GITHUB_STEP_SUMMARY
1412-
1413- # Fail if any benchmark regresses by more than 10%.
1414- # benchstat uses + for slower time (regression) and - for faster time (improvement).
1415- REGRESSION=false
1416- while IFS= read -r line; do
1417- if [[ "$line" =~ \+([0-9]+(\.[0-9]+)?)% ]]; then
1418- pct="${BASH_REMATCH[1]}"
1419- if awk -v p="$pct" 'BEGIN {exit !(p > 10)}'; then
1420- echo "❌ Regression: $line"
1421- REGRESSION=true
1422- fi
1423- fi
1424- done <<< "$benchstat_out"
1425-
1426- if [ "$REGRESSION" = "true" ]; then
1427- echo "" >> $GITHUB_STEP_SUMMARY
1428- echo "❌ **Performance regression >10% detected.** See comparison above." >> $GITHUB_STEP_SUMMARY
1429- echo "::error::Performance regression >10% detected — see benchstat output above"
1430- exit 1
1431- else
1432- echo "" >> $GITHUB_STEP_SUMMARY
1433- echo "✅ No significant performance regressions detected." >> $GITHUB_STEP_SUMMARY
1434- echo "✅ No regressions detected"
1435- fi
1436-
1437- - name : Display benchmark summary
1438- run : |
1439- echo "## 📊 Benchmark Results" >> $GITHUB_STEP_SUMMARY
1440- echo "" >> $GITHUB_STEP_SUMMARY
1441- echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
1442- # Show compiler benchmarks from the results
1443- grep "BenchmarkCompile" bench_results.txt | head -20 >> $GITHUB_STEP_SUMMARY || echo "No benchmark results found" >> $GITHUB_STEP_SUMMARY
1444- echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
1445- echo "" >> $GITHUB_STEP_SUMMARY
1446- echo "📁 Full results saved to artifact: benchmark-results" >> $GITHUB_STEP_SUMMARY
1447-
1448- # Benchmark results for performance trend analysis - 14 days allows comparison across multiple runs
1449- - name : Save benchmark results
1450- uses : actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
1451- with :
1452- name : benchmark-results
1453- path : bench_results.txt
1454- if-no-files-found : ignore
1455- retention-days : 14
1456-
14571281 check-validator-sizes :
14581282 name : Check validator file sizes
14591283 needs : [checkout-cache, front-door-decision]
@@ -3031,7 +2855,6 @@ jobs:
30312855 - build
30322856 - build-wasm
30332857 - validate-yaml
3034- - bench
30352858 - check-validator-sizes
30362859 - lint-go-format
30372860 - lint-go-golangci
0 commit comments