aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: fc1c16d7710b04297a7a7442ea174a34089e0971 (plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
.DEFAULT_GOAL := help
SHELL := /bin/bash

.PHONY: api
api: ## Run API
	@poetry run uvicorn --host 0.0.0.0 poker.api:app

.PHONY: black
black: ## Run black formatter
	@poetry run black poker tests;

.PHONY: black-check
black-check: ## Run black formatter
	@poetry run black poker tests --check;

.PHONY: build
build:  ## Build Docker container
	@COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose -f compose.yml build;

.PHONY: clean
clean: ## Remove python cache files
	-@find . -name '*.pyc' -exec rm -f {} +;
	-@find . -name '*.pyo' -exec rm -f {} +;
	-@find . -name '*__pycache__' -exec rm -fr {} +;
	-@find . -name '*.mypy_cache' -exec rm -fr {} +;
	-@find . -name '*.pytest_cache' -exec rm -fr {} +;
	-@find . -name '*.coverage' -exec rm -fr {} +;

.PHONY: coverage
coverage: ## Report test coverage
	@poetry run coverage report --rcfile=setup.cfg;

.PHONY: flake8
flake8: ## Run flake8 linting
	@poetry run flake8 poker tests --config=setup.cfg;

.PHONY: force-update
force-update: ## Forcefully update poetry.lock using pyproject.toml
	-@rm poetry.lock;
	@poetry update;

.PHONY: format
format: isort black ## Format to match linting requirements

.PHONY: help
help: ## Show all available commands
	@awk 'BEGIN {FS = ":.*##"; printf "Usage: make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf "  \033[36m%-13s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST);

.PHONY: install
install: ## Install all packages using poetry.lock
	@poetry install --no-interaction;

.PHONY: install-prod
install-prod: ## Install all production packages using poetry.lock
	@poetry install --no-interaction --only main;

.PHONY: isort
isort: ## Run isort formatter
	@poetry run isort poker tests --settings-path=setup.cfg;

.PHONY: isort-check
isort-check: ## Run isort formatter
	@poetry run isort poker tests --settings-path=setup.cfg --check-only;

.PHONY: mypy
mypy: ## Run mypy type checking
	@poetry run mypy --config-file=setup.cfg poker tests;

.PHONY: pydocstyle
pydocstyle: ## Run docstring linting
	@poetry run pydocstyle poker tests --config=setup.cfg;

.PHONY: quality
quality: flake8 mypy isort-check black-check pydocstyle ## Run linting checks

.PHONY: test
test: ## Run test pipeline
	@poetry run coverage run --rcfile=setup.cfg --source=poker -m pytest -c=setup.cfg -x

.PHONY: uninstall
uninstall: ## Remove virtual environment
	@-rm -rf `poetry env info -p`;

.PHONY: update
update: ## Update poetry.lock using pyproject.toml
	@poetry update;