.PHONY: env install format lint clean_html_report docker_run_tests test

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

VENV := .venv
export PATH := $(VENV)/bin:$(PATH)

env:
	python3 -m venv $(VENV)

install: env
	python3 -m pip install --upgrade pip
	python3 -m pip install -r requirements.txt

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/

clean_html_report:
	rm -r report || true
	mkdir report

test: ## Run step function integration tests
	@echo "▶ Running step function integration tests"
	pytest $(ROOT_DIR)/sfn_integration_tests/test_step_function.py

docker_run_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

clean:
	rm -rf $(VENV)
