From 262b7b32f3d0cce678a605310be91c17ef2b028b Mon Sep 17 00:00:00 2001 From: realaravinth Date: Mon, 22 Aug 2022 13:17:29 +0530 Subject: [PATCH] feat: setup make for tests, coverage, migrations and linting --- Makefile | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6304d91..b6bba28 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,31 @@ -env: +define run_migrations ## run migrations + @ . ./venv/bin/activate && python manage.py makemigrations + @ . ./venv/bin/activate && python manage.py migrate +endef + +default: ## Run app + $(call run_migrations) + . ./venv/bin/activate && python manage.py runserver + +env: ## setup environment . ./venv/bin/activate && pip install -r requirements.txt + +coverage: ## Generate test coverage report + . ./venv/bin/activate && coverage run manage.py test + . ./venv/bin/activate && coverage report -m + . ./venv/bin/activate && coverage html + +freeze: ## Freeze python dependencies + @. ./venv/bin/activate && pip freeze > requirements.txt + +help: ## Prints help for targets with comments + @cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +lint: ## Run linter + @./venv/bin/black dashboard accounts dash support billing infrastructure integration + +migrate: ## Run migrations + $(call run_migrations) + +test: ## Run tests + @. ./venv/bin/activate && python manage.py test --parallel