.PHONY: pip_dev dev lint test test_unit pip_test_integration test_integration clean clean_test_integration

venv pip_dev:
	python3.8 -m venv venv
	venv/bin/pip3 install --upgrade pip
	venv/bin/pip3 install -r requirements.txt
	venv/bin/pip3 install -r requirements-dev.txt

dev: venv
	venv/bin/python3.8 dev.py

lint: venv
	venv/bin/flake8 dataexport/ tests/ dev.py application.py

test: venv
	venv/bin/py.test tests/unit/

test_unit: venv
	venv/bin/py.test \
		--cov dataexport/ tests/unit/ \
		--cov-report xml \
		--junitxml=pyunit.xml

type_check: venv
	venv/bin/mypy --strict dataexport

tests/integration/venv pip_test_integration:
	python3.8 -m venv tests/integration/venv
	tests/integration/venv/bin/pip3 install --upgrade pip
	tests/integration/venv/bin/pip3 install -r tests/integration/requirements.txt

test_integration: tests/integration/venv
	tests/integration/venv/bin/py.test tests/integration

clean:
	rm -rf venv

clean_test_integration:
	rm -rf tests/integration/venv
