Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (60 loc) · 2.07 KB
/
Copy pathMakefile
File metadata and controls
72 lines (60 loc) · 2.07 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
# Rollerball — root Makefile
# Usage: make start | make stop | make status | make monitor
.PHONY: start stop status monitor engine web test test-engine test-web
SCRIPTS := scripts
## start — avvia engine + web in parallelo con log colorati
start:
@bash $(SCRIPTS)/start.sh
## stop — ferma engine e web
stop:
@bash $(SCRIPTS)/stop.sh
## status — health check one-shot su engine (:8080) e web (:3000)
status:
@echo ""
@printf " \033[1mENGINE\033[0m :8080 ... "
@result=$$(curl -sf --max-time 3 http://localhost:8080/health 2>/dev/null); \
if [ $$? -eq 0 ]; then \
printf "\033[0;32m● UP\033[0m\n"; \
else \
printf "\033[0;31m✖ DOWN\033[0m\n"; \
fi
@printf " \033[1mWEB\033[0m :3000 ... "
@curl -sf --max-time 3 http://localhost:3000 > /dev/null 2>&1 \
&& printf "\033[0;32m● UP\033[0m\n" \
|| printf "\033[0;31m✖ DOWN\033[0m\n"
@echo ""
## monitor — TUI live dashboard (refresh 2s, q per uscire)
monitor:
@bash $(SCRIPTS)/monitor.sh
## engine — avvia solo l'engine Go
engine:
cd engine && go run ./cmd/api
## web — avvia solo il frontend Next.js
web:
cd web && npm run dev
## test — esegue test engine (Go) + web (Vitest)
test: test-engine test-web
## test-engine — go test su tutto il package engine
test-engine:
@echo "\033[1;33m▶ engine tests\033[0m"
@cd engine && go test -race -count=1 ./...
## test-web — vitest run su tutto il package web
test-web:
@echo "\033[1;33m▶ web tests\033[0m"
@cd web && npm test --silent
## help — mostra questo messaggio
help:
@echo ""
@echo " \033[1;33mRollerball — comandi disponibili\033[0m"
@echo ""
@echo " make start avvia engine + web (log colorati, Ctrl-C per fermare)"
@echo " make stop ferma engine + web"
@echo " make status health check rapido"
@echo " make monitor TUI live dashboard"
@echo " make engine avvia solo l'engine Go"
@echo " make web avvia solo il frontend Next.js"
@echo ""
@echo " make test test engine + web"
@echo " make test-engine solo go test (engine)"
@echo " make test-web solo vitest (web)"
@echo ""