# Add any tasks that are not dependent on files to the .PHONY list.
.PHONY: dev pip_dev lint test test_unit test_integration clean

dev:
	python3.13 dev.py

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

lint:
	python3.13 -m flake8 salessheets/ tests/ dev.py

test:
	pytest tests/  \
		--cov salessheets \
		--cov-report term-missing

test_unit:
	pytest -v --ignore=tests/integration/ \
		--cov salessheets tests \
		--cov-report xml \
		--junitxml=pyunit.xml

test_integration:
	pytest -v \
		--cov salessheets tests/integration \
		--cov-report xml \
		--junitxml=pyunit.xml

clean:
	rm -rf \
		env \
		.coverage \
		.pytest_cache \
		.cache \
		coverage.xml \
		pyunit.xml
	find . | grep -E '__pycache__|\.pyc|\.pyo$\' | xargs rm -rf

docker_dev:
	docker compose up --build dev

docker_down:
	docker compose down --remove-orphans

docker_unit_lint:
	docker compose up \
    	--exit-code-from unit-lint \
    	--abort-on-container-exit \
    	--build unit-lint

docker_test_integration:
	docker compose up \
		--build \
		--exit-code-from test-integration \
		--abort-on-container-exit \
		--remove-orphans \
		test-integration