-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (63 loc) · 2.08 KB
/
Copy pathMakefile
File metadata and controls
78 lines (63 loc) · 2.08 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
# FitByte API Makefile
.PHONY: help build run test clean deps dev
# Default target
help: ## Show this help message
@echo "Available commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Build the application
build: ## Build the application
@echo "Building FitByte API..."
go build -o bin/fitbyte main.go
# Run the application
run: ## Run the application
@echo "Starting FitByte API..."
go run main.go
# Run in development mode with hot reload (requires air)
dev: ## Run with hot reload (requires air: go install github.com/cosmtrek/air@latest)
@echo "Starting FitByte API in development mode..."
air
# Install dependencies
deps: ## Install dependencies
@echo "Installing dependencies..."
go mod tidy
go mod download
# Run tests
test: ## Run tests
@echo "Running tests..."
go test -v ./...
# Run tests with coverage
test-coverage: ## Run tests with 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: ## Clean build artifacts
@echo "Cleaning build artifacts..."
rm -rf bin/
rm -f coverage.out coverage.html
# Format code
fmt: ## Format code
@echo "Formatting code..."
go fmt ./...
# Lint code
lint: ## Lint code
@echo "Linting code..."
golangci-lint run
# Install development tools
install-tools: ## Install development tools
@echo "Installing development tools..."
go install github.com/cosmtrek/air@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Setup development environment
setup: deps install-tools ## Setup development environment
@echo "Setting up development environment..."
@if [ ! -f .env ]; then cp .env.example .env; fi
@echo "Development environment setup complete!"
# Docker build
docker-build: ## Build Docker image
@echo "Building Docker image..."
docker build -t fitbyte-api .
# Docker run
docker-run: ## Run Docker container
@echo "Running Docker container..."
docker run -p 8080:8080 --env-file .env fitbyte-api