-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
102 lines (86 loc) · 2.82 KB
/
Makefile
File metadata and controls
102 lines (86 loc) · 2.82 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
.PHONY: help install deps build run test clean lint swagger docker-build docker-run
help:
@echo "FixFX Backend - Available Commands"
@echo "===================================="
@echo " make install - Install dependencies"
@echo " make deps - Download dependencies"
@echo " make build - Build the application"
@echo " make run - Run the application"
@echo " make dev - Run with hot-reload (requires air)"
@echo " make test - Run all tests"
@echo " make test-cover - Run tests with coverage"
@echo " make lint - Run linters"
@echo " make swagger - Generate Swagger documentation"
@echo " make clean - Clean build artifacts"
@echo " make docker-build - Build Docker image"
@echo " make docker-run - Run Docker container"
@echo ""
install: deps
@echo "Installing FixFX backend..."
@go build -o fixfx-backend main.go
@echo "✓ Installation complete"
deps:
@echo "Installing dependencies..."
@go mod download
@go mod tidy
@echo "✓ Dependencies installed"
build:
@echo "Building FixFX backend..."
@mkdir -p dist
@go build -o dist/fixfx-backend main.go
@echo "✓ Build complete: dist/fixfx-backend"
run:
@echo "Starting FixFX backend..."
@go run main.go
dev:
@echo "Starting FixFX backend (dev mode with hot-reload)..."
@which air > /dev/null || go install github.com/air-verse/air@latest
@air
test:
@echo "Running tests..."
@go test -v ./...
test-cover:
@echo "Running tests with coverage..."
@go test -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
lint:
@echo "Running linters..."
@which golangci-lint > /dev/null || go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@golangci-lint run
swagger:
@echo "Generating Swagger documentation..."
@which swag > /dev/null || go install github.com/swaggo/swag/cmd/swag@latest
@swag init
@echo "✓ Swagger docs generated"
clean:
@echo "Cleaning build artifacts..."
@rm -f fixfx-backend
@rm -rf dist/
@rm -rf docs/swagger.*
@rm -f coverage.out coverage.html
@go clean
@echo "✓ Clean complete"
docker-build:
@echo "Building Docker image..."
@docker build -t fixfx-backend:latest .
@echo "✓ Docker image built"
docker-run:
@echo "Running Docker container..."
@docker run -p 3001:3001 \
-e PORT=3001 \
-e ENVIRONMENT=development \
fixfx-backend:latest
@echo "✓ Container running on http://localhost:3001"
# Development targets
.PHONY: install-tools format
install-tools:
@echo "Installing development tools..."
@go install github.com/swaggo/swag/cmd/swag@latest
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@go install github.com/air-verse/air@latest
@echo "✓ Tools installed"
format:
@echo "Formatting code..."
@gofmt -w .
@echo "✓ Code formatted"