#!/bin/sh

set -ex

if [ -z $GITHUB_ACTIONS ]; then
    scripts/check
fi

# TODO: Remove this custom logic, and add `branch = true` to the `[coverage.run]` when we drop support for Python 3.9.
# See https://github.com/Kludex/starlette/issues/2452.
branch_option=$(uv run python -c 'import sys; print("--branch" if sys.version_info >= (3, 10) else "")')
uv run coverage run $branch_option -m pytest $@

if [ -z $GITHUB_ACTIONS ]; then
    scripts/coverage
fi
