-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (62 loc) · 2.06 KB
/
Makefile
File metadata and controls
78 lines (62 loc) · 2.06 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
.PHONY: help build run clean test migrate migrate-down dev docker-build docker-run install
# Variables
BINARY_NAME=vesper
MAIN_PATH=./cmd/server
DATA_DIR=./data
DB_FILE=$(DATA_DIR)/tasks.db
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-15s %s\n", $$1, $$2}'
build: ## Build the application binary
@echo "Building $(BINARY_NAME)..."
@go build -o $(BINARY_NAME) $(MAIN_PATH)
@echo "Build complete: ./$(BINARY_NAME)"
run: build ## Build and run the application
@echo "Starting $(BINARY_NAME)..."
@./$(BINARY_NAME)
clean: ## Clean build artifacts
@echo "Cleaning..."
@rm -f $(BINARY_NAME)
@rm -rf tmp/
@echo "Clean complete"
test: ## Run tests
@echo "Running tests..."
@go test -v ./...
migrate: ## Run database migrations
@echo "Running database migrations..."
@mkdir -p $(DATA_DIR)
@go run ./internal/database/migrate/migrate.go up
@echo "Migrations complete"
migrate-down: ## Rollback database migrations
@echo "Rolling back database migrations..."
@go run ./internal/database/migrate/migrate.go down
@echo "Rollback complete"
dev: ## Run in development mode with hot reload (requires air)
@echo "Starting development server with air..."
@air
docker-build: ## Build Docker image
@echo "Building Docker image..."
@docker build -t vesper:latest .
@echo "Docker image built: vesper:latest"
docker-run: docker-build ## Build and run Docker container
@echo "Running Docker container..."
@docker run -p 8080:8080 -v $(PWD)/data:/data vesper:latest
install: ## Install dependencies
@echo "Installing dependencies..."
@go mod download
@go mod verify
@echo "Dependencies installed"
fmt: ## Format Go code
@echo "Formatting code..."
@go fmt ./...
@echo "Formatting complete"
vet: ## Run go vet
@echo "Running go vet..."
@go vet ./...
@echo "Vet complete"
lint: fmt vet ## Run all linters
setup: install migrate ## Complete project setup
@echo "Project setup complete!"
@echo "Run 'make run' to start the server"