DATE_TODAY := $(shell date +%Y-%m-%d)
DIST_DIR := dist
PACKAGE ?= $(DIST_DIR)/$(DATE_TODAY)-octopus.zip

.PHONY: build
build:
	@rm -f assets/octopus-*.whl
	@python -m build
	@mv dist/octopus-*.whl assets/
	@rm -rf dist/

.PHONY: docs-build
docs-build:
	@mkdocs build

.PHONY: docs-serve
docs-serve:
	@mkdocs serve -a localhost:6222

.PHONY: install
install:
	@pip install -r requirements-dev.txt
	@pre-commit install
	@pre-commit install --hook-type commit-msg
	@pip install -e .
	@ansible-galaxy install -r deployment/ansible/requirements.yml

.PHONY: lint
lint:
	@black .
	@isort .
	@find . -type f -name "*.py" ! -path "./common/*" -exec docformatter -i {} \;
	@find . -type f -name "*.py" ! -path "./common/*" -exec pydocstyle {} \;
	@flake8 .
	@bandit -c=.bandit.yml -r .
	@pylint .
	@mypy .
	@pytest --cov --cov-report=html

.PHONY: release
release:
	deployment/ansible/files/export-repo.sh
