-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (36 loc) · 1.08 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
ifeq ($(OS),Windows_NT)
VENV_ACTIVATE := .venv\Scripts\activate
else
VENV_ACTIVATE := .venv/bin/activate
endif
CODE_DIRS := zefir_api tests
ifndef ENV_FILE_EXISTS
ifeq ($(wildcard .env),)
ENV_FILE_EXISTS := false
else
ENV_FILE_EXISTS := true
endif
endif
.PHONY: install lint clean run down test
$(VENV_ACTIVATE): pyproject.toml .pre-commit-config.yaml
python3.11 -m venv .venv
. $(VENV_ACTIVATE) && pip install --upgrade pip \
&& pip install . \
&& pip install .[dev]
. $(VENV_ACTIVATE) && pre-commit install
install: $(VENV_ACTIVATE)
lint: $(VENV_ACTIVATE)
. $(VENV_ACTIVATE) && black $(CODE_DIRS) \
&& pylama -l mccabe,pycodestyle,pyflakes,radon,mypy $(CODE_DIRS) --async --skip=.*/*
clean:
rm -rf $(VENV_ACTIVATE) .mypy_cache .pytest_cache .tox
find . | grep -E "(/__pycache__$$|\.pyc$|\.pyo$$)" | xargs rm -rf
run:
@if [ "$(ENV_FILE_EXISTS)" = "false" ]; then \
cp .env-template .env; \
fi
docker compose up -d --build
down:
docker compose down
test: $(VENV_ACTIVATE) lint
. $(VENV_ACTIVATE) && tox -e unit --skip-pkg-install