mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Add pre-push branch-skew guard and changed-spec e2e recipe (#1940)
Signed-off-by: Wes <wesbillman@users.noreply.github.com> Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
@@ -224,6 +224,11 @@ desktop-e2e-smoke:
|
||||
desktop-e2e-integration: _ensure-migrations
|
||||
cd {{desktop_dir}} && pnpm test:e2e:integration
|
||||
|
||||
# Run only the e2e specs changed vs origin/main (both projects) before pushing
|
||||
desktop-e2e-pre-push: _ensure-migrations
|
||||
git fetch origin main
|
||||
cd {{desktop_dir}} && pnpm build && pnpm exec playwright test --only-changed=origin/main
|
||||
|
||||
# Run all checks suitable for CI / pre-push (no infra needed)
|
||||
ci: check test-unit desktop-test desktop-build desktop-tauri-check desktop-tauri-test web-build mobile-test
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ pre-commit:
|
||||
pre-push:
|
||||
parallel: true
|
||||
commands:
|
||||
branch-skew:
|
||||
run: ./scripts/check-branch-skew.sh
|
||||
rust-tests:
|
||||
run: just test-unit
|
||||
desktop-check:
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pre-push guard: CI checks the PR merged with main, so local runs on a
|
||||
# skewed branch can pass while CI fails. Block the push only when
|
||||
# origin/main has changed files this branch also touches.
|
||||
set -euo pipefail
|
||||
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
if [ "$branch" = "main" ] || [ "$branch" = "HEAD" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git fetch --quiet origin main || true
|
||||
git rev-parse --verify --quiet origin/main >/dev/null || exit 0
|
||||
|
||||
base=$(git merge-base HEAD origin/main)
|
||||
if [ "$base" = "$(git rev-parse origin/main)" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
overlap=$(comm -12 \
|
||||
<(git diff --name-only "$base" origin/main -- | sort) \
|
||||
<(git diff --name-only "$base" HEAD -- | sort))
|
||||
|
||||
if [ -z "$overlap" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
{
|
||||
echo "Branch is behind origin/main, and main changed files this branch also touches:"
|
||||
echo "$overlap" | sed 's/^/ /'
|
||||
echo "Local checks ran on a tree CI will never test. Run 'git merge origin/main',"
|
||||
echo "resolve, re-run checks, then push."
|
||||
} >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user