-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (83 loc) · 2.46 KB
/
Makefile
File metadata and controls
99 lines (83 loc) · 2.46 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
.PHONY: build run test clean lint fmt vet deps help
# Variables
BINARY_NAME=serverless-agentcore
BUILD_DIR=./bin
GO_FILES=$(shell find . -name "*.go" -type f -not -path "./vendor/*")
# Default target
all: build
# Build the application
build:
@echo "Building $(BINARY_NAME)..."
@mkdir -p $(BUILD_DIR)
@go build -o $(BUILD_DIR)/$(BINARY_NAME) main.go
# Run the application
run: build
@echo "Running $(BINARY_NAME)..."
@$(BUILD_DIR)/$(BINARY_NAME) server
# Run tests
test:
@echo "Running tests..."
@go test -v ./...
# Run tests with coverage
test-coverage:
@echo "Running tests with coverage..."
@go test -v -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out -o coverage.html
# Clean build artifacts
clean:
@echo "Cleaning up..."
@rm -rf $(BUILD_DIR)
@rm -f coverage.out coverage.html
# Lint the code
lint:
@echo "Running linter..."
@golangci-lint run
# Format the code
fmt:
@echo "Formatting code..."
@go fmt ./...
# Vet the code
vet:
@echo "Vetting code..."
@go vet ./...
# Install dependencies
deps:
@echo "Installing dependencies..."
@go mod download
@go mod tidy
# Install development tools
dev-deps:
@echo "Installing development dependencies..."
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Generate documentation
docs:
@echo "Generating documentation..."
@godoc -http=:6060
# Build for multiple platforms
build-all:
@echo "Building for multiple platforms..."
@mkdir -p $(BUILD_DIR)
@GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 main.go
@GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 main.go
@GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe main.go
# Docker build
docker-build:
@echo "Building Docker image..."
@docker build -t $(BINARY_NAME):latest .
# Help
help:
@echo "Available targets:"
@echo " build Build the application"
@echo " run Run the application"
@echo " test Run tests"
@echo " test-coverage Run tests with coverage"
@echo " clean Clean build artifacts"
@echo " lint Run linter"
@echo " fmt Format code"
@echo " vet Vet code"
@echo " deps Install dependencies"
@echo " dev-deps Install development dependencies"
@echo " docs Generate documentation"
@echo " build-all Build for multiple platforms"
@echo " docker-build Build Docker image"
@echo " help Show this help message"