-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
261 lines (201 loc) · 7.43 KB
/
Makefile
File metadata and controls
261 lines (201 loc) · 7.43 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
.DEFAULT_GOAL := help
.PHONY: help
help:
@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@echo " ⛧ INDICO DISTRO SPELLS ⛧"
@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@echo ""
@echo "⟐ Runtime:"
@echo " make run - Start Indico in dev mode"
@echo " make tmux - Launch the tmux session"
@echo " make config - Edit indico.conf"
@echo ""
@echo "⟐ Environment:"
@echo " make deps - Install all dependencies (Python + JS)"
@echo " make deps-core - Install core-only dependencies"
@echo " make deps-distro - Install distribution-only dependencies"
@echo " make deps-plugin - Install plugin dependencies (plugin=<path>)"
@echo ""
@echo "⟐ Assets:"
@echo " make assets - Build all assets"
@echo " make assets-core - Build core assets"
@echo " make assets-distro - Build distro assets"
@echo " make assets-plugin - Build plugin assets (plugin=<path>)"
@echo " make assets-core-watch - Watch core assets in dev mode"
@echo " make assets-distro-watch - Watch distro assets in dev mode"
@echo " make assets-plugin-watch - Watch plugin assets in dev mode"
@echo ""
@echo "⟐ Cleaning:"
@echo " make clean - Remove envs and built assets"
@echo " make clean-env - Remove virtualenv and node_modules"
@echo " make clean-assets - Remove built assets"
@echo ""
@echo "⟐ Checks:"
@echo " make lint - Run all linters"
@echo " make lint-py - Lint Python code"
@echo " make lint-js - Lint JavaScript/TypeScript"
@echo " make lint-headers - Check file headers"
@echo ""
@echo "⟐ Tests:"
@echo " make test - Run all tests"
@echo " make test-py - Run Python tests"
@echo " make test-js - Run JavaScript tests"
@echo ""
@echo "⟐ Builds:"
@echo " make container - Build container image"
@echo " make wheels - Build all wheels"
@echo " make wheel-core - Build core wheel"
@echo " make wheel-distro - Build distro wheel"
@echo " make wheel-plugin - Build plugin wheel (plugin=<path>)"
@echo ""
@echo "⟐ Debugging:"
@echo " make log-app - Tail application log (INDICO_APP_PATH required)"
@echo " make log-db - Tail DB log"
@echo ""
@echo "Note: set plugin=<path> for plugin targets (e.g., plugin=indico-plugins/prometheus)."
## -- runtime ------------------------------------------------------------------
.PHONY: run
run:
uv run indico run --quiet --enable-evalex
.PHONY: tmux
tmux:
tmuxp load -d "./tmuxp.yaml" && tmux -CC attach -t "indicorp"
.PHONY: config
config:
$${EDITOR:-vi} indico/indico/indico.conf
# -- environment ---------------------------------------------------------------
# Full setup of development environment
.PHONY: deps
deps: deps-py deps-js
.PHONY: deps-py
deps-py: deps-distro-py
.PHONY: deps-js
deps-js: deps-core-js deps-distro-js
# Setup of distribution-only environment
.PHONY: deps-distro
deps-distro: deps-distro-py deps-distro-js
.PHONY: deps-distro-py
deps-distro-py:
uv sync --locked
.PHONY: deps-distro-js
deps-distro-js:
npm ci
# Setup of core-only environment
.PHONY: deps-core
deps-core: deps-core-py deps-core-js
.PHONY: deps-core-py
deps-core-py:
uv pip install --requirement indico/requirements.txt
uv pip install --requirement indico/requirements.dev.txt
uv pip install --editable indico
.PHONY: deps-core-js
deps-core-js:
cd indico && npm ci
# Setup of plugin-specific environment
# These targets require the 'plugin' variable to be set, e.g.:
# make deps-plugin plugin=indico-plugins/prometheus
.PHONY: deps-plugin
deps-plugin: _check_plugin deps-plugin-py deps-plugin-js
.PHONY: deps-plugin-py
deps-plugin-py: _check_plugin
uv pip install --editable plugins/$(plugin)
.PHONY: deps-plugin-js
deps-plugin-js: _check_plugin
cd plugins/$(plugin) && npm ci
# -- assets --------------------------------------------------------------------
.PHONY: assets
assets: assets-core assets-distro
.PHONY: assets-core
assets-core:
uv run indico/bin/maintenance/build-assets.py indico --dev
.PHONY: assets-distro
assets-distro:
uv run indico/bin/maintenance/build-assets.py plugin --dev ..
.PHONY: assets-plugin
assets-plugin: _check_plugin
uv run indico/bin/maintenance/build-assets.py plugin --dev ../plugins/$(plugin)
# Assets in watch mode for development
.PHONY: assets-core-watch
assets-core-watch:
uv run indico/bin/maintenance/build-assets.py indico --dev --watch
.PHONY: assets-distro-watch
assets-distro-watch:
uv run indico/bin/maintenance/build-assets.py plugin --dev --watch ..
.PHONY: assets-plugin-watch
assets-plugin-watch:
uv run indico/bin/maintenance/build-assets.py plugin --dev --watch ../plugins/$(plugin)
# -- cleaning ------------------------------------------------------------------
.PHONY: clean
clean: clean-env clean-assets
.PHONY: clean-env
clean-env: clean-py clean-js
.PHONY: clean-py
clean-py:
rm -rf .venv
.PHONY: clean-js
clean-js:
rm -rf node_modules
rm -rf indico/node_modules
.PHONY: clean-assets
clean-assets:
rm -rf indicorp/static/dist
rm -rf indico/indico/web/static/dist
rm url_map.json
rm indico/url_map.json
## -- checks -------------------------------------------------------------------
.PHONY: lint
lint: lint-py lint-js lint-headers
.PHONY: lint-py
lint-py:
uv run ruff check --output-format=concise .
.PHONY: lint-py-ci
lint-py-ci:
uv run ruff check --output-format=github .
.PHONY: lint-js
lint-js:
@echo "No JS linter defined yet"
.PHONY: lint-headers
lint-headers:
uv run unbehead --check
## -- tests --------------------------------------------------------------------
.PHONY: test
test: test-py test-js
.PHONY: test-py
test-py:
# Treat exit code 5 (no tests were collected) as success
uv run pytest || [ $$? -eq 5 ]
.PHONY: test-js
test-js:
@echo "No JS tests defined yet"
# -- builds --------------------------------------------------------------------
.PHONY: container
container:
bin/build-container.sh
.PHONY: wheels
wheels: wheel-core wheel-distro
.PHONY: wheel-distro
wheel-distro:
uv run indico/bin/maintenance/build-wheel.py plugin --no-git ..
.PHONY: wheel-core
wheel-core:
uv run indico/bin/maintenance/build-wheel.py indico --no-git
.PHONY: wheel-plugin
wheel-plugin: _check_plugin
uv run indico/bin/maintenance/build-wheel.py plugin --no-git ../plugins/$(plugin)
## -- debugging ----------------------------------------------------------------
.PHONY: log-app
log-app: _check_app_path
tail -f "$${INDICO_APP_PATH}/data/log/indico.log"
.PHONY: log-db
log-db:
uv run python indico/bin/utils/db_log.py -S
## -- utils --------------------------------------------------------------------
.PHONY: _check_app_path
_check_app_path:
ifndef INDICO_APP_PATH
$(error INDICO_APP_PATH envvar is not set)
endif
.PHONY: _check_plugin
_check_plugin:
@if [ -z "$(plugin)" ]; then (echo "error: plugin was undefined"; exit 1); fi
@if [ ! -d "plugins/$(plugin)" ]; then (echo "error: plugin $(plugin) doesn't exist"; exit 1); fi