-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
90 lines (68 loc) · 2.39 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.DEFAULT_GOAL := help
base_python := python3
py := poetry run
python := $(py) python
reports_dir := reports
help:
@echo "aiogram_cli"
# =================================================================================================
# Environment
# =================================================================================================
.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 `find . -name .pytest_cache`
rm -rf *.egg-info
rm -f .coverage
rm -f report.html
rm -f .coverage.*
rm -rf {build,dist,site,.cache,.mypy_cache,reports}
# =================================================================================================
# Code quality
# =================================================================================================
.PHONY: isort
isort:
$(py) isort -rc aiogram_cli tests
.PHONY: black
black:
$(py) black aiogram_cli tests
.PHONY: flake8
flake8:
$(py) flake8 aiogram_cli test
.PHONY: flake8-report
flake8-report:
mkdir -p $(reports_dir)/flake8
$(py) flake8 --format=html --htmldir=$(reports_dir)/flake8 aiogram_cli test
.PHONY: mypy
mypy:
$(py) mypy aiogram_cli
.PHONY: mypy-report
mypy-report:
$(py) mypy aiogram_cli --html-report $(reports_dir)/typechecking
.PHONY: lint
lint: isort black flake8 mypy
# =================================================================================================
# Tests
# =================================================================================================
.PHONY: test
test:
$(py) pytest --cov=aiogram_cli --cov-config .coveragerc tests/
.PHONY: test-coverage
test-coverage:
mkdir -p $(reports_dir)/tests/
$(py) pytest --cov=aiogram_cli --cov-config .coveragerc --html=$(reports_dir)/tests/index.html tests/
$(py) coverage html -d $(reports_dir)/coverage
.PHONY: test-coverage-report
test-coverage-report:
python -c "import webbrowser; webbrowser.open('file://$(shell pwd)/reports/coverage/index.html')"
# =================================================================================================
# Project
# =================================================================================================
.PHONY: build
build: clean flake8-report mypy-report test-coverage docs docs-copy-reports
mkdir -p site/simple
poetry build
mv dist site/simple/aiogram_cli