-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (48 loc) · 2.58 KB
/
Makefile
File metadata and controls
64 lines (48 loc) · 2.58 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
.PHONY: build build-frontend build-go dev-frontend dev-backend run-serve run-ask tidy lint test generate clean e2e e2e-setup
BINARY := agento
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS := -s -w \
-X github.com/shaharia-lab/agento/internal/build.Version=$(VERSION) \
-X github.com/shaharia-lab/agento/internal/build.CommitSHA=$(COMMIT) \
-X github.com/shaharia-lab/agento/internal/build.BuildDate=$(DATE)
# ── Production build ──────────────────────────────────────────────────────────
build: build-frontend build-go
build-frontend:
cd frontend && npm install && npm run build
build-go:
go build -ldflags "$(LDFLAGS)" -o $(BINARY) .
# ── Development (frontend + backend run separately) ────────────────────────────
dev-frontend:
cd frontend && npm run dev
dev-backend:
go run -tags dev .
# ── Legacy shortcuts ──────────────────────────────────────────────────────────
run-serve: build
./$(BINARY) serve
run-ask: build
./$(BINARY) ask $(ARGS)
# ── Code generation ───────────────────────────────────────────────────────────
generate:
mockery
# ── Code quality ──────────────────────────────────────────────────────────────
tidy:
go mod tidy
lint:
golangci-lint run ./...
test:
go test ./...
# ── E2E tests (local only — requires built binary) ────────────────────────────
# First-time setup: installs Playwright + downloads Chromium
e2e-setup:
cd e2e && npm ci && npx playwright install chromium
# Run e2e tests against the locally-built binary.
# The binary must be built first: make build
e2e: build
cd e2e && npm test
# ── Clean ─────────────────────────────────────────────────────────────────────
clean:
rm -f $(BINARY)
rm -rf frontend/dist
rm -rf frontend/node_modules