Files
2026-07-30 20:58:53 +03:00

1.4 KiB

VENV:=source .venv/bin/activate;
ALLURE:=.venv/allure-2.44.0/bin/allure #linux&macos
#ALLURE=.venv\allure-2.44.0\bin\allure #Windows
 
NUM_DOWN ?= 1
 
.DEFAULT_GOAL := help
 
.PHONY: help
help:
@grep -E '(^[a-zA-Z0-9_-]+:.*?##.*$$)|(^##)' Makefile | awk 'BEGIN {FS = ":.*?## "}{printf "[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m## /[33m/' | sed -e 's/\[32m/ /' | sed -e 's/\[33m//'
 
##
## Init section
##
 
.PHONY: run
run: ## Run application
${VENV} python3 main.py
 
##
## Migration section
##
 
.PHONY: m_gen
m_gen: ## Generate alembic new revision
${VENV} alembic revision --autogenerate
 
.PHONY: m_up
m_up: ## Set new alembic revision
${VENV} alembic upgrade head
 
.PHONY: m_down
m_down: ## Downgrade alembic revision
${VENV} alembic downgrade -${NUM_DOWN}
 
.PHONY: m_history
m_history: ## List history of migrations
${VENV} alembic history
 
.PHONY: m_current
m_current: ## Current migration
${VENV} alembic current
 
.PHONY: m_stamp
m_stamp: ## Stamp head
${VENV} alembic stamp head
 
##
## Test section
##
 
.PHONY: test
test: ## Run tests
${VENV} pytest
 
.PHONY: allure
allure: ## Generate allure report
${VENV} ${ALLURE} generate tests/allure-results/reports --single-file -o tests/allure-results/html --clean
 
.PHONY: coverage
coverage: ## Run pytest coverage
${VENV} pytest --cov=src tests/
 
.PHONY: clear
clear: ## Delete old test results
rm -rf ./tests/allure-results/reports