-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (46 loc) · 1.39 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
TESTS = tests
VENV ?= .venv
CODE = tests app
BIN_PATH = bin
ifeq ($(OS), Windows_NT)
BIN_PATH = Scripts
endif
.PHONY: help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: venv
venv:
python3.9 -m venv $(VENV)
$(VENV)/$(BIN_PATH)/python -m pip install --upgrade pip
$(VENV)/$(BIN_PATH)/python -m pip install poetry
$(VENV)/$(BIN_PATH)/poetry install
.PHONY: test
test: ## Runs pytest
$(VENV)/$(BIN_PATH)/pytest -v tests
.PHONY: lint
lint: ## Lint code
$(VENV)/$(BIN_PATH)/flake8 --jobs 4 --statistics --show-source $(CODE)
$(VENV)/$(BIN_PATH)/pylint --jobs 4 --rcfile=setup.cfg $(CODE)
$(VENV)/$(BIN_PATH)/mypy $(CODE)
$(VENV)/$(BIN_PATH)/black --skip-string-normalization --check $(CODE)
.PHONY: format
format: ## Formats all files
$(VENV)/$(BIN_PATH)/isort $(CODE)
$(VENV)/$(BIN_PATH)/black --skip-string-normalization $(CODE)
$(VENV)/$(BIN_PATH)/autoflake --recursive --in-place --remove-all-unused-imports $(CODE)
$(VENV)/$(BIN_PATH)/unify --in-place --recursive $(CODE)
.PHONY: ci
ci: lint test ## Lint code then run tests
.PHONY: init_db
init_db:
$(VENV)/$(BIN_PATH)/python init_db.py
.PHONY: up
up:
docker-compose up -d --build
# only for docker
.PHONY: app
app:
uvicorn app.main:app --host=0.0.0.0 --port=80
.PHONY: admin
admin:
flask run --host=0.0.0.0 --port=5000