Skip to content

Commit b2908dd

Browse files
committed
fix(ci): harden timeline gate evidence and file-size scope
1 parent d2aac7d commit b2908dd

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -555,19 +555,28 @@ jobs:
555555
556556
# The default build first. It is the one users get, and the arm that
557557
# caught the regression this gate exists for.
558+
DEFAULT_STATUS=0
558559
STUDIO_URL="http://localhost:5313/#project/timeline-virtualization" \
559560
TIMELINE_ROW_VIRTUALIZATION=off \
560561
TIMELINE_ELEMENT_COUNT=1000 \
561562
TIMELINE_TIER=ci \
562563
node packages/studio/tests/e2e/timeline-virtualization.mjs \
563-
| tee /tmp/timeline-gate-default.json
564+
| tee /tmp/timeline-gate-default.json \
565+
|| DEFAULT_STATUS=$?
564566
567+
VIRTUALIZED_STATUS=0
565568
STUDIO_URL="http://localhost:5314/#project/timeline-virtualization" \
566569
TIMELINE_ROW_VIRTUALIZATION=on \
567570
TIMELINE_ELEMENT_COUNT=50000 \
568571
TIMELINE_TIER=ci \
569572
node packages/studio/tests/e2e/timeline-virtualization.mjs \
570-
| tee /tmp/timeline-gate-virtualized.json
573+
| tee /tmp/timeline-gate-virtualized.json \
574+
|| VIRTUALIZED_STATUS=$?
575+
576+
if (( DEFAULT_STATUS != 0 || VIRTUALIZED_STATUS != 0 )); then
577+
echo "FAIL: default=${DEFAULT_STATUS}, virtualized=${VIRTUALIZED_STATUS}"
578+
exit 1
579+
fi
571580
- name: Upload gate evidence
572581
# The gate's whole output is machine-readable evidence, and a red run is
573582
# exactly when someone needs to read it. Keep it on failure too.
@@ -781,30 +790,24 @@ jobs:
781790
with:
782791
fetch-depth: 0
783792
- name: Check file sizes (max 600 lines)
784-
# Scoped to files THIS PR changed under packages/studio. Walking the
785-
# whole tree blamed every unrelated PR for pre-existing offenders.
786-
# Falls back to a full scan on push events (no base ref available)
787-
# so the rule still guards main.
793+
# Scope the check to files this event changed. Walking the whole tree
794+
# blames unrelated changes for pre-existing offenders.
788795
run: |
789796
set -e
790797
if [ -n "${{ github.base_ref }}" ]; then
791-
mapfile -t files < <(
792-
git diff --name-only --diff-filter=ACMR \
793-
"origin/${{ github.base_ref }}...HEAD" -- \
794-
'packages/studio/**/*.ts' 'packages/studio/**/*.tsx' \
795-
| grep -vE '\.(test|spec)\.(ts|tsx)$|\.generated\.' || true
796-
)
798+
range="origin/${{ github.base_ref }}...HEAD"
797799
else
798-
mapfile -t files < <(
799-
find packages/studio -path '*/node_modules' -prune -o \
800-
\( -name '*.ts' -o -name '*.tsx' \) -print \
801-
| grep -vE '\.(test|spec)\.(ts|tsx)$|\.generated\.'
802-
)
800+
range="${{ github.event.before }}..HEAD"
803801
fi
802+
mapfile -t files < <(
803+
git diff --name-only --diff-filter=ACMR "$range" -- \
804+
'packages/studio/**/*.ts' 'packages/studio/**/*.tsx' \
805+
| grep -vE '\.(test|spec)\.(ts|tsx)$|\.generated\.' || true
806+
)
804807
EXIT=0
805808
for f in "${files[@]}"; do
806809
[ -z "$f" ] && continue
807-
[ -f "$f" ] || continue # skip files deleted in this PR
810+
[ -f "$f" ] || continue # skip files deleted in this event
808811
lines=$(wc -l < "$f")
809812
if [ "$lines" -gt 600 ]; then
810813
echo "::error file=$f::$f has $lines lines (max 600)"

0 commit comments

Comments
 (0)