.PHONY: check test build wheel-smoke pypi-check pypi format

PYPI_CHECK_URL ?= https://pypi.org/simple/acorn-py/

check:
	pixi lock --check
	pixi run -e py313 lint

test:
	pixi run -e py310 test
	pixi run -e py313 test

build:
	pixi run -e py313 build

wheel-smoke:
	pixi run -e py313 wheel-smoke

pypi-check:
	@test -n "$$(find dist -maxdepth 1 -type f -name '*.whl' -print -quit 2>/dev/null)" || (echo "No wheels found in dist/. Run make build or download CI artifacts first." >&2; exit 1)
	pixi run -e py313 uv publish --trusted-publishing never --dry-run dist/*

pypi: pypi-check
	@test -n "$$UV_PUBLISH_TOKEN" || (echo "UV_PUBLISH_TOKEN is required." >&2; exit 1)
	pixi run -e py313 uv publish --trusted-publishing never --check-url "$(PYPI_CHECK_URL)" dist/*

format:
	pixi run -e py313 format
