-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (49 loc) · 1.26 KB
/
Makefile
File metadata and controls
65 lines (49 loc) · 1.26 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
.PHONY: run build test migrate-up migrate-down swagger docker-up docker-down lint clean
# Run the application
run:
go run cmd/server/main.go
# Build the application
build:
go build -o bin/auth-server cmd/server/main.go
# Build for production
build-prod:
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o bin/auth-server cmd/server/main.go
# Run all tests
test:
go test ./... -v
# Run tests with coverage
test-coverage:
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html
# Database migrations
migrate-up:
migrate -path migrations -database "$(DATABASE_URL)" up
migrate-down:
migrate -path migrations -database "$(DATABASE_URL)" down
# Generate Swagger documentation
swagger:
swag init -g cmd/server/main.go -o docs
# Docker commands
docker-up:
docker-compose up -d
docker-down:
docker-compose down
docker-build:
docker build -t auth-server:latest .
# Linting (requires golangci-lint)
lint:
golangci-lint run
# Clean build artifacts
clean:
rm -rf bin/
rm -f coverage.out coverage.html
# Install development tools
install-tools:
go install github.com/swaggo/swag/cmd/swag@latest
go install github.com/golang-migrate/migrate/v4/cmd/migrate@latest
# Format code
fmt:
go fmt ./...
# Tidy dependencies
tidy:
go mod tidy