.PHONY: install test runtime-run conformance container-build ecosystem-regression inventory-check package-check ci-check

UV ?= uv
ECOSYSTEM_REGRESSION ?= /home/worsch/the-custodian/scripts/hub-ecosystem-regression.sh
IMAGE_REPOSITORY ?= forgejo.coulomb.social/coulomb/hub-core
IMAGE_TAG ?= dev

install:
	$(UV) sync

test:
	$(UV) run --locked --extra runtime python -m pytest -q

runtime-run:
	$(UV) run --extra runtime hub-core api

conformance:
	$(UV) run hub-core conformance --base-url $${HUB_CORE_API_BASE:-http://127.0.0.1:8010}

container-build:
	docker build -f Containerfile -t $(IMAGE_REPOSITORY):$(IMAGE_TAG) .

ecosystem-regression:
	bash $(ECOSYSTEM_REGRESSION)

# Local equivalents of the required CI gates.
inventory-check:
	$(UV) run --locked --extra runtime python tools/build_access_inventory.py --inventory docs/platform-access-inventory.json --check

package-check:
	$(UV) build --out-dir dist/ci
	@set -eu; set -- dist/ci/*.whl; test "$$#" -eq 1; $(UV) run --no-project --isolated --refresh-package hub-core --with "$$1" python -I tools/check_installed_package.py

ci-check: test inventory-check package-check
