Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (57 loc) · 3.02 KB
/
Copy pathMakefile
File metadata and controls
72 lines (57 loc) · 3.02 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
.PHONY: run test test-mysql clean-mysql build build-chatbot build-gate-mcp coverage coverage-go coverage-chatbot coverage-web coverage-e2e
GOCACHE ?= /tmp/agentflow-gocache
# Use the local toolchain; go.mod requires go >= 1.26.10.
run:
GOCACHE=$(GOCACHE) go run ./cmd/agentflow
test:
GOCACHE=$(GOCACHE) go test -p=16 ./... -count=1 -timeout=4m
# coverage runs the same gates as CI. Needs web/native-chat
# (make build-chatbot). COVERAGE_P lowers Go package parallelism on small hosts.
COVERAGE_P ?= 4
coverage: coverage-go coverage-chatbot coverage-web
coverage-go:
GOCACHE=$(GOCACHE) GO_TEST_P=$(COVERAGE_P) bash scripts/coverage-go.sh --min 85
coverage-chatbot:
[ -d chatbot/node_modules/vitest ] || npm --prefix chatbot ci --include=dev --no-audit --no-fund
npm --prefix chatbot run coverage
coverage-web:
[ -d webtest/node_modules/c8 ] || npm --prefix webtest ci --include=dev --no-audit --no-fund
npm --prefix webtest run coverage
# coverage-e2e runs e2e/local.sh all against a throwaway platform and reports
# route coverage plus web/ unit+browser coverage. Not part of CI.
coverage-e2e:
bash e2e/coverage/report.sh
# test-mysql runs the gorm integration tests against a throwaway local MySQL
# container. It never touches any externally configured database: the DSN is
# bound to 127.0.0.1 and the container is removed afterwards.
MYSQL_CONTAINER ?= agentflow-test-mysql
MYSQL_PORT ?= 33306
MYSQL_TEST_DB ?= agentflow_it
MYSQL_IMAGE ?= mysql:8.0
test-mysql:
@docker rm -f $(MYSQL_CONTAINER) >/dev/null 2>&1 || true
docker run -d --name $(MYSQL_CONTAINER) -p 127.0.0.1:$(MYSQL_PORT):3306 \
-e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=$(MYSQL_TEST_DB) $(MYSQL_IMAGE)
@echo "waiting for MySQL to become ready..."
@until docker exec $(MYSQL_CONTAINER) mysqladmin ping -uroot -proot --silent >/dev/null 2>&1; do sleep 1; done
@until docker exec $(MYSQL_CONTAINER) mysql -uroot -proot -e "SELECT 1" >/dev/null 2>&1; do sleep 1; done
@sleep 3
AGENTFLOW_TEST_MYSQL_DSN="root:root@tcp(127.0.0.1:$(MYSQL_PORT))/$(MYSQL_TEST_DB)" \
GOCACHE=$(GOCACHE) go test -p=1 ./internal/repo/ -count=1 -timeout=180s
$(MAKE) clean-mysql
clean-mysql:
-@docker rm -f $(MYSQL_CONTAINER) >/dev/null 2>&1 || true
build: build-chatbot
mkdir -p bin
GOCACHE=$(GOCACHE) go build -o bin/agentflow ./cmd/agentflow
GOCACHE=$(GOCACHE) go build -o bin/agentflow-mcp ./cmd/agentflow-mcp
GOCACHE=$(GOCACHE) go build -o bin/agentflow-runner ./cmd/agentflow-runner
$(MAKE) build-gate-mcp
build-chatbot:
bash scripts/build-chatbot.sh
build-gate-mcp:
mkdir -p bin
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 GOCACHE=$(GOCACHE) go build -o bin/agentflow-gate-mcp-darwin-amd64 ./cmd/agentflow-gate-mcp
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 GOCACHE=$(GOCACHE) go build -o bin/agentflow-gate-mcp-darwin-arm64 ./cmd/agentflow-gate-mcp
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOCACHE=$(GOCACHE) go build -o bin/agentflow-gate-mcp-linux-amd64 ./cmd/agentflow-gate-mcp
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOCACHE=$(GOCACHE) go build -o bin/agentflow-gate-mcp-linux-arm64 ./cmd/agentflow-gate-mcp