Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
342 lines (285 loc) · 18.7 KB
/
Copy pathMakefile
File metadata and controls
342 lines (285 loc) · 18.7 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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
SHELL := /bin/sh
.DEFAULT_GOAL := help
DOCKER_IMAGE_TAG := 1.6.4.dev11
FLASKAPI_DIR := ./flaskapi
NODE_DIR := ./node
## V31vr/B24kp: explicit host identity forwarded to the development compose
## launchers. The compose `user:` lines interpolate HOST_UID/HOST_GID; shell
## builtin UID/GID are never exported through make + /bin/sh (they silently
## degrade the pin to 1000:1000 on non-1000 hosts), so each dev launcher must
## pass these. The :-1000 fallbacks keep headless/CI launches usable.
HOST_ID_ENV := HOST_UID=$$(id -u) HOST_GID=$$(id -g)
## V45wk/B27wk: docker-compose.yml is NOT in the .bumpversion.cfg fan-out (§V5),
## so `docker compose build` tags every image with the .devN-stripped BASE while
## the dev composes and publish-local demand the full $(DOCKER_IMAGE_TAG) stamp.
## The build recipes must alias that stamp or `make run-develop-*` tries to PULL
## an image that was never built (registry "pull access denied"). RELEASE_TAG is
## DERIVED by stripping .devN — a second stamped literal would just re-open the
## drift; ⊥ literal versions in the alias machinery (pinned by
## flaskapi/tests/test_local_dev_image_tags.py).
RELEASE_TAG := $(shell printf '%s' '$(DOCKER_IMAGE_TAG)' | sed 's/\.dev[0-9][0-9]*$$//')
## Every image docker-compose.yml builds; tag-local aliases each
## :$(RELEASE_TAG) build to :$(DOCKER_IMAGE_TAG).
MMUX_LOCAL_IMAGES := \
simcore/services/dynamic/mmux-vite-backend \
simcore/services/dynamic/mmux-vite-web \
simcore/services/dynamic/mmux-vite-app-sumo-read \
simcore/services/dynamic/mmux-vite-app-sumo-write \
simcore/services/dynamic/mmux-vite-app-uq-read \
simcore/services/dynamic/mmux-vite-app-uq-write \
simcore/services/dynamic/mmux-vite-app-moga-read \
simcore/services/dynamic/mmux-vite-app-moga-write
## Front-end
install-node: ## install Node.js dependencies
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash
# nvm install 22 ## gets node v22 (latest)
cd ${NODE_DIR} && npm install # install all dependencies
start-frontend: ## start the Vite development server
cd ${NODE_DIR} && npm run dev
.PHONY: install-flaskapi-deps
install-flaskapi-deps: ## install Flask API Python dependencies
cd ${FLASKAPI_DIR} && make install-flaskapi-deps
.PHONY: check-types-flaskapi
check-types-flaskapi: install-flaskapi-deps ## run ty type checker against flaskapi/src/mmux_flaskapi
cd ${FLASKAPI_DIR} && make check-types-flaskapi
# Builds new service version ----------------------------------------------------------------------------
# Human base bumps run scripts/auto_version.py, NOT bump2version: the
# semver-only fanout entries (.osparc/*/metadata.yml, issue #695) carry the
# BASE while current_version may carry .devN, so bump2version's single
# `search = {current_version}` token no longer matches every file. `bump
# --part` raises the base across all entries (dev counter dropped) and
# re-checks the §V5 fanout; ensure_newer still refuses stale bases.
.PHONY: version-patch version-minor version-major
version-patch version-minor version-major: .bumpversion.cfg ## increases service's base version (semver-aware fanout)
@make compose-spec
@docker run -i --rm -v $(PWD):/ml-lab -e HOME=/tmp \
-u $(shell id -u):$(shell id -g) \
itisfoundation/ci-service-integration-library:v2.1.23 \
sh -c "cd /ml-lab && python3 scripts/auto_version.py bump --part $(subst version-,,$@)"
@make compose-spec
.PHONY: compose-spec
compose-spec: ## runs ooil to assemble the docker-compose.yml file
@docker run -i --rm -v $(PWD):/ml-lab \
-u $(shell id -u):$(shell id -g) \
itisfoundation/ci-service-integration-library:v2.1.23 \
sh -c "cd /ml-lab && ooil compose"
.PHONY: build
build: compose-spec ## build docker images
docker compose build
$(MAKE) tag-local
.PHONY: build-no-cache
build-no-cache: compose-spec ## build docker images
docker compose build --no-cache --pull --parallel
$(MAKE) tag-local
.PHONY: tag-local
tag-local: ## alias locally built images to $(DOCKER_IMAGE_TAG) for dev compose + publish-local (V45wk/B27wk)
@for img in $(MMUX_LOCAL_IMAGES); do \
echo "tagging $${img}:$(RELEASE_TAG) -> $${img}:$(DOCKER_IMAGE_TAG)"; \
docker tag "$${img}:$(RELEASE_TAG)" "$${img}:$(DOCKER_IMAGE_TAG)" || exit 1; \
done
## NB: VSCode might keep old credentials cached, even if changed in .env
## run in a non-VSCode terminal to avoid this
# DEVELOPMENT
.PHONY: run-develop-sumo-read
run-develop-sumo-read: ## runs for development SUMO/READ-ONLY
export SERVICE_MODE=SUMO && \
export PERMISSIONS=READ-ONLY && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-sumo-read && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-development.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
$(HOST_ID_ENV) docker compose --file docker-compose-development.yml up
.PHONY: run-develop-sumo-write
run-develop-sumo-write: ## runs for development SUMO/WRITE
export SERVICE_MODE=SUMO && \
export PERMISSIONS=WRITE && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-sumo-write && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-development.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
$(HOST_ID_ENV) docker compose --file docker-compose-development.yml up
.PHONY: run-develop-uq-read
run-develop-uq-read: ## runs for development UQ/READ-ONLY
export SERVICE_MODE=UQ && \
export PERMISSIONS=READ-ONLY && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-uq-read && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-development.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
$(HOST_ID_ENV) docker compose --file docker-compose-development.yml up
.PHONY: run-develop-uq-write
run-develop-uq-write: ## runs for development UQ/WRITE
export SERVICE_MODE=UQ && \
export PERMISSIONS=WRITE && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-uq-write && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-development.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
$(HOST_ID_ENV) docker compose --file docker-compose-development.yml up
.PHONY: run-develop-moga-read
run-develop-moga-read: ## runs for development MOGA/READ-ONLY
export SERVICE_MODE=MOGA && \
export PERMISSIONS=READ-ONLY && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-moga-read && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-development.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
$(HOST_ID_ENV) docker compose --file docker-compose-development.yml up
.PHONY: run-develop-moga-write
run-develop-moga-write: ## runs for development MOGA/WRITE
export SERVICE_MODE=MOGA && \
export PERMISSIONS=WRITE && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-moga-write && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-development.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
$(HOST_ID_ENV) docker compose --file docker-compose-development.yml up
# VALIDATION VERSIONS
.PHONY: run-prod-local-sumo-read
run-prod-local-sumo-read: ## runs for validation as it would be in production SUMO/READ-ONLY
export SERVICE_MODE=SUMO && \
export PERMISSIONS=READ-ONLY && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-sumo-read && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-local.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
docker compose --file docker-compose-local.yml up
.PHONY: run-prod-local-sumo-write
run-prod-local-sumo-write: ## runs for validation as it would be in production SUMO/WRITE
export SERVICE_MODE=SUMO && \
export PERMISSIONS=WRITE && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-sumo-write && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-local.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
docker compose --file docker-compose-local.yml up
.PHONY: run-prod-local-uq-read
run-prod-local-uq-read: ## runs for validation as it would be in production UQ/READ-ONLY
export SERVICE_MODE=UQ && \
export PERMISSIONS=READ-ONLY && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-uq-read && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-local.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
docker compose --file docker-compose-local.yml up
.PHONY: run-prod-local-uq-write
run-prod-local-uq-write: ## runs for validation as it would be in production UQ/WRITE
export SERVICE_MODE=UQ && \
export PERMISSIONS=WRITE && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-uq-write && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-local.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
docker compose --file docker-compose-local.yml up
.PHONY: run-prod-local-moga-read
run-prod-local-moga-read: ## runs for validation as it would be in production MOGA/READ-ONLY
export SERVICE_MODE=MOGA && \
export PERMISSIONS=READ-ONLY && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-moga-read && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-local.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
docker compose --file docker-compose-local.yml up
.PHONY: run-prod-local-moga-write
run-prod-local-moga-write: ## runs for validation as it would be in production MOGA/WRITE
export SERVICE_MODE=MOGA && \
export PERMISSIONS=WRITE && \
export DEPLOYMENT_MODE=LOCAL && \
export APP_IMAGE=mmux-vite-app-moga-write && \
export APP_PORT=$$(bash scripts/resolve-app-port.sh docker-compose-local.yml 8888) && \
printf '\n============================================================\nMMUX app URL (this WSL shell): http://localhost:%s\nMMUX app URL (Windows browser via WSL IP): http://%s:%s\n============================================================\n\n' "$$APP_PORT" "$$(hostname -I | awk '{print $$1}')" "$$APP_PORT" && \
docker compose --file docker-compose-local.yml up
.PHONY: publish-local
publish-local: ## push to local throw away registry to test integration
docker tag simcore/services/dynamic/mmux-vite-backend:${DOCKER_IMAGE_TAG} registry:5000/simcore/services/dynamic/mmux-vite-backend:$(DOCKER_IMAGE_TAG)
docker push registry:5000/simcore/services/dynamic/mmux-vite-backend:$(DOCKER_IMAGE_TAG)
docker tag simcore/services/dynamic/mmux-vite-web:${DOCKER_IMAGE_TAG} registry:5000/simcore/services/dynamic/mmux-vite-web:$(DOCKER_IMAGE_TAG)
docker push registry:5000/simcore/services/dynamic/mmux-vite-web:$(DOCKER_IMAGE_TAG)
docker tag simcore/services/dynamic/mmux-vite-app-sumo-read:${DOCKER_IMAGE_TAG} registry:5000/simcore/services/dynamic/mmux-vite-app-sumo-read:$(DOCKER_IMAGE_TAG)
docker push registry:5000/simcore/services/dynamic/mmux-vite-app-sumo-read:$(DOCKER_IMAGE_TAG)
docker tag simcore/services/dynamic/mmux-vite-app-sumo-write:${DOCKER_IMAGE_TAG} registry:5000/simcore/services/dynamic/mmux-vite-app-sumo-write:$(DOCKER_IMAGE_TAG)
docker push registry:5000/simcore/services/dynamic/mmux-vite-app-sumo-write:$(DOCKER_IMAGE_TAG)
docker tag simcore/services/dynamic/mmux-vite-app-uq-read:${DOCKER_IMAGE_TAG} registry:5000/simcore/services/dynamic/mmux-vite-app-uq-read:$(DOCKER_IMAGE_TAG)
docker push registry:5000/simcore/services/dynamic/mmux-vite-app-uq-read:$(DOCKER_IMAGE_TAG)
docker tag simcore/services/dynamic/mmux-vite-app-uq-write:${DOCKER_IMAGE_TAG} registry:5000/simcore/services/dynamic/mmux-vite-app-uq-write:$(DOCKER_IMAGE_TAG)
docker push registry:5000/simcore/services/dynamic/mmux-vite-app-uq-write:$(DOCKER_IMAGE_TAG)
docker tag simcore/services/dynamic/mmux-vite-app-moga-read:${DOCKER_IMAGE_TAG} registry:5000/simcore/services/dynamic/mmux-vite-app-moga-read:$(DOCKER_IMAGE_TAG)
docker push registry:5000/simcore/services/dynamic/mmux-vite-app-moga-read:$(DOCKER_IMAGE_TAG)
docker tag simcore/services/dynamic/mmux-vite-app-moga-write:${DOCKER_IMAGE_TAG} registry:5000/simcore/services/dynamic/mmux-vite-app-moga-write:$(DOCKER_IMAGE_TAG)
docker push registry:5000/simcore/services/dynamic/mmux-vite-app-moga-write:$(DOCKER_IMAGE_TAG)
@curl registry:5000/v2/_catalog | jq
.PHONY: build-publish-local
build-publish-local: build-no-cache publish-local
.env: .env-devel ## creates .env file from defaults in .env-devel
$(if $(wildcard $@), \
@echo "WARNING ##### $< is newer than $@ ####"; diff -uN $@ $<; false;,\
@echo "WARNING ##### $@ does not exist, cloning $< as $@ ############"; cp $< $@)
.PHONY: clean
clean: ## clean build artifacts and dependencies
rm -rf node/node_modules
rm -rf flaskapi/.venv
.PHONY: prek pre-commit
prek: install-node install-flaskapi-deps ## run repository prek hooks
uvx prek run --all-files
pre-commit: prek ## backward-compatible alias for prek
# TESTING
.PHONY: test-node
test-node: clean ## run Node.js tests
cd ${NODE_DIR} && \
npm ci && \
npm test
.PHONY: test-flaskapi
test-flaskapi: install-flaskapi-deps ## run Flask backend tests (excludes real-Dakota analytical tests)
cd ${FLASKAPI_DIR} && \
uv run pytest tests/ -v -m "not analytical" --cov-report=html --cov-report=term-missing
.PHONY: tests-flaskapi
tests-flaskapi: test-flaskapi ## alias for test-flaskapi
.PHONY: test-flaskapi-analytical
test-flaskapi-analytical: install-flaskapi-deps ## run real-Dakota analytical integration tests (Tier 3)
cd ${FLASKAPI_DIR} && \
uv run pytest tests/ -v -m analytical --cov-report=html --cov-report=term-missing
.PHONY: test-e2e
test-e2e: ## run the Playwright read-only pixel-snapshot e2e suite (SuMo/UQ/MOGA; boots backend+web via webServer)
cd ${NODE_DIR} && npm run test:e2e
.PHONY: test-e2e-lane
LANE ?=
test-e2e-lane: ## run ONE file-grouped e2e lane (LANE=uq-moga|sumo|behavior; CI split, see tests/e2e/scripts/run-e2e-lane.sh + root SPEC T47sl)
cd ${NODE_DIR} && LANE="$(LANE)" npm run test:e2e:lane
.PHONY: clean-e2e-snapshots
clean-e2e-snapshots: ## delete all committed e2e pixel baselines (run before regen so an unreached screenshot goes missing, not silently stale, see V36ez)
find tests/e2e/__snapshots__ -name '*.png' -delete
.PHONY: test-e2e-update
test-e2e-update: clean-e2e-snapshots ## regenerate read-only e2e pixel baselines (SuMo/UQ/MOGA; run only in the pinned Playwright docker image, see V12)
cd ${NODE_DIR} && npm run test:e2e:update
.PHONY: test-e2e-update-docker
PLAYWRIGHT_IMAGE := mcr.microsoft.com/playwright:v1.64.0-noble
test-e2e-update-docker: ## regenerate e2e baselines INSIDE the pinned Playwright image (font-stable, see V12); keep tag == @playwright/test
docker run --rm --user root --network host \
-v "$(PWD)":/work -w /work -e HOME=/root \
$(PLAYWRIGHT_IMAGE) \
bash /work/tests/e2e/scripts/gen-baselines.sh
.PHONY: test-e2e-docker
test-e2e-docker: ## verify e2e pixel diff vs committed baselines INSIDE the pinned Playwright image (mirrors CI, see V12,§C)
docker run --rm --user root --network host \
-v "$(PWD)":/work -w /work -e HOME=/root -e E2E_MAKE_TARGET=test-e2e \
$(PLAYWRIGHT_IMAGE) \
bash /work/tests/e2e/scripts/gen-baselines.sh
# BENCHMARKING (CodSpeed)
.PHONY: bench-flaskapi
bench-flaskapi: install-flaskapi-deps ## run the Flask API CodSpeed benchmarks (CPU simulation)
cd ${FLASKAPI_DIR} && \
codspeed run --mode simulation -- \
uv run --with 'pytest-codspeed>=5,<6' pytest benchmarks/ --codspeed --no-cov
.PHONY: bench-node
bench-node: ## run the frontend CodSpeed benchmarks (CPU simulation)
cd ${NODE_DIR} && npm ci && codspeed run --mode simulation -- npm run bench
.PHONY: bench
bench: bench-flaskapi bench-node ## run all CodSpeed benchmarks locally
.PHONY: ci
ci: test-flaskapi test-node build-no-cache ## mimmicks the GitHub CI
.PHONY: help
help: ## this colorful help
@echo "Recipes for '$(notdir $(CURDIR))':"
@echo ""
@awk --posix 'BEGIN {FS = ":.*## "} /^[[:alnum:]_.-]+([[:space:]]+[[:alnum:]_.-]+)*:.*## / {count = split($$1, targets, /[[:space:]]+/); for (i = 1; i <= count; i++) printf "\033[36m%-20s\033[0m %s\n", targets[i], $$2}' $(MAKEFILE_LIST)
@echo ""