From 2a6ccc150f3a0c62071c4e131653d8efb9b034a8 Mon Sep 17 00:00:00 2001 From: Alireza Date: Wed, 20 May 2026 09:53:39 -0400 Subject: [PATCH] ci: seed CodSpeed baseline on main pushes and workflow_dispatch The current detect-changes job short-circuits when HEAD === origin/main: git diff origin/main..HEAD is empty, so any=false and every downstream job (including codspeed-bench) is skipped. That left CodSpeed with no baseline data on main after #64 merged, so every PR comment stays stuck on "Congrats! CodSpeed is installed" with no before/after deltas. Two fixes: - Drop branches-ignore: main so every commit landing on main triggers a build/test/bench run. Future merges will auto-seed the baseline. - In detect-changes, treat workflow_dispatch or any push to refs/heads/main as a "baseline run" and force the full package list, bypassing the diff check that vacuously returns empty when HEAD is main. After this lands, dispatching pr-checks against main (or just pushing this fix to main) will populate the CodSpeed baseline, and PR #66's codspeed-bench will start producing a real regression report on re-run. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/pr-checks.yml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index fe9609c..8286609 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -11,8 +11,11 @@ name: PR checks on: pull_request: push: - branches-ignore: - - main + # Run on every branch including main so each merge to main seeds a + # fresh CodSpeed baseline. Without a main run, PR comments stay stuck + # on "Congrats! CodSpeed is installed" with no before/after deltas. + branches: + - "**" # workflow_dispatch lets CodSpeed trigger a backtest run from the # dashboard (to seed initial perf data after the repo is connected). workflow_dispatch: @@ -43,11 +46,28 @@ jobs: fetch-depth: 0 - id: list name: List changed packages + env: + EVENT_NAME: ${{ github.event_name }} + REF: ${{ github.ref }} run: | set -e + ALL=(charls libjpeg-turbo-8bit libjpeg-turbo-12bit openjpeg openjphjs little-endian big-endian dicom-codec) + + # Baseline runs: on a manual dispatch or any commit landing on + # main, build/test/bench every package. The "diff vs main" trick + # only makes sense on PR/feature branches — when HEAD === main, + # `git diff origin/main..HEAD` is empty and would skip CodSpeed + # entirely, leaving the dashboard with no baseline data. + if [ "$EVENT_NAME" = "workflow_dispatch" ] || [ "$REF" = "refs/heads/main" ]; then + json=$(printf '%s\n' "${ALL[@]}" | jq -R . | jq -s -c .) + echo "Baseline run ($EVENT_NAME on $REF): forcing all packages" + echo "packages=$json" >> "$GITHUB_OUTPUT" + echo "any=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + git fetch --no-tags --depth=50 origin main || true BASE=$(git merge-base origin/main HEAD || echo "origin/main") - ALL=(charls libjpeg-turbo-8bit libjpeg-turbo-12bit openjpeg openjphjs little-endian big-endian dicom-codec) changed=() for pkg in "${ALL[@]}"; do if ! git diff --quiet "$BASE"..HEAD -- "packages/$pkg/"; then