-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
233 lines (193 loc) · 6.59 KB
/
Makefile
File metadata and controls
233 lines (193 loc) · 6.59 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# Data Wings Development Makefile
# Usage: make <target>
.PHONY: help install setup dev dev-smoke dev-web dev-api dev-ai build test lint clean docker-up docker-down docker-logs docker-clean seed seed-clean sandbox-dry-run sandbox-task
# Default target
help:
@echo "Data Wings Development Commands"
@echo ""
@echo "Setup:"
@echo " make install Install all dependencies"
@echo " make setup Full setup (install + docker + seed)"
@echo ""
@echo "Development:"
@echo " make dev Start all services in dev mode"
@echo " make dev-smoke Smoke check (api+ai health)"
@echo " make dev-web Start frontend only"
@echo " make dev-api Start Go API only"
@echo " make dev-ai Start Python AI service only"
@echo ""
@echo "Build:"
@echo " make build Build all packages"
@echo " make build-sdk Build SDK package"
@echo " make build-api Build Go API binary"
@echo ""
@echo "Testing:"
@echo " make test Run all tests"
@echo " make test-sdk Run SDK tests"
@echo " make test-api Run Go API tests"
@echo " make test-ai Run Python AI tests"
@echo ""
@echo "Docker:"
@echo " make docker-up Start Docker services (ClickHouse, Redis)"
@echo " make docker-down Stop Docker services"
@echo " make docker-logs View Docker logs"
@echo ""
@echo "Data:"
@echo " make seed Generate seed data for testing"
@echo " make seed-clean Clear all test data"
@echo ""
@echo "Utilities:"
@echo " make lint Run linters"
@echo " make format Format code"
@echo " make clean Clean build artifacts"
@echo ""
@echo "Sandbox:"
@echo " make sandbox-dry-run TASK=docs-audit CMD='ls -la /workspace/doc'"
@echo " make sandbox-task TASK=go-unit CMD='cd /workspace/services/api && go test ./...'"
# =============================================================================
# Setup
# =============================================================================
install:
@echo "Installing Node.js dependencies..."
pnpm install
@echo "Installing Python dependencies..."
cd services/ai && pip install -e ".[dev]" || true
@echo "Installing Go dependencies..."
cd services/api && go mod download
@echo "Done!"
setup: install docker-up
@echo "Waiting for services to be ready..."
sleep 5
$(MAKE) seed
@echo ""
@echo "Setup complete! Run 'make dev' to start development."
# =============================================================================
# Development
# =============================================================================
dev:
@echo "Starting all services (web + api + ai)..."
./scripts/dev_all.sh
dev-smoke:
@echo "Running dev stack smoke (api+ai health)..."
./scripts/dev_all.sh --smoke --no-web
dev-web:
@echo "Starting frontend..."
pnpm dev --filter @data-wings/web
dev-api:
@echo "Starting Go API..."
cd services/api && go run ./cmd/server
dev-ai:
@echo "Starting Python AI service..."
cd services/ai && uvicorn src.main:app --reload --port 8001
# =============================================================================
# Build
# =============================================================================
build:
@echo "Building all packages..."
pnpm build
build-sdk:
@echo "Building SDK..."
pnpm build --filter @data-wings/sdk
build-api:
@echo "Building Go API..."
cd services/api && CGO_ENABLED=0 go build -o bin/server ./cmd/server
build-docker:
@echo "Building Docker images..."
docker compose build
# =============================================================================
# Testing
# =============================================================================
test:
@echo "Running all tests..."
pnpm test
cd services/api && go test -v ./...
cd services/ai && pytest -v
test-sdk:
@echo "Running SDK tests..."
pnpm test --filter @data-wings/sdk
test-api:
@echo "Running Go API tests..."
cd services/api && go test -v ./...
test-ai:
@echo "Running Python AI tests..."
cd services/ai && pytest -v
# =============================================================================
# Docker
# =============================================================================
docker-up:
@echo "Starting Docker services..."
docker compose up -d clickhouse redis
@echo "Services started. Use 'make docker-logs' to view logs."
docker-down:
@echo "Stopping Docker services..."
docker compose down
docker-logs:
docker compose logs -f
docker-clean:
@echo "Removing Docker volumes..."
docker compose down -v
# =============================================================================
# Data
# =============================================================================
seed:
@echo "Generating seed data..."
@if command -v python3 >/dev/null 2>&1; then \
python3 scripts/seed_data.py; \
else \
echo "Python3 not found. Please install Python 3.11+"; \
fi
seed-clean:
@echo "Clearing test data..."
@echo "TRUNCATE TABLE events; TRUNCATE TABLE users;" | \
docker compose exec -T clickhouse clickhouse-client --database=data_wings || true
# =============================================================================
# Utilities
# =============================================================================
lint:
@echo "Linting code..."
pnpm lint
cd services/api && golangci-lint run || true
cd services/ai && ruff check src/ || true
format:
@echo "Formatting code..."
pnpm format
cd services/api && gofmt -w . || true
cd services/ai && ruff format src/ || true
clean:
@echo "Cleaning build artifacts..."
pnpm clean
rm -rf services/api/bin
rm -rf services/ai/.pytest_cache
rm -rf services/ai/__pycache__
find . -name "*.pyc" -delete
find . -name "__pycache__" -type d -delete
# =============================================================================
# Sandbox
# =============================================================================
sandbox-dry-run:
@if [ -z "$(TASK)" ] || [ -z "$(CMD)" ]; then \
echo "Usage: make sandbox-dry-run TASK=<task> CMD='<command>'"; \
exit 1; \
fi
./scripts/sandbox_task.sh --dry-run $(TASK) -- "$(CMD)"
sandbox-task:
@if [ -z "$(TASK)" ] || [ -z "$(CMD)" ]; then \
echo "Usage: make sandbox-task TASK=<task> CMD='<command>'"; \
exit 1; \
fi
./scripts/sandbox_task.sh $(TASK) -- "$(CMD)"
# =============================================================================
# Release
# =============================================================================
release-patch:
@echo "Creating patch release..."
npm version patch
git push && git push --tags
release-minor:
@echo "Creating minor release..."
npm version minor
git push && git push --tags
release-major:
@echo "Creating major release..."
npm version major
git push && git push --tags