-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathMakefile
More file actions
133 lines (96 loc) · 5.57 KB
/
Copy pathMakefile
File metadata and controls
133 lines (96 loc) · 5.57 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
.DEFAULT_GOAL := help
.PHONY: help \
coordinator-test coordinator-build coordinator-build-linux coordinator \
prompt-sidecar-format prompt-sidecar-check prompt-sidecar-test prompt-sidecar-build prompt-sidecar \
provider-build provider-test provider benchmark-gemma-contbatch benchmark-wrapper-test \
ui-install ui-build ui-lint ui-test ui \
e2e-integration e2e-benchmark e2e \
docs-check docs-impact-check docs-stamp \
test build all clean
help:
@awk 'BEGIN {FS = ":.*##"; printf "Usage: make <target>\n\nTargets:\n"} \
/^[a-zA-Z0-9_-]+:.*##/ {printf " %-22s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# ---- Coordinator (Go) ------------------------------------------------------
coordinator-test: ## Run Go unit tests for the coordinator
cd coordinator && go test ./...
coordinator-build: ## Build the coordinator binary for the host platform
cd coordinator && go build ./cmd/coordinator
coordinator-build-linux: ## Cross-compile coordinator for linux/amd64 (EigenCloud)
cd coordinator && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build -o coordinator-linux ./cmd/coordinator
coordinator: coordinator-test coordinator-build ## Test + build coordinator
# ---- Prompt-contract sidecar (Rust) ---------------------------------------
prompt-sidecar-format: ## Check Rust sidecar formatting
cd coordinator/promptsidecar && cargo fmt --all -- --check
prompt-sidecar-check: ## Check and lint all Rust sidecar targets
cd coordinator/promptsidecar && cargo check --locked --all-targets
cd coordinator/promptsidecar && cargo clippy --locked --all-targets -- -D warnings
prompt-sidecar-test: ## Run Rust sidecar tests
cd coordinator/promptsidecar && cargo test --locked --all-targets
prompt-sidecar-build: ## Build the Rust sidecar for the host platform
cd coordinator/promptsidecar && cargo build --locked --release --bin promptsidecar
prompt-sidecar: prompt-sidecar-format prompt-sidecar-check prompt-sidecar-test prompt-sidecar-build ## Format + lint + test + build Rust sidecar
# ---- Provider (Swift, Apple Silicon) --------------------------------------
provider-build: ## Build the Swift provider CLI with its source-matched metallib
cd provider-swift && swift build
@set -eu; \
bin_path="$$(cd provider-swift && swift build --show-bin-path)"; \
./scripts/fetch-metallib.sh "$$bin_path"
provider-test: ## Build and run Swift provider tests with source-matched metallibs
cd provider-swift && swift build --build-tests
@set -eu; \
bin_path="$$(cd provider-swift && swift build --show-bin-path)"; \
./scripts/fetch-metallib.sh "$$bin_path"; \
runner_tmp=""; \
trap 'test -z "$$runner_tmp" || rm -f "$$runner_tmp"' EXIT; \
trap 'exit 143' HUP INT TERM; \
found=0; \
for bundle in "$$bin_path"/*PackageTests.xctest; do \
[ -d "$$bundle" ] || continue; \
runner_dir="$$bundle/Contents/MacOS"; \
mkdir -p "$$runner_dir"; \
runner_tmp="$$runner_dir/.mlx.metallib.$$$$"; \
cp "$$bin_path/mlx.metallib" "$$runner_tmp"; \
mv -f "$$runner_tmp" "$$runner_dir/mlx.metallib"; \
runner_tmp=""; \
found=1; \
done; \
[ "$$found" -eq 1 ] || { echo "provider test runner bundle not found in $$bin_path" >&2; exit 1; }; \
trap - EXIT HUP INT TERM
cd provider-swift && ../scripts/run-provider-tests.sh
provider: provider-build provider-test ## Build + test provider
benchmark-wrapper-test: ## Unit-test the Gemma benchmark wrapper (no GPU or weights)
cd scripts && python3 -m unittest discover -s gemma_contbatch/tests -t .
benchmark-gemma-contbatch: ## Build and benchmark Gemma 4 26B continuous batching
python3 scripts/benchmark-gemma-contbatch.py $(GEMMA_BENCHMARK_ARGS)
# ---- Console UI (Next.js 16) ----------------------------------------------
ui-install: ## npm install for console-ui
cd console-ui && npm install
ui-build: ## next build for console-ui
cd console-ui && npm run build
ui-lint: ## eslint check for console-ui sources
cd console-ui && npx eslint src/
ui-test: ## vitest for console-ui
cd console-ui && npm test
ui: ui-install ui-lint ui-test ui-build ## Install, lint, test, build console-ui
# ---- E2E integration tests -------------------------------------------------
# Requires Postgres + Swift provider binary + MLX model downloaded.
e2e-integration: ## go test ./e2e/... -run TestIntegration
go test ./e2e/... -run TestIntegration -v
e2e-benchmark: ## go test ./e2e/... -run TestBenchmark (load benchmarks)
go test ./e2e/... -run TestBenchmark -v
e2e: e2e-integration ## Run the integration suite
# ---- Docs -------------------------------------------------------------------
docs-check: ## Lint docs/: freshness stamps, relative links, cited code paths, orphans
./scripts/docs-check.sh
docs-impact-check: ## Check source changes have their mapped canonical docs (BASE=origin/master)
python3 scripts/docs-impact-check.py --base "$(if $(BASE),$(BASE),origin/master)"
docs-stamp: ## Refresh the freshness stamp on changed docs (FILES=... to target specific files)
./scripts/docs-stamp.sh $(FILES)
# ---- Aggregates ------------------------------------------------------------
test: coordinator-test prompt-sidecar-test provider-test ui-test benchmark-wrapper-test docs-check ## Run all unit tests + docs lint
build: coordinator-build prompt-sidecar-build provider-build ui-build ## Build all components
all: test build ## Test + build everything
clean: ## Remove built artifacts
rm -f coordinator/coordinator coordinator/coordinator-linux
rm -rf coordinator/promptsidecar/target provider-swift/.build console-ui/.next console-ui/node_modules