-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
137 lines (106 loc) · 5 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# NOTE: This Makefile assumes that dependencies are installed and, if a virtual
# environment is used, it is activated.
## Variables ##################################################################
# NOTE: Define any variables here if needed in the future
## Documentation ##############################################################
# NOTE: Keep all the targets in alphabetical order for better readability.
default: help
.PHONY: help
help:
@echo "\nUsage: make [target] ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
@echo "Available targets:\n"
@echo "Code Quality ------------------------------------------------------------------"
@echo " \033[1m\033[35mformat-lint\033[0m \033[37m(fl)\033[0m: \033[36mRun linter, formatter, spellcheck.\033[0m"
@echo " \033[1m\033[35mprecommit-check\033[0m \033[37m(pc)\033[0m: \033[36mRun all pre-commit checks.\033[0m"
@echo " \033[1m\033[35msecurity\033[0m \033[37m(s)\033[0m: \033[36mRun security scans.\033[0m"
@echo " \033[1m\033[35mtype-check\033[0m \033[37m(tc)\033[0m: \033[36mPerform type checking.\033[0m\n"
@echo "Documentation -----------------------------------------------------------------"
@echo " \033[1m\033[35mdocs\033[0m \033[37m(d)\033[0m: \033[36mGenerate project documentation.\033[0m\n"
@echo "Environment Management --------------------------------------------------------"
@echo " \033[1m\033[35mclean-venv\033[0m \033[37m(cv)\033[0m: \033[36mRemove virtual environment.\033[0m"
@echo " \033[1m\033[35minstall\033[0m \033[37m(i)\033[0m: \033[36mInstall app and dependencies.\033[0m"
@echo " \033[1m\033[35mvenv\033[0m \033[37m(v)\033[0m: \033[36mCreate virtual environment.\033[0m\n"
@echo "Miscellaneous -----------------------------------------------------------------"
@echo " \033[1m\033[35mupdate\033[0m \033[37m(u)\033[0m: \033[36mUpdatetemplate.\033[0m\n"
@echo "Testing -----------------------------------------------------------------------"
@echo " \033[1m\033[35mtest\033[0m \033[37m(t)\033[0m: \033[36mRun all tests.\033[0m\n"
## Autogenerated Targets ######################################################
# NOTE: Keep all the targets in alphabetical order for better readability.
# NOTE: Do not modify the autogenerated targets, unless necessary, write custom
# targets in the custom section below..
.PHONY: clean-venv
clean-venv:
@echo "\nRemoving the virtual environment ++++++++++++++++++++++++++++++++++++++++++++++\n"
@rm -rf .venv
.PHONY: cv
cv: clean-venv
.PHONY: docs
docs:
@echo "\nGenerating project documentation ++++++++++++++++++++++++++++++++++++++++++++++\n"
@poetry run sphinx-apidoc -f -o docs/source/pages cloud_telemetry
@cd docs && make html
@echo "\nSummary ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
@echo "Documentation generated successfully."
@echo "Open docs/build/html/index.html in your browser."
@echo "Or serve it locally using:"
@echo "python -m http.server -d docs/build/html/"
.PHONY: d
d: docs
.PHONY: format-lint
format-lint:
@echo "\nRunning linter and formatter using ruff and typos +++++++++++++++++++++++++++++\n"
@poetry run ruff format && poetry run ruff check --fix
@typos .
.PHONY: fl
fl: format-lint
.PHONY: install
install:
@echo "\nInstalling this package its dependencies +++++++++++++++++++++++++++++++++\n"
@poetry install --with=code_quality,docs,misc,test,types,vulnerability
.PHONY: i
i: install
.PHONY: precommit-check
precommit-check:
@echo "\nRunning pre-commit checks +++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
@poetry run pre-commit run --all-files
.PHONY: pc
pc: precommit-check
.PHONY: security
security:
@echo "\nRunning security scans using bandit and safety ++++++++++++++++++++++++++++++++\n"
@poetry run safety check --full-report
@poetry run bandit -c pyproject.toml -r cloud_telemetry
.PHONY: s
s: security
.PHONY: test
test:
@echo "\nRunning tests using pytest ++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
@poetry run pytest tests/
.PHONY: t
t: test
.PHONY: type-check
type-check:
@echo "\nPerforming type checking with mypy ++++++++++++++++++++++++++++++++++++++++++++\n"
@poetry run mypy cloud_telemetry
.PHONY: tc
tc: type-check
.PHONY: update
update:
@echo "\nUpdating the template +++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
@echo "Using latest version from remote: https://github.com/elixir-cloud-aai/cookiecutter-python."
@poetry run cruff update -y
.PHONY: u
u: update
.PHONY: venv
venv:
@echo "\nCreating a virtual environment ++++++++++++++++++++++++++++++++++++++++++++++++\n"
@python -m venv .venv
@echo "\nSummary +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
@echo "Virtual environment created successfully."
@echo "To activate the environment for this shell session, run:"
@echo "source .venv/bin/activate"
.PHONY: v
v: venv
## Custom Targets #############################################################
# NOTE: Keep all the targets in alphabetical order for better readability.
# NOTE: Add any custom targets here if needed in the future.