-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (57 loc) · 2.04 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
61
62
63
64
65
66
67
68
69
70
71
72
73
ifneq ("$(wildcard .env)","")
include .env
export
endif
.PHONY: run
run: ## Run the project.
poetry run python -m api
.PHONY: install
install: ## Install Python package dependencies.
python -m pip install --upgrade pip setuptools wheel poetry
poetry lock
poetry install --no-root
poetry run pre-commit install
.PHONY: test
test: ## Run automated tests.
ENVIRONMENT=test poetry run pytest --cov
.PHONY: up-database
up-database: ## Start database container.
docker compose up -d postgres --force-recreate
.PHONY: down
down: ## Stop all containers.
docker compose down
.PHONY: revision
revision: ## Create a new database revision following the repository's models.
poetry run alembic revision --autogenerate -m "$(MESSAGE)"
.PHONY: migrate
migrate: ## Run database migrations.
poetry run alembic upgrade head
.PHONY: downgrade
downgrade: ## Undo last database migration.
poetry run alembic downgrade -1
.PHONY: docker-rm
docker-rm: ## Remove all docker containers.
docker rm -f $$(docker ps -a -q)
.PHONY: docker-rmi
docker-rmi: ## Remove all downloaded docker images.
docker rmi -f $$(docker images -q)
.PHONY: export-requirements
export-requirements: ## Export poetry managed packages to a requirements.txt (needed by Vercel).
poetry export -f requirements.txt --output requirements.txt --without-hashes
.PHONY: pre-commit
pre-commit: ## Run pre-commit checks.
poetry run pre-commit run --config ./.pre-commit-config.yaml
.PHONY: patch
patch: ## Bump project version to next patch (bugfix release).
poetry version patch
.PHONY: minor
minor: ## Bump project version to next minor (feature release).
poetry version minor
.PHONY: clean
clean: ## Clean project's temporary files.
find . -name '__pycache__' -exec rm -rf {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.log' -exec rm -f {} +
.DEFAULT_GOAL := help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sed 's/Makefile://g' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'