.PHONY: format lint clean_html_report docker_run_step_function_tests step_function_tests

# Root directory of the tests: lambda-asset-tools/tests
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

format:
	ruff check . *.py --fix
	ruff format . *.py

lint:
	ruff check . *.py
	ruff format . *.py --check --diff
	yamllint -s docker-compose.yaml
	mypy sfn_integration_tests/ utils/ config.py

clean_html_report:
	rm -r report || true
	mkdir report


step_function_tests: ## Run step function integration tests
	@echo "▶ Running step function integration tests"
	pytest $(ROOT_DIR)/sfn_integration_tests/test*.py --html=report/sfn_integration_tests.html --self-contained-html

docker_run_step_function_tests: clean_html_report
	@echo "Building the step-function-tests image for step function integration tests..."
	docker compose build step-function-tests
	@echo "Running Step Function Integration Tests in Docker..."
	docker compose up step-function-tests --exit-code-from step-function-tests
