-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (75 loc) · 2.15 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
.ONESHELL:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
help: ## Show available commands and their descriptions
@echo "Usage: make [target]"
@echo ""
@awk -F ':.*?## ' '/^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: help
.PHONY: in-venv
in-venv: ## make sure we're in the venv
$(VENV)/pdm config python.use_venv true
.PHONY: bootstrap
bootstrap: python-version clean-venv venv ## Delete existing & create new venv
prod: in-venv ## install package dependencies
# installing prod dependencies...
$(VENV)/pdm install --prod
.PHONY: prod
dev: in-venv prod ## install (all) dev dependencies
# installing dev dependencies...
$(VENV)/pdm install -dG :all
.PHONY: dev
bootstrap-dev: ## set up a fresh dev environment
# setting up a fresh dev environment...
$(MAKE) bootstrap
$(MAKE) dev
$(MAKE) setup-docs
$(MAKE) setup-pre-commit
.PHONY: bootstrap-dev
setup-pre-commit: in-venv ## install pre-commit hooks
# installing pre-commit hooks...
$(VENV)/pre-commit autoupdate
$(VENV)/pre-commit install && $(VENV)/pre-commit install --hook-type commit-msg
.PHONY: setup-pre-commit
setup-docs: ## install docs dependencies
# installing docs dependencies...
@npm install
.PHONY: setup-docs
build-docs: setup-docs ## build docs
# building docs...
@npm run docs:build
.PHONY: build-docs
update: ## update lock file if needed
$(VENV)/pdm self update
$(VENV)/pdm run update-all
$(VENV)/pre-commit autoupdate
.PHONY: update
lint: ## Run linter on python files
lint:
$(VENV)/pdm run lint
.PHONY: lint
format: ## Run formatter on python files
format:
$(VENV)/pdm run format
.PHONY: format
mypy: ## Run mypy on python files
mypy:
$(VENV)/pdm run mypy
.PHONY: mypy
test: ## Run unit tests
test:
$(VENV)/pdm run test
.PHONY: test
ci: ## Run formatter, linter, mypy, and unit tests
ci:
$(VENV)/pdm run ci
.PHONY: ci
.DEFAULT_GOAL := help
define find.functions
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
endef
python-version: ## Show the python version
# Using the following python version:
@python --version
.PHONY: python-version
include Makefile.venv