-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (100 loc) · 2.7 KB
/
Makefile
File metadata and controls
119 lines (100 loc) · 2.7 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
# Makefile for Go ORMX
.PHONY: help build test lint clean docker-build docker-run migrate dev bench security-test integration-test
# Default target
help:
@echo "Available targets:"
@echo " build - Build the application"
@echo " test - Run tests"
@echo " lint - Run linter"
@echo " clean - Clean build artifacts"
@echo " docker-build - Build Docker image"
@echo " docker-run - Run Docker containers"
@echo " migrate - Run database migrations"
@echo " dev - Start development environment"
@echo " bench - Run benchmarks"
@echo " security-test - Run security tests"
@echo " integration-test - Run integration tests"
# Build
build:
@echo "Building Go ORMX..."
go build -o bin/ormx ./cmd/ormx-cli
# Test
test:
@echo "Running tests..."
go test -v -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Lint
lint:
@echo "Running linter..."
golangci-lint run
# Clean
clean:
@echo "Cleaning build artifacts..."
rm -rf bin/
rm -f coverage.out coverage.html
# Docker
docker-build:
@echo "Building Docker image..."
docker-compose build
docker-run:
@echo "Starting Docker containers..."
docker-compose up -d
# Migrations
migrate:
@echo "Running database migrations..."
migrate -path database/migrations -database "postgres://postgres:password@localhost:5432/ormx_dev?sslmode=disable" up
# Development
dev:
@echo "Starting development environment..."
docker-compose up -d
@sleep 10
@echo "Running migrations..."
@make migrate
@echo "Starting application..."
go run ./cmd/ormx-cli
# Benchmarks
bench:
@echo "Running benchmarks..."
go test -bench=. -benchmem ./tests/benchmark/...
# Security tests
security-test:
@echo "Running security tests..."
go test -v ./tests/security/...
# Integration tests
integration-test:
@echo "Running integration tests..."
go test -v ./tests/integration/...
# Install dependencies
deps:
@echo "Installing dependencies..."
go mod download
go mod tidy
# Format code
fmt:
@echo "Formatting code..."
go fmt ./...
# Vet code
vet:
@echo "Vetting code..."
go vet ./...
# Generate mocks
mocks:
@echo "Generating mocks..."
mockgen -source=pkg/repository/interfaces.go -destination=tests/mocks/repository_mock.go
mockgen -source=pkg/models/interfaces.go -destination=tests/mocks/models_mock.go
# Run all checks
check: fmt vet lint test
# Setup development environment
setup:
@echo "Setting up development environment..."
@make deps
@make docker-run
@sleep 15
@make migrate
@echo "Development environment ready!"
# Clean development environment
clean-dev:
@echo "Cleaning development environment..."
docker-compose down -v
@make clean