-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (58 loc) · 1.7 KB
/
Makefile
File metadata and controls
70 lines (58 loc) · 1.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
.PHONY: all test test-short test-race test-coverage bench bench-all clean help
# Go commands
GOCMD = go
GOTEST = $(GOCMD) test
GOBUILD = $(GOCMD) build
GOBENCH = $(GOCMD) bench
# Test flags
TEST_FLAGS = -short
RACE_FLAGS = -race
COVERAGE_FLAGS = -coverprofile=coverage.txt -covermode=atomic
# Default target
all: build
# Build the project
build:
$(GOBUILD) ./...
# Run short tests (fast, for CI)
test-short:
$(GOTEST) -short ./...
# Run tests with race detector
test-race:
$(GOTEST) $(RACE_FLAGS) ./...
# Run tests with coverage
test-coverage:
$(GOTEST) $(COVERAGE_FLAGS) ./...
# Run all tests (short + race)
test: test-short test-race
# Run benchmarks
bench:
$(GOBENCH) -run=^$ -bench=. -benchmem -cpu=1,4
# Run all benchmarks with more detail
bench-all:
$(GOBENCH) -run=^$ -bench=. -benchmem -cpu=1,4,8 -timeout 120s
# Clean build artifacts
clean:
$(GOCMD) clean
rm -f coverage.txt
rm -f benchmark_output.txt
rm -f *.test
# Show this help message
help:
@echo "BotRate Makefile"
@echo ""
@echo "Targets:"
@echo " all - Build the project (default)"
@echo " build - Build all packages"
@echo " test - Run short tests and race tests"
@echo " test-short - Run short tests (fast, for CI)"
@echo " test-race - Run tests with race detector"
@echo " test-coverage- Run tests with coverage report"
@echo " bench - Run benchmarks (1 and 4 CPUs)"
@echo " bench-all - Run all benchmarks (1, 4, 8 CPUs)"
@echo " clean - Clean build artifacts"
@echo " help - Show this help message"
@echo ""
@echo "Examples:"
@echo " make test # Run all tests"
@echo " make bench # Run benchmarks"
@echo " make test-coverage# Generate coverage report"