-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJustfile
110 lines (77 loc) · 2.26 KB
/
Justfile
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
set dotenv-filename := ".env.base"
fix:
find app/ tests/ -name "*.py" -type f | xargs -I {} pyupgrade --py312-plus {}
ruff check app/ tests/ --fix
ruff format app/ tests/
type-check:
mypy app/
mypy tests/
test:
pytest -s --cov=app/ --cov-report=html:tests/coverage tests/
show-coverage:
#!/usr/bin/env python3
import pathlib
import webbrowser
report_path = f"file://{pathlib.Path.cwd()/'tests/coverage/index.html'}"
webbrowser.open(report_path)
check:
just fix
just type-check
just test
make-migrations:
#!/bin/bash
source utils.sh
load_env .env.develop
alembic -c ${ALEMBIC_CONFIG_PATH} revision --autogenerate
migrate:
#!/bin/bash
source utils.sh
load_env .env.develop
alembic -c ${ALEMBIC_CONFIG_PATH} upgrade head
alembic *args:
#!/bin/bash
source utils.sh
load_env .env.develop
alembic -c ${ALEMBIC_CONFIG_PATH} {{args}}
exit 0
clean:
find app tests -type d -name ".*_cache" -exec rm -rf {} +
find app tests -type d -name "__pycache__" -exec rm -rf {} +
find app tests -type f \( -name "*.pyc" -o -name "*.pyo" \) -exec rm -f {} +
find . -type f -name ".DS_Store" -exec rm {} \;
build:
#!/bin/bash
docker build \
--file Dockerfile \
--build-arg APP_NAME=${APP_NAME} \
--build-arg POETRY_VERSION=${POETRY_VERSION} \
--build-arg PYTHON_IMAGE=${PYTHON_IMAGE} \
-t ${APP_NAME}:latest .
rebuild:
#!/bin/bash
source utils.sh
load_env .env.develop
docker build \
--build-arg APP_NAME=${APP_NAME} \
--build-arg POETRY_VERSION=${POETRY_VERSION} \
--build-arg PYTHON_IMAGE=${PYTHON_IMAGE} \
--no-cache \
-t ${APP_NAME}:latest .
publish tag:
docker tag ${APP_NAME}:latest ${DOCKER_HUB_USER}/${APP_NAME}:{{tag}}
docker push ${DOCKER_HUB_USER}/${APP_NAME}:{{tag}}
debug:
docker run -it --rm --entrypoint bash ${APP_NAME}
start:
docker-compose --file docker-compose.develop.yml up db
stop:
#!/bin/bash
export CONTAINERS=$(docker ps -aq)
if [ -n "${CONTAINERS}" ]; then
docker stop ${CONTAINERS}
docker rm ${CONTAINERS}
fi
up:
docker compose -f docker-compose.production.yml up
make-erd:
python app/database/utils/introspection.py