-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
148 lines (110 loc) · 3.15 KB
/
Makefile
File metadata and controls
148 lines (110 loc) · 3.15 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Makefile for hioload-ws project
# Author: momentics <momentics@gmail.com>
# License: Apache-2.0
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=hioload-ws
BINARY_UNIX=$(BINARY_NAME)_unix
# Directories
SCRIPTS_DIR=scripts
TESTS_DIR=tests
.PHONY: all test test-unit test-integration test-all benchmark benchmark-all coverage clean install lint
all: test
# Build the project
build:
$(GOBUILD) -v ./...
# Run unit tests
test-unit:
$(GOTEST) -v ./tests/unit/...
# Run integration tests
test-integration:
$(GOTEST) -v ./tests/integration/...
# Run all tests with verbose output
test-all:
$(GOTEST) -v -timeout=60s ./...
# Run tests with race detector
test-race:
$(GOTEST) -race -v ./...
# Run the main test script with coverage
test:
$(SCRIPTS_DIR)/test.sh -v
# Run tests with coverage
coverage:
$(SCRIPTS_DIR)/test.sh -c -v
# Run benchmarks
benchmark:
$(GOTEST) -v ./tests/benchmarks/...
# Run all benchmarks
benchmark-all:
$(GOTEST) -bench=. -run=^$$ ./...
# Run tests with coverage in all packages
coverage-all:
$(GOTEST) -coverprofile=coverage.out -covermode=atomic -timeout=120s ./...
go tool cover -html=coverage.out -o coverage.html
# Install dependencies
install:
$(GOGET) -v -t -d ./...
# Clean build artifacts
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_UNIX)
rm -f coverage.html
rm -f coverage.out
# Run linting (if golangci-lint is installed)
lint:
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run; \
else \
echo "golangci-lint not found, skipping linting. Install with: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest"; \
fi
# Build for different platforms
build-linux:
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 $(GOBUILD) -a -ldflags '-extldflags "-static"' -o $(BINARY_UNIX) .
# Run specific package tests
test-pool:
$(GOTEST) -v ./pool/...
test-protocol:
$(GOTEST) -v ./protocol/...
test-api:
$(GOTEST) -v ./api/...
test-concurrency:
$(GOTEST) -v ./internal/concurrency/...
test-transport:
$(GOTEST) -v ./internal/transport/...
test-server:
$(GOTEST) -v ./lowlevel/server/...
test-client:
$(GOTEST) -v ./lowlevel/client/...
# Build examples
build-examples:
$(GOBUILD) -v ./examples/...
build-highlevel-examples:
$(GOBUILD) -v ./examples/highlevel/...
build-param-routes-example:
$(GOBUILD) ./examples/highlevel/param_routes/
build-http-methods-example:
$(GOBUILD) ./examples/highlevel/http_methods/
build-route-groups-example:
$(GOBUILD) ./examples/highlevel/route_groups/
build-middleware-example:
$(GOBUILD) ./examples/highlevel/middleware/
build-built-in-middleware-example:
$(GOBUILD) ./examples/highlevel/built_in_middleware/
build-custom-middleware-example:
$(GOBUILD) ./examples/highlevel/custom_middleware/
build-json-string-methods-example:
$(GOBUILD) ./examples/highlevel/json_string_methods/
build-param-routing-example:
$(GOBUILD) ./examples/highlevel/param_routing/
# io_uring related targets
test-io-uring:
$(GOTEST) -tags io_uring -v ./internal/transport/...
build-with-uring:
CGO_ENABLED=1 go build -tags io_uring -v ./...
build-without-uring:
CGO_ENABLED=1 go build -tags '!io_uring' -v ./...