.PHONY: pip_dev dev trace-dev lint test test_unit pip_test_integration test_integration clean clean_test_integration docker_unit_lint up_dev down_dev up_deploy down_deploy
.PHONY: ci_unit_lint_clean ci_unit_lint
.PHONY: up down up_dev down_dev up_deploy down_deploy
.PHONY: docker_integration_test down_integration ci_test_integration ci_test_integration_clean

dev:
	python dev.py

test:
	py.test tests/ --cov promo_player --cov-report term-missing

lint:
	flake8 promo_player/ tests/

pip_dev:
	pip install --upgrade pip
	pip install -r requirements.txt
	pip install -r requirements-dev.txt

up_dev:
	docker compose up \
		--build \
		--detach \
		--remove-orphans \
		bff-promo-player-dev

down_dev:
	docker compose down \
		bff-promo-player-dev

docker_unit_lint:  # Run lint and unit tests in Docker
	docker compose up \
		--build \
		--exit-code-from unit-lint \
		--abort-on-container-exit \
		--remove-orphans \
		unit-lint

down_unit_lint:  # Teardown any remaining Docker containers related to lint and unit tests
	docker compose down unit-lint --remove-orphans

docker_unit_lint_clean: down_unit_lint  # Teardown lint and unit tests in CI/CD
	rm -rf build
	
docker_test_integration:
	docker compose up \
		--build \
		--exit-code-from integration-test \
		--abort-on-container-exit \
		--remove-orphans \
		integration-test
