.PHONY: pip_dev lint test run clean deploy_deps deploy_dev deploy_qa deploy_prod

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

lint: sync_env/ tests/ run.py
	env/bin/flake8 sync_env/ tests/ run.py

test: tests/
	env/bin/pytest -v tests/ \
		--cov-config .coveragerc \
		--cov ./ \
		--cov-report xml \
		--junitxml=pyunit.xml

html_coverage: tests/
	rm -rf htmlcov
	env/bin/pytest -v tests/ \
		--cov-config .coveragerc \
		--cov ./ \
		--cov-report html

dev run:
	env/bin/python run.py

clean:
	rm -rf env

deploy_deps:
	python3.6 -m venv env
	env/bin/pip install botocore==1.15.1
	env/bin/pip install -r requirements.txt

deploy_dev:
	ENV=dev ../../build/deploy.sh

deploy_qa:
	ENV=qa ../../build/deploy.sh

deploy_prod:
	ENV=prod ../../build/deploy.sh
