-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (56 loc) · 1.67 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
SRC := src
TMP := tmp
PYTEST := `which py.test`
MYPY_REPORT := $(CURDIR)/$(TMP)/mypy
TESTS_REPORT := $(CURDIR)/$(TMP)/tests
HTMLCOV := $(TESTS_REPORT)/htmlcov
clean:
find . -type f -name "*py[co]" -delete
find . -type d -name "__pycache__" -delete
# REQUIREMENTS
install-pip:
pip install pip==20.3
pip install poetry==1.1.4
sync-requirements: install-pip
poetry install --remove-untracked
update-requirements: install-pip
poetry update
requirements: update-requirements sync-requirements
check-mypy:
rm -rf .mypy_cache
rm -rf $(MYPY_REPORT)
MYPYPATH="$(SRC)" \
mypy --config-file=setup.cfg \
--html-report=$(MYPY_REPORT)/mypy_html_report \
.
check-openapi-docs: update-openapi-docs
git diff --quiet HEAD $(REF) -- docs/api || { echo 'update docs plz' ; exit 1; }
check-db-docs: update-db-docs
git diff --quiet HEAD $(REF) -- docs/db.md || { echo 'update docs plz' ; exit 1; }
# CODE: FORMAT
isort:
./code_checks/make_isort.sh -f $(SRC)
black:
./code_checks/make_black.sh -f $(SRC)
autoflake:
./code_checks/make_autoflake.sh -f $(SRC)
format: autoflake black isort
# CODE: coverage & tests
tests:
cd $(SRC) && \
mkdir -p $(TESTS_REPORT) && \
export COVERAGE_FILE=$(TESTS_REPORT)/coverage.cov && \
$(PYTEST) . \
--cov . --cov-report term-missing --cov-config=../setup.cfg --cov-report=
coverage-combine:
coverage combine $(TESTS_REPORT)/*.cov
coverage-report: coverage-combine
coverage report
coverage-html-report: coverage-combine
coverage html -d $(HTMLCOV)
# RUN
run-server:
cd $(SRC) && python main.py run_server
openapi-docs:
cd $(SRC) && python main.py openapi_docs > ../docs/openapi.yaml
check: requirements clean format check-mypy tests openapi-docs