-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (64 loc) · 1.85 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
python = $(shell which python3)
VENV = venv
PYTHON = $(VENV)/bin/python
PIP = $(VENV)/bin/pip
PYTEST = $(VENV)/bin/pytest
PYCLEAN = $(VENV)/bin/pyclean
PYLINT = $(VENV)/bin/pylint
MYPY = $(VENV)/bin/mypy
PIPREMOVE = $(VENV)/bin/pip-autoremove
# deploy
build:
./scripts/create_dot_env.sh deploy
docker compose -f compose.yaml -f compose.deploy.yaml build
deploy:
docker compose -f compose.yaml -f compose.deploy.yaml up -d
stop-deploy:
docker compose -f compose.yaml -f compose.deploy.yaml down
# setup
setup: build-test
$(python) -m venv $(VENV)
$(PIP) install -r requirements.txt
chmod 777 scripts/pre-commit
chmod 777 scripts/create_dot_env.sh
git config core.hooksPath scripts
# test (setup, up, test, stop)
build-test:
./scripts/create_dot_env.sh test
docker compose -f compose.yaml -f compose.test.yaml build
up-test:
./scripts/create_dot_env.sh test
docker compose -f compose.yaml -f compose.test.yaml up -d
test: up-test
$(PYTEST) --cov-report term-missing:skip-covered --cov-report xml:coverage.xml -c configs/pytest.ini
stop-test:
docker compose -f compose.yaml -f compose.test.yaml down
# debug (setup, up, debug, stop)
build-debug:
./scripts/create_dot_env.sh debug
docker compose -f compose.yaml -f compose.debug.yaml build
debug:
docker compose -f compose.yaml -f compose.debug.yaml up
stop-debug:
docker compose -f compose.yaml -f compose.debug.yaml down
# lint and type-check
lint:
$(PYLINT) code --rcfile=configs/.pylintrc
type-check:
$(MYPY) code --config-file configs/mypy.ini
# pip install, freeze, and remove
add:
$(PIP) install $(package)
freeze:
$(PIP) freeze > requirements.txt
remove:
$(PIPREMOVE) $(package) -y
# pre-commit helpers
smoke-test: up-test
$(PYTEST) -c configs/pytest.ini --cov-report= -m smoke
lint-hook:
$(PYLINT) --rcfile=configs/.pylintrc $(files)
# clear the cache and remove venv
clean:
$(PYCLEAN) .
rm -rf venv