-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
106 lines (83 loc) · 2.64 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
94
95
96
97
98
99
100
101
102
103
104
105
106
# Makefile
checkmark=\xE2\x9C\x94 # Unicode character representation
warning=\xE2\x9A\xA0 # Unicode character representation
define warn
@tput bold
@tput setaf 3
@printf "${warning}${1}\n"
@tput sgr0
endef
define log
@tput bold
@tput setaf 6
@printf "${checkmark}${1}\n"
@tput sgr0
endef
.DEFAULT_GOAL := help
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
VENV := .venv
###############################################################################
# Default
###############################################################################
.PHONY: help
help:
@echo "\n|> Directory: ${ROOT_DIR}"
@echo "|> OS: ${OS}"
@echo "|> Available targets:\n"
@make -qpRr | egrep -e '^[a-z].*:$$' | sed -e 's~:~~g' | sort
.PHONY: all
all: clean poetry-install pre-commit
@$(call warn, init config)
.PHONY: test
test: poetry-test
.PHONY: clean
clean: python-delete-venv
###############################################################################
# Poetry setup and help
###############################################################################
.PHONY: poetry-setup
poetry-setup: poetry-local-venv python-delete-venv poetry-install
.PHONY: poetry-setup
poetry-install:
@$(call warn, create and install poetry dependencies)
poetry install
@$(call log, create and install poetry dependencies)
python-delete-venv:
@$(call warn, delete existent virtualenv)
rm -rf $(VENV)
rm -rf venv
@$(call log, delete existent virtualenv)
poetry-local-venv:
@$(call warn, setting virtualenv location to project)
poetry config virtualenvs.in-project true
@$(call log, virtualenv set to project location)
poetry-get-env:
poetry env info --path
poetry-update:
@$(call warn, update poetry dependencies)
poetry update
@$(call log, poetry dependencies update)
poetry-test:
@$(call warn, run tests with poetry)
poetry run pytest
@$(call log, tests done)
###############################################################################
# Pre commit
###############################################################################
pre-commit: pre-commit-setup pre-commit-update
pre-commit-setup:
@$(call warn, install pre-commit dependencies)
pre-commit install
@$(call log, install pre-commit dependencies)
pre-commit-update:
@$(call warn, update pre-commit dependencies)
pre-commit autoupdate
@$(call log, update pre-commit dependencies)
###############################################################################
# Commitizen
###############################################################################
bump:
@$(call warn, bump version of commitizen)
cz bump
@$(call log, Dont forget to push the tags)
@$(call log, git push --tags)