-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
96 lines (69 loc) · 1.79 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
91
92
93
94
95
96
VENV := .venv
VENV_PYTHON := $(VENV)/bin/python
SYSTEM_PYTHON := $(or $(shell which python3), $(shell which python))
PYTHON := $(or $(wildcard $(VENV_PYTHON)), $(SYSTEM_PYTHON))
POETRY := $(shell command -v poetry 2> /dev/null)
APP_ROOT := ./app
TESTS_ROOT := $(APP_ROOT)/tests
MYPY := mypy $(APP_ROOT)
MYPY_TESTS := $(MYPY) $(TESTS_ROOT)
.PHONY: black isort flake8 bandit mypy
mypy:
$(MYPY) .
black:
$(POETRY) run black $(APP_ROOT) --check
isort:
$(POETRY) run isort $(APP_ROOT)
flake8:
$(POETRY) run flake8 $(APP_ROOT)
bandit:
$(POETRY) run bandit $(APP_ROOT)
.PHONY: mypy-tests test test-vvv test-xml
mypy-tests:
$(MYPY_TESTS)
test:
$(POETRY) run pytest --cov=$(APP_ROOT)
test-vvv:
$(POETRY) run pytest --cov=$(APP_ROOT) -vvv
test-xml:
$(POETRY) run pytest --cov=$(APP_ROOT) --cov-report=xml
.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 . -type d -name '*.egg-info' `
rm -rf `find . -type d -name 'pip-wheel-metadata' `
rm -rf .cache
rm -rf .pytest_cache
rm -rf .mypy_cache
rm -rf htmlcov
rm -rf *.egg-info
rm -f .coverage
rm -f .coverage.*
rm -rf build
.PHONY: version poetry_version
poetry_version:
$(POETRY) version $(version)
version:
$(POETRY) version $(v)
@git add pyproject.toml
@git commit -m "v$$(POETRY version -s)"
@git tag v$$(POETRY version -s)
@git push
@git push --tags
$(POETRY) version
.PHONY: run build help init_data
init_data:
$(POETRY) run ps
run:
$(POETRY) run run.sh
@echo "Running!!!"
build:
$(POETRY) build
.PHONY: all-files autoupdate
all-files:
pre-commit run --all-files
autoupdate:
pre-commit autoupdate