-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (83 loc) · 3.55 KB
/
Copy pathMakefile
File metadata and controls
96 lines (83 loc) · 3.55 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
.PHONY: build build-spa build-chat-spa test test-cover vet lint docker docker-compose-up docker-compose-down clean generate-openapi
# Build the Workflow Builder SPA and embed it into the Go binary.
# Must be run before `make build` when the SPA has changed.
build-spa:
@echo "Building Workflow Builder SPA..."
@cd workflow-builder && npm run build
@echo "Copying SPA output to server/workflowui/dist/ ..."
@rm -rf server/workflowui/dist
@cp -r workflow-builder/build server/workflowui/dist
@echo "SPA embedded: server/workflowui/dist/ ($$(find server/workflowui/dist -type f | wc -l | tr -d ' ') files)"
# Build the Chat UI SPA and embed it into the Go binary.
# Must be run before `make build` when the chat SPA has changed.
build-chat-spa:
@echo "Building Chat UI SPA..."
@cd chat-ui && npm install && npm run build
@echo "Copying SPA output to server/chatui/dist/ ..."
@rm -rf server/chatui/dist
@cp -r chat-ui/build server/chatui/dist
@echo "Chat SPA embedded: server/chatui/dist/ ($$(find server/chatui/dist -type f | wc -l | tr -d ' ') files)"
# Build the binary (run `make build-spa` first if the SPA has changed)
build:
@echo "Building agentic-gateway..."
@mkdir -p bin
@go build -o bin/agentic-gateway main.go
@echo "Build complete: bin/agentic-gateway"
# Run all tests with race detector
test:
@echo "Running tests..."
@go test -race ./...
# Run tests with coverage report
test-cover:
@echo "Running tests with coverage..."
@go test -race -coverprofile=coverage.out ./...
@# Exclude generated protobuf code from coverage report
@grep -v 'provider/pb/' coverage.out > coverage_filtered.out
@go tool cover -html=coverage_filtered.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Run provider layer coverage check (targets: provider/ ≥80%, providers/ ≥85%)
test-cover-providers:
@echo "Provider layer coverage..."
@go test ./server/services/providers/... -coverprofile=providers.out -count=1
@echo "---"
@go test ./provider -coverprofile=provider.out -count=1
@echo "--- server/services/providers/ ---"
@go tool cover -func=providers.out | tail -1
@echo "--- provider/ (excluding generated pb/) ---"
@grep -v 'provider/pb/' provider.out > provider_filtered.out || true
@go tool cover -func=provider_filtered.out | tail -1
# Run go vet
vet:
@echo "Running go vet..."
@go vet ./...
# Run golangci-lint
lint:
@echo "Running golangci-lint..."
@which golangci-lint > /dev/null || (echo "golangci-lint not installed. Install with: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest" && exit 1)
@golangci-lint run
# Build Docker image
docker:
@echo "Building Docker image..."
@docker build -t agentic-gateway:latest .
@echo "Docker image built: agentic-gateway:latest"
# Start example stack with docker-compose
docker-compose-up:
@echo "Starting docker-compose stack..."
@docker-compose -f docker-compose.yaml up -d
@echo "Stack started. Gateway at http://localhost:8080, Langfuse at http://localhost:3000"
# Stop docker-compose stack
docker-compose-down:
@echo "Stopping docker-compose stack..."
@docker-compose -f docker-compose.yaml down
@echo "Stack stopped."
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -rf bin coverage.out coverage.html
@echo "Clean complete."
# Generate OpenAPI spec (placeholder - requires swag or similar tool)
generate-openapi:
@echo "Generating OpenAPI spec..."
@which swag > /dev/null || (echo "swag not installed. Install with: go install github.com/swaggo/swag/cmd/swag@latest" && exit 1)
@swag init -g main.go -o docs
@echo "OpenAPI spec generated: docs/swagger.yaml"