-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakefile
57 lines (44 loc) · 1.16 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
export PYTHONPATH=${PWD}/src:${PWD}
export TEST_IMAGE=pg-14.3-test
lint:
black src/
isort src/
format:
make lint
autoflake --remove-all-unused-imports --recursive --remove-unused-variables --in-place src/ --exclude=__init__.py
my:
mypy src/
blc:
black --check src/
isc:
isort src -c
main:
python main.py --env local --debug
al-rev-auto:
alembic revision --autogenerate
al-up:
alembic upgrade head
del-ds:
find . -name .DS_Store -print0 | xargs rm
define check_image_and_run
if [ -z $$(docker images -q $1) ]; then \
echo \>\>\>\>\>\> Image $1 was not found ; \
echo \>\>\>\>\>\> Building $1 ... ; \
docker build -f docker/db/Dockerfile -t $1 . && \
docker run -d -p 5432:5432 --rm $1; \
else \
echo \>\>\>\>\>\> Image $1 was found ; \
echo \>\>\>\>\>\> Running $1 ... ; \
docker run -d -p 5432:5432 --rm $1; \
fi
endef
test-db-run:
@echo ">>>>>> Running test db..."
$(call check_image_and_run, $$TEST_IMAGE)
test-db-stop:
@echo ">>>>>> Stopping test db..."
docker ps -qf ancestor=$$TEST_IMAGE | xargs docker stop
test-db-rerun:
@echo ">>>>>> Stop and Rerun test db..."
make test-db-stop
make test-db-run