diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed5519e5..d8c11c2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,10 +119,15 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 22 + - name: Ensure Python tooling test dependencies + run: | + if ! command -v rg >/dev/null 2>&1; then + sudo apt-get update + sudo apt-get install --no-install-recommends -y ripgrep + fi - name: Test release verification tooling run: | - python3 -m unittest scripts.tests.test_verify_public_release scripts.tests.test_collect_release_bundle scripts.tests.test_release_readiness scripts.tests.test_release_publication scripts.tests.test_check_markdown_links - python3 -m py_compile scripts/verify_public_release.py scripts/collect_release_bundle.py scripts/release_readiness.py scripts/release_publication.py scripts/release_operator.py scripts/check_markdown_links.py + bash scripts/test_python_tooling.sh python3 scripts/release_operator.py --help >/dev/null python3 scripts/release_operator.py preflight --help >/dev/null python3 scripts/release_operator.py readiness-start --help >/dev/null diff --git a/scripts/release_check.sh b/scripts/release_check.sh index 33d3bdf8..6ac03a6d 100755 --- a/scripts/release_check.sh +++ b/scripts/release_check.sh @@ -160,8 +160,7 @@ done # Stage 9: release verification tooling self-tests # ---------------------------------------------------------------------------- stage_start "release verification tooling self-tests" -if python3 -m unittest scripts.tests.test_verify_public_release scripts.tests.test_collect_release_bundle scripts.tests.test_release_readiness scripts.tests.test_release_publication scripts.tests.test_check_markdown_links \ - && python3 -m py_compile scripts/verify_public_release.py scripts/collect_release_bundle.py scripts/release_readiness.py scripts/release_publication.py scripts/release_operator.py scripts/check_markdown_links.py \ +if bash scripts/test_python_tooling.sh \ && python3 scripts/release_operator.py --help >/dev/null \ && python3 scripts/release_operator.py preflight --help >/dev/null \ && python3 scripts/release_operator.py reclaim-tag --help >/dev/null \ diff --git a/scripts/test_python_tooling.sh b/scripts/test_python_tooling.sh new file mode 100644 index 00000000..52a8ba72 --- /dev/null +++ b/scripts/test_python_tooling.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) +cd "$ROOT" + +python3 - <<'PY' +from pathlib import Path + +paths = sorted(Path("scripts").rglob("*.py")) +for path in paths: + source = path.read_bytes() + compile(source, str(path), "exec") +print(f"syntax-checked {len(paths)} Python files under scripts/") +PY + +python3 -m unittest discover \ + --start-directory scripts/tests \ + --pattern 'test_*.py'