#!/bin/bash
# Runs the full quality-gate suite inside the unit-lint Docker image.
# JUnit output is written to build/ which CI mounts as a volume so Jenkins
# can publish the results.

set -e

mkdir -p build

echo 'Running ruff (lint)...'
uv run --no-sync ruff check . --no-cache

echo 'Running ruff (format check)...'
uv run --no-sync ruff format --check . --no-cache

echo 'Running ty (type check)...'
uv run --no-sync ty check stale_pr_review/

echo 'Running vulture (dead code)...'
uv run --no-sync vulture stale_pr_review

# core.py sys.exit(1)s at import if no GitHub token is set, so tests need a
# dummy one even though no live API calls are made.
echo 'Running tests...'
GH_TOKEN=dummy PYTHONDONTWRITEBYTECODE=1 uv run --no-sync pytest -v tests/ \
    -p no:cacheprovider \
    --junitxml=build/pyunit.xml

echo 'Done!'
