Files
ironclaw/.github/workflows/regression-test-check.yml
firat.sertgoz d03f815254 ci: bound Reborn PR validation latency (#7019)
* ci: share coverage compilation within Reborn buckets

* test: reuse prepared bundled WASM contracts

* ci: bound pull request validation latency

* ci: assign WebUI checks to Code Style

* ci: pair Reborn provider shards

* ci: isolate commented review concurrency

* ci: prove lockfile scope from structured diff

* ci: parallelize paired provider shards

* docs: describe concurrent provider pairs

* ci: share browser worker with fast contracts

* ci: bound pull request validation to ten minutes

* ci: scope PR lint and crate test targets

* ci: fold PR mutation selection into planning

* ci: preserve exact-target build settings

* test: bind exact-target workflow assertion

* ci: lint workspace dependency changes on PRs
2026-08-03 12:33:29 +00:00

122 lines
4.7 KiB
YAML

name: Regression Test Check
on:
pull_request:
pull_request_review:
types: [submitted, dismissed]
permissions:
contents: read
pull-requests: read
concurrency:
# A COMMENTED review is skipped below and must not cancel the ordinary PR
# run that is still producing its enforcement result.
group: regression-check-${{ github.event.pull_request.number }}-${{ github.event_name }}-${{ github.event.review.state == 'commented' && 'commented' || 'enforcing' }}
cancel-in-progress: true
jobs:
regression-test:
name: Regression test enforcement
# COMMENTED reviews do not alter approval state. Review bots can emit many
# of them in one burst, so rerunning the same gate for each comment only
# consumes queued workers. Submitted approvals/change requests and
# dismissed reviews still rerun the enforcement check.
if: github.event_name != 'pull_request_review' || github.event.review.state != 'commented'
runs-on: ubuntu-latest
steps:
- name: Checkout PR head for diffing
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Checkout trusted regression gate
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
with:
ref: ${{ github.event.pull_request.base.sha }}
path: gate
fetch-depth: 1
persist-credentials: false
- name: Resolve regression gate source
env:
EVENT_NAME: ${{ github.event_name }}
run: |
set -euo pipefail
gate_root=gate
if [[ ! -f "$gate_root/scripts/ci/regression-test-check.py" ]]; then
if [[ "$EVENT_NAME" != "pull_request" ]]; then
# The PR that introduces this checker can receive review events
# before its trusted base contains the script. Do not execute
# PR-controlled gate code on that event; the ordinary
# pull_request run remains the bootstrap enforcement result.
echo "GATE_AVAILABLE=false" >> "$GITHUB_ENV"
exit 0
fi
# One-time bootstrap for the PR that first adds the checker. The
# pull_request event has no secrets; review events never execute
# PR-controlled enforcement code.
gate_root=.
fi
echo "GATE_AVAILABLE=true" >> "$GITHUB_ENV"
echo "GATE_ROOT=$gate_root" >> "$GITHUB_ENV"
- name: Fetch PR base
if: env.GATE_AVAILABLE == 'true'
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
set -euo pipefail
git fetch --no-tags origin \
"+refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}"
- name: Collect current approving reviews
if: env.GATE_AVAILABLE == 'true'
id: reviews
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
approvers=$(
gh api --paginate \
"repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/reviews?per_page=100" |
jq -s -r '
(add // [])
| map(select(.state != "COMMENTED"))
| group_by(.user.login)
| map(max_by(.submitted_at))
| map(select(.state == "APPROVED") | .user.login)
| join(",")
'
)
echo "approvers=$approvers" >> "$GITHUB_OUTPUT"
- name: Check for a meaningful regression test or reviewed exemption
if: env.GATE_AVAILABLE == 'true'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
PR_APPROVERS: ${{ steps.reviews.outputs.approvers }}
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
python3 "$GATE_ROOT/scripts/ci/regression-test-check.py" \
--repo . \
--base "origin/${PR_BASE_REF}" \
--head "$PR_HEAD_SHA" \
--title "$PR_TITLE" \
--body "$PR_BODY" \
--labels "$PR_LABELS" \
--author "$PR_AUTHOR" \
--approving-reviewers "$PR_APPROVERS"
- name: Run regression-gate self-tests
if: env.GATE_AVAILABLE == 'true'
run: bash "$GATE_ROOT/scripts/ci/test-regression-test-check.sh"