-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (81 loc) · 2.4 KB
/
Copy pathMakefile
File metadata and controls
98 lines (81 loc) · 2.4 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
# staticSend Makefile
.PHONY: help build test test-unit test-integration clean run dev
# Default target
help:
@echo "Available commands:"
@echo " make test - Run all tests (unit + integration)"
@echo " make test-unit - Run unit tests only"
@echo " make test-integration - Run integration tests only"
@echo " make build - Build the application"
@echo " make run - Run the application"
@echo " make dev - Run in development mode with auto-reload"
@echo " make clean - Clean build artifacts"
# Build the application
build:
@echo "Building staticSend..."
go build -o bin/staticsend ./cmd/staticsend
# Run unit tests
test-unit:
@echo "Running unit tests..."
go test ./pkg/... -v -cover
# Run integration tests
test-integration:
@echo "Running integration tests..."
go test -v -tags=integration ./integration_test.go
# Run all tests
test: test-unit test-integration
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
rm -rf bin/
go clean
# Run the application
run: build
@echo "Starting staticSend..."
./bin/staticsend
# Development mode (requires air for auto-reload)
dev:
@echo "Starting development server..."
@if command -v air > /dev/null; then \
air; \
else \
echo "Air not found. Install with: go install github.com/cosmtrek/air@latest"; \
echo "Falling back to regular run..."; \
make run; \
fi
# Install development dependencies
install-dev:
@echo "Installing development dependencies..."
go install github.com/cosmtrek/air@latest
# Run tests with coverage report
test-coverage:
@echo "Running tests with coverage..."
go test ./pkg/... -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Lint the code (requires golangci-lint)
lint:
@echo "Running linter..."
@if command -v golangci-lint > /dev/null; then \
golangci-lint run; \
else \
echo "golangci-lint not found. Install with: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest"; \
fi
# Format the code
fmt:
@echo "Formatting code..."
go fmt ./...
# Tidy dependencies
tidy:
@echo "Tidying dependencies..."
go mod tidy
# Full check (format, lint, test)
check: fmt lint test
# Docker build
docker-build:
@echo "Building Docker image..."
docker build -t staticsend .
# Docker run
docker-run:
@echo "Running Docker container..."
docker run -p 8080:8080 staticsend