-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
87 lines (62 loc) · 2.18 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
.ONESHELL:
SHELL := bash
backend_container := holy-grail-backend
backend_container_name := holy-grail-backend
frontend_container := holy-grail-frontend
local_postgres_user := postgres
local_postgres_db_name := app
ifeq ($(version),)
DC_COMMAND := docker compose
else
DC_COMMAND := docker compose -f docker-compose.$(version).yml
endif
-include ./Makefile.properties
hello:
echo "Hello, world!"
coverage:
$(DC_COMMAND) run -e TESTING=true --rm $(backend_container) coverage run --source=app -m pytest -x
generate_xml:
$(DC_COMMAND) run -e TESTING=true --rm $(backend_container) coverage xml -i
build:
$(DC_COMMAND) stop && $(DC_COMMAND) build --no-cache && $(DC_COMMAND) up -d
stop:
$(DC_COMMAND) stop
run:
$(DC_COMMAND) up -d
down:
$(DC_COMMAND) down
runserver:
docker exec -it $(backend_container_name) uvicorn app.main:app --port 9005 --host 0.0.0.0 --reload
buildbackend:
$(DC_COMMAND) up -d --build $(backend_container)
buildfrontend:
$(DC_COMMAND) up -d --build $(frontend_container)
migrate:
$(DC_COMMAND) run --rm $(backend_container) alembic upgrade head
downgrade:
$(DC_COMMAND) run --rm $(backend_container) alembic downgrade -1
migrations:
$(DC_COMMAND) run --rm $(backend_container) alembic revision --autogenerate -m $(name)
ruff:
$(DC_COMMAND) run --rm $(backend_container) ruff check .
mypy:
$(DC_COMMAND) run --rm $(backend_container) mypy ./app --install-types --strict
check: ruff \
mypy \
tests \
tests:
$(DC_COMMAND) run -e TESTING=true --rm $(backend_container) pytest ./app/tests -x -vv
test:
$(DC_COMMAND) run --rm -e TESTING=true $(backend_container) pytest ./app/tests/api/$(file).py -x -vv
local-dump:
scp $(user)@$(domain):./holy-grail/$(sql_file_name).sql .
docker exec -i holy-grail-db psql -U $(local_postgres_user) -d $(local_postgres_db_name) < $(sql_file_name).sql
dump:
docker exec -i holy-grail-db psql -U $(local_postgres_user) -d $(local_postgres_db_name) < $(sql_file_name).sql
venv:
( \
pip install virtualenv; \
virtualenv holy-grail-backend/backend/app/.venv --prompt="holy-grail-py1.0"; \
source holy-grail-backend/backend/app/.venv/bin/activate; \
pip install -r holy-grail-backend/backend/app/requirements.txt; \
)