-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (67 loc) · 3.65 KB
/
Makefile
File metadata and controls
91 lines (67 loc) · 3.65 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
CLUSTER_NAME ?=omni-dev
OMNI_NAMESPACE ?=omni-system
.PHONY: run run-live docker-build docker-run kind-setup kind-forward security-scan check-deps minify-js helm-lint kind-down db-shell db-dump test test-e2e clean-local
# ── Local development ─────────────────────────────────────────────────────────
minify-js:
esbuild ui/static/app.js --minify --outfile=ui/static/app.min.js
run: minify-js
go run ./app
run-live: check-deps minify-js
air
# ── Docker ────────────────────────────────────────────────────────────────────
docker-build: minify-js
docker build -f pkg/Dockerfile -t omni:latest .
# Run the container locally. Pass GITHUB_TOKEN via env.
# Usage: make docker-run GITHUB_TOKEN=ghp_...
docker-run: docker-build
docker run --rm -p 8080:8080 \
-e GITHUB_TOKEN=$(GITHUB_TOKEN) \
-v omni-data:/data \
-e OMNI_DATA_DIR=/data \
omni:latest
# ── Kubernetes (kind) ─────────────────────────────────────────────────────────
# Full workflow: create cluster → build image → load into kind → helm install
# Usage: make kind-setup GITHUB_TOKEN=ghp_...
kind-setup:
GITHUB_TOKEN=$(GITHUB_TOKEN) ./scripts/kind-setup.sh
# Forward the service port after kind-setup is done
kind-forward:
kubectl port-forward -n $(OMNI_NAMESPACE) svc/omni 8080:8080
# Delete the kind cluster
kind-down:
kind delete cluster --name $(CLUSTER_NAME)
# ── Database ──────────────────────────────────────────────────────────────────
LOCAL_DB ?= dashie.db
POD := $(shell kubectl get pod -n $(OMNI_NAMESPACE) -l app.kubernetes.io/name=omni -o jsonpath='{.items[0].metadata.name}' 2>/dev/null)
POD_DB_PATH ?= /data/dashie.db
# Open an interactive sqlite3 shell against the local DB (requires sqlite3)
db-shell:
sqlite3 $(LOCAL_DB)
# Dump all rows from all tables in the local DB
# Example one-liner: sqlite3 dashie.db ".headers on" ".mode column" "SELECT * FROM animations;"
db-dump:
@sqlite3 $(LOCAL_DB) \
".headers on" \
".mode column" \
"SELECT '=== animations ===' AS '';" \
"SELECT name, source FROM animations;" \
"SELECT '=== variants ===' AS '';" \
"SELECT name, size, cols, rows, fps FROM variants;" \
"SELECT '=== animation_frames ===' AS '';" \
"SELECT name, size, length(frames) AS frames_bytes FROM animation_frames;"
# ── Testing ───────────────────────────────────────────────────────────────────
test:
go test ./...
test-e2e:
go test -v -timeout 60s ./pkg/api/ -run 'TestImport|TestExport'
# ── Utilities ─────────────────────────────────────────────────────────────────
helm-lint:
helm lint ./helm
check-deps:
@command -v trivy >/dev/null 2>&1 || { echo "trivy is not installed. Install it: https://aquasecurity.github.io/trivy"; exit 1; }
@command -v air >/dev/null 2>&1 || { echo "air is not installed. Install it: go install github.com/air-verse/air@latest"; exit 1; }
@echo "All dependencies found."
security-scan: docker-build check-deps
trivy image omni:latest
clean-local:
rm -f $(LOCAL_DB)