|
1 | 1 | APP = $(notdir $(CURDIR)) |
2 | 2 | TAG = $(shell echo "$$(date +%F)-$$(git rev-parse --short HEAD)") |
| 3 | +GREEN := \033[0;32m |
| 4 | +NC := \033[0m |
3 | 5 |
|
4 | | -help: |
5 | | - @echo "Run make <target> where target is one of the following..." |
6 | | - @echo |
7 | | - @echo " all - run requirements, lint, test, and build" |
8 | | - @echo " requirements - install runtime dependencies" |
9 | | - @echo " development-requirements - install development dependencies" |
10 | | - @echo " pre-commit-install - install pre-commit hooks" |
11 | | - @echo " pre-commit-update - update pre-commit hooks" |
12 | | - @echo " pre-commit-run - run pre-commit on all files" |
13 | | - @echo " pre-commit-clean - remove pre-commit hooks" |
14 | | - @echo " lint - run ruff checks" |
15 | | - @echo " fmt - format code with ruff" |
16 | | - @echo " test - run unit tests" |
17 | | - @echo " build - build docker container" |
18 | | - @echo " clean - clean up workspace and containers" |
19 | | - |
20 | | -all: requirements lint test build |
21 | | - |
22 | | -requirements: |
| 6 | +help: ## Show this help message |
| 7 | + @echo "$(GREEN)Usage: make [target]$(NC)" |
| 8 | + @echo '' |
| 9 | + @echo "$(GREEN)Available targets:$(NC)" |
| 10 | + @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-25s %s\n", $$1, $$2}' $(MAKEFILE_LIST) |
| 11 | + |
| 12 | +all: requirements lint test build ## Run requirements, lint, test, and build |
| 13 | + |
| 14 | +requirements: ## Install runtime dependencies |
23 | 15 | pip install --quiet --upgrade --requirement requirements.txt |
24 | 16 |
|
25 | | -development-requirements: requirements |
| 17 | +development-requirements: requirements ## Install development dependencies |
26 | 18 | pip install --quiet --upgrade --requirement development-requirements.txt |
27 | 19 |
|
28 | | -pre-commit-install: development-requirements |
| 20 | +pre-commit-install: development-requirements ## Install pre-commit hooks |
29 | 21 | pre-commit install |
30 | 22 | detect-secrets scan > .secrets.baseline |
31 | 23 |
|
32 | | -pre-commit-update: development-requirements |
| 24 | +pre-commit-update: development-requirements ## Update pre-commit hooks |
33 | 25 | pre-commit autoupdate |
34 | 26 | $(MAKE) pre-commit-run |
35 | 27 |
|
36 | | -pre-commit-run: development-requirements |
| 28 | +pre-commit-run: development-requirements ## Run pre-commit on all files |
37 | 29 | pre-commit run --all-files |
38 | 30 |
|
39 | 31 | x_pre-commit-clean: |
40 | 32 | pre-commit uninstall |
41 | 33 |
|
42 | | -lint: |
| 34 | +lint: ## Run ruff checks |
43 | 35 | ruff check *.py |
44 | 36 |
|
45 | | -fmt: |
| 37 | +fmt: ## Format code with ruff |
46 | 38 | ruff format *.py |
47 | 39 | ruff check --fix *.py |
48 | 40 |
|
49 | | -test: |
| 41 | +test: ## Run unit tests |
50 | 42 | python -m unittest --verbose --failfast |
51 | 43 |
|
52 | | -build: lint test |
| 44 | +build: lint test ## Build docker container |
53 | 45 | docker build --tag $(APP):$(TAG) . |
54 | 46 |
|
55 | | -clean: |
| 47 | +clean: ## Clean up workspace and containers |
56 | 48 | docker container stop $(APP) || true |
57 | 49 | docker container rm $(APP) || true |
58 | 50 | @rm -rf ./__pycache__ ./tests/__pycache__ .ruff_cache |
|
0 commit comments