-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
81 lines (59 loc) · 2.27 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
.DEFAULT_GOAL := help
base_python := python3
py := poetry run
python := $(py) python
reports_dir := reports
package_dir := aiohttp_session
code_dir := $(package_dir) tests
help:
@echo "aiohttp_session"
# =================================================================================================
# Environment
# =================================================================================================
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 -f .dmypy.json
rm -rf {build,dist,site,.cache,.mypy_cache,reports,}
# =================================================================================================
# Code quality
# =================================================================================================
isort:
$(py) isort -rc $(code_dir)
black:
$(py) black $(code_dir)
flake8:
$(py) flake8 $(code_dir)
flake8-report:
mkdir -p $(reports_dir)/flake8
$(py) flake8 --format=html --htmldir=$(reports_dir)/flake8 $(code_dir)
mypy:
$(py) mypy $(package_dir)
mypy-report:
$(py) mypy $(package_dir) --html-report $(reports_dir)/typechecking
lint: isort black flake8 mypy
# =================================================================================================
# Tests
# =================================================================================================
test:
$(py) pytest --cov=aiohttp_session --cov-config .coveragerc tests/
test-coverage:
mkdir -p $(reports_dir)/tests/
$(py) pytest --cov=aiohttp_session --cov-config .coveragerc --html=$(reports_dir)/tests/index.html tests/
$(py) coverage html -d $(reports_dir)/coverage
test-coverage-report:
python -c "import webbrowser; webbrowser.open('file://$(shell pwd)/reports/coverage/index.html')"
# =================================================================================================
# Project
# =================================================================================================
build: clean flake8-report mypy-report test-coverage docs docs-copy-reports
mkdir -p site/simple
poetry build
mv dist site/simple/aiohttp_session