-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
113 lines (74 loc) · 1.62 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
PROJ_PATH ?= app
TESTS_PATH ?= tests
ALEMBIC_PATH ?= alembic
CONTAINER_APP ?= app
DC ?= docker compose
ALEMBIC ?= alembic
### linters ###
.PHONY: black
black:
black ${PROJ_PATH} ${TESTS_PATH} ${ALEMBIC_PATH}
.PHONY: ruff
ruff:
ruff check --output-format=concise ${PROJ_PATH} ${TESTS_PATH} ${ALEMBIC_PATH}
.PHONY: ruff_fix
ruff_fix:
ruff check --fix ${PROJ_PATH} ${TESTS_PATH} ${ALEMBIC_PATH}
.PHONY: mypy
mypy:
mypy ${PROJ_PATH} ${TESTS_PATH} ${ALEMBIC_PATH}
.PHONY: bandit
bandit:
bandit -c pyproject.toml --silent -r ${PROJ_PATH}
.PHONY: check
check: black ruff mypy bandit
### tests ###
.PHONY: tests
tests:
pytest --cov-report term-missing --cov=app --durations=3
pytest --dead-fixtures
.PHONY: tests_performance
tests_performance:
make up
sleep 3
locust --config tests/performance/locust.conf
make down
### poerty wrappers ###
.PHONY: install
install:
poetry install
.PHONY: update
update:
poetry update
.PHONY: export_all
export_all:
poetry export -f requirements.txt --output requirements.txt --without-hashes --with=test,dev
### local dev ###
.PHONY: up
up:
${DC} up --build -d --remove-orphans
.PHONY: up_live
up_live:
${DC} up --build --remove-orphans
.PHONY: up_db
up_db:
${DC} up --build -d --remove-orphans postgres
.PHONY: down
down:
${DC} down
.PHONY: restart
restart:
${DC} down
${DC} up --build -d --remove-orphans
.PHONY: logs
logs:
${DC} logs -f -n 200
.PHONY: shell
shell:
${DC} exec app bash
.PHONY: migration_create
migration_create:
${ALEMBIC} revision --autogenerate -m "new"
.PHONY: migration_upgrade
migration_upgrade:
${ALEMBIC} upgrade head