-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (76 loc) · 2.19 KB
/
Makefile
File metadata and controls
91 lines (76 loc) · 2.19 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
.PHONY: all build test lint fmt vet clean coverage help
# Default target
all: fmt vet lint test build
# Build the application
build:
@echo "Building..."
go build -o bin/mcp-server ./cmd/server/main.go
# Run tests
test:
@echo "Running tests..."
go test -v -race ./...
# Run tests with coverage
coverage:
@echo "Running tests with coverage..."
go test -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Run linter
lint:
@echo "Running linter..."
golangci-lint run
# Format code
fmt:
@echo "Formatting code..."
go fmt ./...
gofmt -w .
# Run go vet
vet:
@echo "Running go vet..."
go vet ./...
# Security scan
security:
@echo "Running security scan..."
gosec ./...
# Check dependencies for vulnerabilities
audit:
@echo "Checking for vulnerabilities..."
govulncheck ./...
# Clean build artifacts
clean:
@echo "Cleaning..."
rm -rf bin/
rm -f coverage.out coverage.html
# Run all checks (CI pipeline locally)
ci: fmt vet lint test build
# Install dependencies
deps:
@echo "Installing dependencies..."
go mod download
go mod verify
# Run integration tests (requires database)
integration-test:
@echo "Running integration tests..."
@echo "Make sure PostgreSQL and MySQL are running"
go test -v ./internal/mcp -run TestLive -count=1
# Development server
dev:
@echo "Starting development server..."
go run ./cmd/server/main.go
# Help
help:
@echo "Available targets:"
@echo " make build - Build the application"
@echo " make test - Run unit tests"
@echo " make coverage - Run tests with coverage report"
@echo " make lint - Run linter"
@echo " make fmt - Format code"
@echo " make vet - Run go vet"
@echo " make security - Run security scan"
@echo " make audit - Audit dependencies"
@echo " make clean - Clean build artifacts"
@echo " make ci - Run all CI checks locally"
@echo " make deps - Install dependencies"
@echo " make integration-test - Run integration tests"
@echo " make dev - Start development server"
@echo " make all - Run fmt, vet, lint, test, build"