-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (46 loc) · 1.73 KB
/
Copy pathMakefile
File metadata and controls
64 lines (46 loc) · 1.73 KB
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
.PHONY: venv deps deps_upgrade lint shell migration migrate_current migrate_up migrate_down server test test_once test_mutate test_coverage containers_up containers_down docker_up docker_down
venv:
uv venv --no-managed-python
deps:
uv sync --dev --locked
deps_upgrade:
uv lock --upgrade
lint:
uv run ruff check . && uv run ruff format --check . && pyrefly check --min-severity=warn
shell:
uv run python
migration:
if [ -z "$(m)" ]; then echo "Migration message is required. Use: make migration m='your message'"; exit 1; fi
uv run alembic revision -m "$(m)"
migrate_current:
uv run alembic current
migrate_up:
uv run alembic upgrade head
migrate_down:
uv run alembic downgrade -1
server:
ENV=STAGE uv run python app.py
test:
export DATABASE_URL=$${DATABASE_URL}_test; \
uv run alembic upgrade head; \
uv run ptw . --now --clear --ignore=mutants -s -vv $(args)
test_once:
export DATABASE_URL=$${DATABASE_URL}_test; \
uv run alembic upgrade head; \
uv run pytest --ignore=mutants -s
test_mutate:
export DATABASE_URL=$${DATABASE_URL}_test; \
uv run alembic upgrade head; \
uv run mutmut run && uv run mutmut browse
test_coverage:
export DATABASE_URL=$${DATABASE_URL}_test; \
uv run alembic upgrade head; \
uv run pytest --cov=app --ignore=mutants && rm -fr htmlcov/ && uv run coverage html && open htmlcov/index.html
containers_up:
docker-compose up -d
containers_down:
docker-compose down
docker_up:
docker build -t app . && docker run -d -e ENV=PROD -e AUTH_TOKEN=$${AUTH_TOKEN} -e DATABASE_URL=postgresql://postgres:postgres@host.docker.internal:5432/app_dev -e PORT=$${PORT} -e PROFILE_FUN=lpong,fail -p $${PORT}:$${PORT} app
docker_down:
docker ps -a -q --filter ancestor=app | xargs -I {} sh -c 'docker stop {} && docker rm {}'