forked from NoFxAiOS/nofx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
153 lines (127 loc) · 3.99 KB
/
Makefile
File metadata and controls
153 lines (127 loc) · 3.99 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# NOFX Makefile for testing and development
.PHONY: help test test-backend test-frontend test-coverage clean
# Default target
help:
@echo "NOFX Testing & Development Commands"
@echo ""
@echo "Testing:"
@echo " make test - Run all tests (backend + frontend)"
@echo " make test-backend - Run backend tests only"
@echo " make test-frontend - Run frontend tests only"
@echo " make test-coverage - Generate backend coverage report"
@echo ""
@echo "Build:"
@echo " make build - Build backend binary"
@echo " make build-frontend - Build frontend"
@echo ""
@echo "Clean:"
@echo " make clean - Clean build artifacts and test cache"
# =============================================================================
# Testing
# =============================================================================
# Run all tests
test:
@echo "🧪 Running backend tests..."
go test -v ./...
@echo ""
@echo "🧪 Running frontend tests..."
cd web && npm run test
@echo "✅ All tests completed"
# Backend tests only
test-backend:
@echo "🧪 Running backend tests..."
go test -v ./...
# Frontend tests only
test-frontend:
@echo "🧪 Running frontend tests..."
cd web && npm run test
# Coverage report
test-coverage:
@echo "📊 Generating coverage..."
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "✅ Backend coverage: coverage.html"
# =============================================================================
# Build
# =============================================================================
# Build backend binary
build:
@echo "🔨 Building backend..."
go build -o nofx
@echo "✅ Backend built: ./nofx"
# Build frontend
build-frontend:
@echo "🔨 Building frontend..."
cd web && npm run build
@echo "✅ Frontend built: ./web/dist"
# =============================================================================
# Development
# =============================================================================
# Run backend in development mode
run:
@echo "🚀 Starting backend..."
go run main.go
# Run frontend in development mode
run-frontend:
@echo "🚀 Starting frontend dev server..."
cd web && npm run dev
# Format Go code
fmt:
@echo "🎨 Formatting Go code..."
go fmt ./...
@echo "✅ Code formatted"
# Lint Go code (requires golangci-lint)
lint:
@echo "🔍 Linting Go code..."
golangci-lint run
@echo "✅ Linting completed"
# =============================================================================
# Clean
# =============================================================================
clean:
@echo "🧹 Cleaning..."
rm -f nofx
rm -f coverage.out coverage.html
rm -rf web/dist
go clean -testcache
@echo "✅ Cleaned"
# =============================================================================
# Docker
# =============================================================================
# Build Docker images
docker-build:
@echo "🐳 Building Docker images..."
docker compose build
@echo "✅ Docker images built"
# Run Docker containers
docker-up:
@echo "🐳 Starting Docker containers..."
docker compose up -d
@echo "✅ Docker containers started"
# Stop Docker containers
docker-down:
@echo "🐳 Stopping Docker containers..."
docker compose down
@echo "✅ Docker containers stopped"
# View Docker logs
docker-logs:
docker compose logs -f
# =============================================================================
# Dependencies
# =============================================================================
# Download Go dependencies
deps:
@echo "📦 Downloading Go dependencies..."
go mod download
@echo "✅ Dependencies downloaded"
# Update Go dependencies
deps-update:
@echo "📦 Updating Go dependencies..."
go get -u ./...
go mod tidy
@echo "✅ Dependencies updated"
# Install frontend dependencies
deps-frontend:
@echo "📦 Installing frontend dependencies..."
cd web && npm install
@echo "✅ Frontend dependencies installed"