-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (34 loc) · 1.24 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
.PHONY: deps lint shell migration migrate_current migrate_up migrate_down server test test_once containers_up containers_down docker_up docker_down
deps:
poetry install
lint:
poetry run ruff check .
shell:
poetry run python
migration:
if [ -z "$(m)" ]; then echo "Migration message is required. Use: make migration m='your message'"; exit 1; fi
poetry run alembic revision -m "$(m)"
migrate_current:
poetry run alembic current
migrate_up:
poetry run alembic upgrade head
migrate_down:
poetry run alembic downgrade -1
server:
ENV=STAGE poetry run python app.py
test:
export DATABASE_URL=$${DATABASE_URL}_test; \
poetry run alembic upgrade head; \
poetry run -- ptw -- -s -vv $(args)
test_once:
export DATABASE_URL=$${DATABASE_URL}_test; \
poetry run alembic upgrade head; \
poetry run pytest -s
containers_up:
docker-compose up -d
containers_down:
docker-compose down
docker_up:
docker build -t exam-depository . && docker run -d -e ENV=PROD -e AUTH_TOKEN=$${AUTH_TOKEN} -e DATABASE_URL=postgresql://postgres:postgres@host.docker.internal:5432/exam_depository_dev -e PORT=$${PORT} -p $${PORT}:$${PORT} exam-depository
docker_down:
docker ps -a -q --filter ancestor=exam-depository | xargs -I {} sh -c 'docker stop {} && docker rm {}'