Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (59 loc) · 1.65 KB
/
Copy pathMakefile
File metadata and controls
71 lines (59 loc) · 1.65 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
.PHONY: test test-verbose test-coverage test-race bench clean verify fmt lint oapi
# Default target
all: test
# Run tests
test:
go test ./...
# Run tests with verbose output
test-verbose:
go test -v ./...
# Run tests with coverage
test-coverage:
go test -cover ./... -coverprofile=coverage.out
# Run tests with race detection
test-race:
go test -race ./...
# Run benchmarks
bench:
go test -bench=.
test-all: test-verbose test-coverage test-race bench
# Format code
fmt:
golangci-lint fmt
# Lint code (requires golangci-lint to be installed)
lint:
golangci-lint run --fix
# Clean test cache
clean:
go clean -testcache
# Generate OpenAPI server code from spec
oapi:
go generate tools.go
# Simulate CI tests
verify:
@echo "Running CI tests..."
@echo "Checking Linting:"
make lint
@echo "Checking Tests:"
make test-all
@echo "Checking Build:"
go build -v ./...
go clean -testcache
@echo "Checking mod tidy"
go mod tidy
@echo "✅ CI Test will pass, you are ready to commit / open the PR! Thank you for your contribution :)"
# Show help
help:
@echo "Available targets:"
@echo " test - Run basic tests"
@echo " test-verbose - Run tests with verbose output"
@echo " test-coverage - Run tests with coverage"
@echo " test-race - Run tests with race detection"
@echo " bench - Run benchmarks"
@echo " test-all - Run all tests"
@echo " fmt - Format code"
@echo " lint - Lint and fix code"
@echo " clean - Clean test cache"
@echo " oapi - Create gin server from OpenAPI spec"
@echo " verify - Simulate CI Checks before opening a PR"
@echo " help - Show this help"