2019-11-15 12:17:57 +02:00
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
|
2019-11-16 22:32:26 +02:00
|
|
|
base_python := python3.7
|
|
|
|
|
py := poetry run
|
|
|
|
|
python := $(py) python
|
2019-11-15 12:17:57 +02:00
|
|
|
|
|
|
|
|
.PHONY: help
|
|
|
|
|
help:
|
|
|
|
|
@echo "======================================================================================="
|
|
|
|
|
@echo " aiogram build tools "
|
|
|
|
|
@echo "======================================================================================="
|
2019-11-15 12:44:24 +02:00
|
|
|
@echo "Environment:"
|
2019-11-15 12:17:57 +02:00
|
|
|
@echo " install: Install development dependencies"
|
2019-11-15 12:44:24 +02:00
|
|
|
@echo ""
|
|
|
|
|
@echo "Code quality:"
|
2019-11-15 12:17:57 +02:00
|
|
|
@echo " isort: Run isort tool"
|
|
|
|
|
@echo " black: Run black tool"
|
|
|
|
|
@echo " flake8: Run flake8 tool"
|
|
|
|
|
@echo " mypy: Run mypy tool"
|
|
|
|
|
@echo " lint: Run isort, black, flake8 and mypy tools"
|
|
|
|
|
@echo ""
|
2019-11-15 12:44:24 +02:00
|
|
|
@echo "Tests:"
|
|
|
|
|
@echo " test: Run tests"
|
2019-11-17 23:40:52 +02:00
|
|
|
@echo " build-testcov: Build coverage as HTML"
|
2019-11-15 12:44:24 +02:00
|
|
|
@echo ""
|
2019-11-15 14:11:50 +02:00
|
|
|
@echo "Documentation:"
|
|
|
|
|
@echo " docs: Build docs"
|
|
|
|
|
@echo " docs-serve: Serve docs for local development"
|
2019-11-15 12:44:24 +02:00
|
|
|
@echo ""
|
2019-11-15 12:17:57 +02:00
|
|
|
@echo ""
|
|
|
|
|
|
2019-11-15 14:21:35 +02:00
|
|
|
# =================================================================================================
|
|
|
|
|
# Environment
|
|
|
|
|
# =================================================================================================
|
|
|
|
|
|
2019-11-15 12:17:57 +02:00
|
|
|
.PHONY: install
|
|
|
|
|
install:
|
2019-11-16 22:32:26 +02:00
|
|
|
$(base_python) -m pip install --user -U poetry
|
2019-11-15 12:17:57 +02:00
|
|
|
poetry install
|
2017-10-22 18:36:13 +03:00
|
|
|
|
2019-11-15 14:21:35 +02:00
|
|
|
.PHONY: clean
|
|
|
|
|
clean:
|
|
|
|
|
rm -rf `find . -name __pycache__`
|
|
|
|
|
rm -f `find . -type f -name '*.py[co]' `
|
|
|
|
|
rm -f `find . -type f -name '*~' `
|
|
|
|
|
rm -f `find . -type f -name '.*~' `
|
|
|
|
|
rm -rf *.egg-info
|
|
|
|
|
rm -f .coverage
|
2019-11-17 23:40:52 +02:00
|
|
|
rm -f report.html
|
2019-11-15 14:21:35 +02:00
|
|
|
rm -f .coverage.*
|
2019-11-17 23:40:52 +02:00
|
|
|
rm -rf {build,dist,site,.cache,.pytest_cache,.mypy_cache,reports}
|
2019-11-15 14:21:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# =================================================================================================
|
|
|
|
|
# Code quality
|
|
|
|
|
# =================================================================================================
|
|
|
|
|
|
2019-11-15 12:17:57 +02:00
|
|
|
.PHONY: isort
|
|
|
|
|
isort:
|
2019-11-16 22:32:26 +02:00
|
|
|
$(py) isort -rc aiogram tests
|
2017-11-15 18:51:29 +02:00
|
|
|
|
2019-11-15 12:17:57 +02:00
|
|
|
.PHONY: black
|
|
|
|
|
black:
|
2019-11-16 22:32:26 +02:00
|
|
|
$(py) black aiogram tests
|
2017-12-01 01:59:15 +02:00
|
|
|
|
2019-11-15 12:17:57 +02:00
|
|
|
.PHONY: flake8
|
|
|
|
|
flake8:
|
2019-11-17 23:47:52 +02:00
|
|
|
mkdir -p reports/flake8
|
2019-11-17 23:40:52 +02:00
|
|
|
$(py) flake8 --format=html --htmldir=reports/flake8 aiogram test
|
2017-12-01 02:14:49 +02:00
|
|
|
|
2019-11-15 12:17:57 +02:00
|
|
|
.PHONY: mypy
|
|
|
|
|
mypy:
|
2019-11-17 23:40:52 +02:00
|
|
|
$(py) mypy aiogram tests --html-report reports/typechecking
|
2017-12-01 02:28:25 +02:00
|
|
|
|
2019-11-15 12:17:57 +02:00
|
|
|
.PHONY: lint
|
|
|
|
|
lint: isort black flake8 mypy
|
2019-11-15 12:44:24 +02:00
|
|
|
|
|
|
|
|
|
2019-11-15 14:21:35 +02:00
|
|
|
# =================================================================================================
|
|
|
|
|
# Tests
|
|
|
|
|
# =================================================================================================
|
|
|
|
|
|
2019-11-15 12:44:24 +02:00
|
|
|
.PHONY: test
|
|
|
|
|
test:
|
2019-11-17 23:40:52 +02:00
|
|
|
mkdir -p reports/tests/
|
|
|
|
|
$(py) pytest --cov=aiogram --cov-config .coveragerc --html=reports/tests/report.html tests/
|
2019-11-15 14:11:50 +02:00
|
|
|
|
2019-11-17 23:40:52 +02:00
|
|
|
.PHONY: build-testcov
|
|
|
|
|
build-testcov:
|
|
|
|
|
$(py) coverage html -d reports/coverage
|
2019-11-15 14:21:35 +02:00
|
|
|
|
|
|
|
|
# =================================================================================================
|
|
|
|
|
# Docs
|
|
|
|
|
# =================================================================================================
|
|
|
|
|
|
2019-11-15 14:11:50 +02:00
|
|
|
.PHONY: docs
|
|
|
|
|
docs:
|
2019-11-16 22:32:26 +02:00
|
|
|
$(py) mkdocs build
|
2019-11-15 14:11:50 +02:00
|
|
|
|
|
|
|
|
.PHONY: docs-serve
|
|
|
|
|
docs-serve:
|
2019-11-16 22:32:26 +02:00
|
|
|
$(py) mkdocs serve
|
2019-11-17 23:40:52 +02:00
|
|
|
|
|
|
|
|
.PHONY: docs-copy-reports
|
|
|
|
|
docs-copy-reports:
|
|
|
|
|
cp -r reports site
|
|
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
|
build: tests build-testcov flake8 mypy docs docs-copy-reports
|