From 598eb3cfc58f6e520f7379aaec336f13dfc481d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Karao=C4=9Flu?= Date: Tue, 1 Dec 2026 11:29:21 +0300 Subject: [PATCH] Add local CI parity script with drift detection --- scripts/ci-local.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 scripts/ci-local.sh diff --git a/scripts/ci-local.sh b/scripts/ci-local.sh new file mode 100755 index 0000000..faf5356 --- /dev/null +++ b/scripts/ci-local.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" +CI_YML="$REPO_ROOT/.github/workflows/ci.yml" + +# ── Drift detection ────────────────────────────────────────────────── +# Extract every "uv run" command from CI, regardless of whether it appears +# on a single-line "- run:" step or inside a multi-line "run: |" block. +ci_commands=$(grep -oE 'uv run [^ ].*' "$CI_YML" | sort -u) + +local_commands=$(sort -u <<'COMMANDS' +uv run ruff check src/ tests/ +uv run ruff format --check src/ tests/ +uv run mypy src/ +uv run pyright src/ +uv run pytest -q +COMMANDS +) + +if [[ "$ci_commands" != "$local_commands" ]]; then + echo "ERROR: CI / local pipeline drift detected!" + echo "" + echo "In CI but not in this script:" + comm -23 <(echo "$ci_commands") <(echo "$local_commands") | sed 's/^/ + /' + echo "" + echo "In this script but not in CI:" + comm -13 <(echo "$ci_commands") <(echo "$local_commands") | sed 's/^/ - /' + echo "" + echo "Update scripts/ci-local.sh to match .github/workflows/ci.yml" + exit 1 +fi + +echo "✓ Pipeline parity verified" +echo "" + +# ── Checks (same order as CI) ─────────────────────────────────────── +echo "=== lint ===" +uv run ruff check src/ tests/ +uv run ruff format --check src/ tests/ +echo "" + +echo "=== typecheck ===" +uv run mypy src/ +uv run pyright src/ +echo "" + +echo "=== test ===" +uv run pytest -q +echo "" + +echo "All checks passed."