_default:
    @just --list --justfile {{justfile()}}

# Run tests exactly as in CI
test:
    uv sync --locked --extra test
    uv run coverage run -m pytest
    uv run coverage report
    uv run coverage xml

# Publish a GitLab release
publish tag:
    # Checking git status
    @if [ "$(git branch --show-current)" != "main" ]; then echo "error: not on main branch"; exit 1; fi
    @if git status --porcelain | grep -q .; then echo "error: working tree is dirty"; exit 1; fi
    @git log --oneline --no-decorate -1
    @echo "Tagging as {{tag}}"

    @glab auth status

    # Create GitLab release with tag
    @glab release create "{{tag}}" --ref main --notes "Release {{tag}}"
