.PHONY: check test local-up local-fixtures local-acceptance local-clean-start polaris-up polaris-fixtures polaris-test jdbc-up jdbc-fixtures jdbc-test hive-up hive-fixtures hive-test glue-test

check:
	uv run ruff check .
	uv run mypy src
	uv run pytest -W error::ResourceWarning

test:
	uv run pytest

local-up:
	docker compose up -d --wait

local-fixtures:
	uv run python scripts/create_fixtures.py --stage all

local-acceptance:
	uv run python scripts/verify_local.py

local-clean-start:
	@test "$${CONFIRM_LOCAL_CLEAN:-}" = "1" || (echo "Set CONFIRM_LOCAL_CLEAN=1 to remove local Docker volumes"; exit 1)
	docker compose down --volumes --remove-orphans
	docker compose up -d --wait
	uv run python scripts/create_fixtures.py --stage all
	uv run python scripts/verify_local.py

polaris-up:
	docker compose -f docker-compose.polaris.yml up -d --wait

polaris-fixtures:
	uv run python scripts/create_fixtures.py --catalog-uri http://localhost:18181/api/catalog --warehouse berg_local --stage all

polaris-test:
	BERG_RUN_POLARIS_INTEGRATION=1 uv run pytest tests/integration/test_polaris_catalog.py

jdbc-up:
	docker compose -f docker-compose.jdbc.yml up -d --wait

jdbc-fixtures:
	uv run python scripts/create_fixtures.py --catalog-type sql --catalog-name jdbc --catalog-uri postgresql+psycopg2://berg:berg@localhost:25432/iceberg --warehouse s3://warehouse/ --stage all

jdbc-test:
	BERG_RUN_JDBC_INTEGRATION=1 uv run pytest tests/integration/test_jdbc_catalog.py

hive-up:
	docker compose -f docker-compose.hive.yml up -d --wait

hive-fixtures:
	uv run python scripts/create_fixtures.py --catalog-type hive --catalog-name hive --catalog-uri thrift://localhost:39083 --warehouse file:///home/nikos/Documents/Coding/Berg/.berg/hive-warehouse --stage all

hive-test:
	BERG_RUN_HIVE_INTEGRATION=1 uv run pytest tests/integration/test_hive_catalog.py

glue-test:
	BERG_RUN_AWS_INTEGRATION=1 uv run pytest tests/integration/test_glue_catalog.py
