-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (41 loc) · 1.98 KB
/
Makefile
File metadata and controls
58 lines (41 loc) · 1.98 KB
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
PROJECT_NAME = hack_template
TEST_PATH = ./tests/
PYTHON_VERSION = 3.11
HELP_FUN = \
%help; while(<>){push@{$$help{$$2//'options'}},[$$1,$$3] \
if/^([\w-_]+)\s*:.*\#\#(?:@(\w+))?\s(.*)$$/}; \
print"$$_:\n", map" $$_->[0]".(" "x(20-length($$_->[0])))."$$_->[1]\n",\
@{$$help{$$_}},"\n" for keys %help; \
help: ##@Help Show this help
@echo -e "Usage: make [target] ...\n"
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
lint-ci: ruff mypy ##@Linting Run all linters in CI
ruff: ##@Linting Run ruff
.venv/bin/ruff check ./$(PROJECT_NAME)
mypy: ##@Linting Run mypy
.venv/bin/mypy --config-file ./pyproject.toml ./$(PROJECT_NAME)
test: ##@Test Run tests with pytest
pytest -vvx $(TEST_PATH)
test-ci: ##@Test Run tests with pytest and coverage in CI
.venv/bin/pytest $(TEST_PATH) --junitxml=./junit.xml --cov=./$(PROJECT_NAME) --cov-report=xml
develop: clean_dev ##@Develop Create virtualenv
python$(PYTHON_VERSION) -m venv .venv
.venv/bin/pip install -U pip poetry
.venv/bin/poetry config virtualenvs.create false
.venv/bin/poetry install
local: ##@Develop Run dev containers for test
docker compose -f docker-compose.dev.yaml up --force-recreate --renew-anon-volumes --build
local_down: ##@Develop Stop dev containers with delete volumes
docker compose -f docker-compose.dev.yaml down -v
alembic-upgrade-head: ##@Database Run alembic upgrade head
.venv/bin/python -m $(PROJECT_NAME).db --pg-dsn=$(APP_DB_PG_DSN) upgrade head
alembic-downgrade: ##@Database Run alembic downgrade to previous version
.venv/bin/python -m $(PROJECT_NAME).db --pg-dsn=$(APP_DB_PG_DSN) downgrade -1
alembic-revision: ##@Database New alembic revision
.venv/bin/python -m $(PROJECT_NAME).db --pg-dsn=$(APP_DB_PG_DSN) revision --autogenerate
docker-alembic-upgrade-head: ##@Database Run alembic upgrade head in docker
docker-compose exec backend python -m $(PROJECT_NAME).db upgrade head
clean_dev: ##@Develop Remove virtualenv
rm -rf .venv
cloc: ##@Help Run cloc
cloc --exclude-dir=$(shell tr '\n' ',' < .clocignore) .