2019-11-15 12:17:57 +02:00
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
|
2019-12-26 00:00:53 +02:00
|
|
|
base_python := python3
|
2019-11-16 22:32:26 +02:00
|
|
|
py := poetry run
|
|
|
|
|
python := $(py) python
|
2019-11-15 12:17:57 +02:00
|
|
|
|
2020-01-11 20:01:49 +02:00
|
|
|
reports_dir := reports
|
|
|
|
|
|
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-18 14:57:11 +02:00
|
|
|
@echo " help: Show this message"
|
2019-11-15 12:17:57 +02:00
|
|
|
@echo " install: Install development dependencies"
|
2019-11-18 14:57:11 +02:00
|
|
|
@echo " clean: Delete temporary files"
|
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"
|
2019-11-18 14:57:11 +02:00
|
|
|
@echo " flake8-report: Run flake8 with HTML reporting"
|
2019-11-15 12:17:57 +02:00
|
|
|
@echo " mypy: Run mypy tool"
|
2019-11-18 14:57:11 +02:00
|
|
|
@echo " mypy-report: Run mypy tool with HTML reporting"
|
2019-11-15 12:17:57 +02:00
|
|
|
@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-18 14:57:11 +02:00
|
|
|
@echo " test-coverage: Run tests with HTML reporting (results + coverage)"
|
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-18 14:57:11 +02:00
|
|
|
@echo " docs-prepare-reports: Move all HTML reports to docs dir"
|
2019-11-15 12:44:24 +02:00
|
|
|
@echo ""
|
2019-11-18 14:57:11 +02:00
|
|
|
@echo "Project"
|
|
|
|
|
@echo " build: Run tests build package and docs"
|
2019-11-15 12:17:57 +02:00
|
|
|
@echo ""
|
|
|
|
|
|
2019-11-18 14:57:11 +02:00
|
|
|
|
|
|
|
|
|
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 '.*~' `
|
2019-11-28 23:21:19 +02:00
|
|
|
rm -rf `find . -name .pytest_cache`
|
2019-11-15 14:21:35 +02:00
|
|
|
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-28 23:21:19 +02:00
|
|
|
rm -rf {build,dist,site,.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-18 14:57:11 +02:00
|
|
|
$(py) flake8 aiogram test
|
|
|
|
|
|
|
|
|
|
.PHONY: flake8-report
|
|
|
|
|
flake8-report:
|
2020-01-11 20:01:49 +02:00
|
|
|
mkdir -p $(reports_dir)/flake8
|
|
|
|
|
$(py) flake8 --format=html --htmldir=$(reports_dir)/flake8 aiogram test
|
2017-12-01 02:14:49 +02:00
|
|
|
|
2019-11-15 12:17:57 +02:00
|
|
|
.PHONY: mypy
|
|
|
|
|
mypy:
|
2019-11-18 14:57:11 +02:00
|
|
|
$(py) mypy aiogram tests
|
|
|
|
|
|
|
|
|
|
.PHONY: mypy-report
|
|
|
|
|
mypy-report:
|
2020-01-11 20:01:49 +02:00
|
|
|
$(py) mypy aiogram tests --html-report $(reports_dir)/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-24 01:07:43 +02:00
|
|
|
$(py) pytest --cov=aiogram --cov-config .coveragerc -p no:warnings tests/
|
2019-11-18 14:57:11 +02:00
|
|
|
|
|
|
|
|
.PHONY: test-coverage
|
|
|
|
|
test-coverage:
|
2020-01-11 20:01:49 +02:00
|
|
|
mkdir -p $(reports_dir)/tests/
|
|
|
|
|
$(py) pytest --cov=aiogram --cov-config .coveragerc --html=$(reports_dir)/tests/index.html -p no:warnings tests/
|
|
|
|
|
$(py) coverage html -d $(reports_dir)/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:
|
2020-01-11 20:01:49 +02:00
|
|
|
mv $(reports_dir)/* site/reports
|
2019-11-18 14:57:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# =================================================================================================
|
|
|
|
|
# Project
|
|
|
|
|
# =================================================================================================
|
2019-11-17 23:40:52 +02:00
|
|
|
|
|
|
|
|
.PHONY: build
|
2020-01-11 20:01:49 +02:00
|
|
|
build: clean flake8-report mypy-report test-coverage docs docs-copy-reports
|
2019-11-18 14:57:11 +02:00
|
|
|
mkdir -p site/simple
|
|
|
|
|
poetry build
|
|
|
|
|
mv dist site/simple/aiogram
|
|
|
|
|
|