-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
181 lines (147 loc) · 6.1 KB
/
Makefile
File metadata and controls
181 lines (147 loc) · 6.1 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
.PHONY: all backend frontend dev dev-e2e backend-e2e install clean build build-prod release \
e2e-install e2e-test e2e-test-headed e2e-test-ui e2e-smoke e2e-tier1 e2e-tier2 e2e-tier3 e2e-report
# Version from git tag or default
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -s -w -X github.com/thelinuxer/pgvoyager/internal/version.Version=$(VERSION)
# Default target: run both backend and frontend
dev:
@echo "Starting PgVoyager (dev mode - isolated config)..."
@echo "App available at http://localhost:5137"
@echo "Config directory: /tmp/pgvoyager-dev-config"
@make -j2 backend frontend
# Run for e2e tests with isolated config directory (doesn't affect your real config)
dev-e2e:
@echo "Starting PgVoyager for e2e tests (isolated config)..."
@echo "App available at http://localhost:5137"
@echo "Config directory: /tmp/pgvoyager-e2e-config"
@make -j2 backend-e2e frontend
# Run backend for e2e tests with isolated config
backend-e2e:
@echo "Starting Go backend on port 5138 (e2e mode)..."
cd backend && PGVOYAGER_PORT=5138 PGVOYAGER_CONFIG_DIR=/tmp/pgvoyager-e2e-config go run ./cmd/server
# Run backend in development mode (on port 5138, proxied by frontend)
backend:
@echo "Starting Go backend on port 5138..."
cd backend && PGVOYAGER_PORT=5138 PGVOYAGER_CONFIG_DIR=/tmp/pgvoyager-dev-config go run ./cmd/server
# Run frontend in development mode
frontend:
@echo "Starting SvelteKit frontend..."
cd frontend && npm run dev
# Install all dependencies
install:
@echo "Installing backend dependencies..."
cd backend && go mod download
@echo "Installing frontend dependencies..."
cd frontend && npm install
# Build for development (separate binaries)
build:
@echo "Building backend..."
cd backend && go build -o ../bin/pgvoyager ./cmd/server
@echo "Building MCP server..."
cd backend && go build -o ../bin/pgvoyager-mcp ./cmd/mcp
@echo "Building frontend..."
cd frontend && npm run build
# Build production single binary with embedded frontend
build-prod: build-frontend-prod
@echo "Building production binary..."
cd backend && go build -ldflags="$(LDFLAGS)" -o ../bin/pgvoyager ./cmd/server
@echo "Building MCP server..."
cd backend && go build -ldflags="$(LDFLAGS)" -o ../bin/pgvoyager-mcp ./cmd/mcp
@echo "Production build complete: bin/pgvoyager"
# Build frontend and copy to backend/web/dist for embedding
build-frontend-prod:
@echo "Building frontend for production..."
cd frontend && npm run build
@echo "Copying frontend build to backend/web/dist..."
rm -rf backend/web/dist/*
cp -r frontend/build/* backend/web/dist/
# Cross-compile for all platforms
release: build-frontend-prod
@echo "Building releases for all platforms..."
@mkdir -p releases
# Linux AMD64
@echo "Building linux-amd64..."
cd backend && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o ../releases/pgvoyager-linux-amd64 ./cmd/server
cd backend && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o ../releases/pgvoyager-mcp-linux-amd64 ./cmd/mcp
# Linux ARM64
@echo "Building linux-arm64..."
cd backend && GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o ../releases/pgvoyager-linux-arm64 ./cmd/server
cd backend && GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o ../releases/pgvoyager-mcp-linux-arm64 ./cmd/mcp
# macOS AMD64
@echo "Building darwin-amd64..."
cd backend && GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o ../releases/pgvoyager-darwin-amd64 ./cmd/server
cd backend && GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o ../releases/pgvoyager-mcp-darwin-amd64 ./cmd/mcp
# macOS ARM64 (Apple Silicon)
@echo "Building darwin-arm64..."
cd backend && GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o ../releases/pgvoyager-darwin-arm64 ./cmd/server
cd backend && GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o ../releases/pgvoyager-mcp-darwin-arm64 ./cmd/mcp
# Windows AMD64
@echo "Building windows-amd64..."
cd backend && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o ../releases/pgvoyager-windows-amd64.exe ./cmd/server
cd backend && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o ../releases/pgvoyager-mcp-windows-amd64.exe ./cmd/mcp
@echo "Release builds complete in releases/"
@ls -lh releases/
# Clean build artifacts
clean:
rm -rf bin/
rm -rf releases/
rm -rf frontend/.svelte-kit
rm -rf frontend/build
# Run backend only (dev mode - isolated config)
run-backend:
cd backend && PGVOYAGER_CONFIG_DIR=/tmp/pgvoyager-dev-config go run ./cmd/server
# Run frontend only
run-frontend:
cd frontend && npm run dev
# Run production binary
run-prod:
PGVOYAGER_MODE=production ./bin/pgvoyager
# Build backend binary
build-backend:
cd backend && go build -o ../bin/pgvoyager ./cmd/server
# Build MCP server binary
build-mcp:
cd backend && go build -o ../bin/pgvoyager-mcp ./cmd/mcp
# Build frontend for production
build-frontend:
cd frontend && npm run build
# ====================
# E2E Testing Commands
# ====================
# Install E2E test dependencies
e2e-install:
@echo "Installing E2E test dependencies..."
cd e2e && npm install
cd e2e && npx playwright install chromium --with-deps
# Run all E2E tests (headless)
e2e-test:
@echo "Running all E2E tests..."
cd e2e && npm test
# Run E2E tests in headed mode (visible browser)
e2e-test-headed:
@echo "Running E2E tests in headed mode..."
cd e2e && npm run test:headed
# Run E2E tests with Playwright UI
e2e-test-ui:
@echo "Opening Playwright UI..."
cd e2e && npm run test:ui
# Run smoke tests only
e2e-smoke:
@echo "Running smoke tests..."
cd e2e && npm run test:smoke
# Run Tier 1 (critical) tests
e2e-tier1:
@echo "Running Tier 1 (critical) tests..."
cd e2e && npm run test:tier1
# Run Tier 2 (important) tests
e2e-tier2:
@echo "Running Tier 2 (important) tests..."
cd e2e && npm run test:tier2
# Run Tier 3 (extended) tests
e2e-tier3:
@echo "Running Tier 3 (extended) tests..."
cd e2e && npm run test:tier3
# Open test report
e2e-report:
@echo "Opening test report..."
cd e2e && npm run report