-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (31 loc) · 1.48 KB
/
Makefile
File metadata and controls
45 lines (31 loc) · 1.48 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
BINARY := proxysql-agent
.PHONY: help bench build check clean coverage coverage-html fmt lint run test
default: help
bench: ## Run benchmarks
@go test --race --shuffle=on --bench=. --benchmem ./...
build: ## Build the application
@go build -o $(BINARY) cmd/proxysql-agent/main.go
check: fmt lint test ## Run formatting (via golangci-lint), vetting (also via golangci-lint), linting, tests, benchmarks, and race detection
clean: ## Clean build artifacts and coverage files
@go clean
@rm -rf dist coverage $(BINARY)
coverage: ## Generate test coverage report
@mkdir -p coverage
@go test --race --shuffle=on --coverprofile=coverage/coverage.out ./...
@go tool cover --func=coverage/coverage.out
coverage-html: coverage ## Generate HTML coverage report and open in browser
@go tool cover --html=coverage/coverage.out -o coverage/coverage.html
@open coverage/coverage.html
docker: clean lint
@docker build -f build/dev.Dockerfile -t persona-id/proxysql-agent:latest .
fmt: ## Format code
@golangci-lint-v2 fmt ./...
help: ## Show this help message
@echo "Available targets:"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
lint: ## Run golangci-lint
@golangci-lint-v2 run
run: clean build ## Run the application. not really useful outside of a k8s cluster.
@./$(BINARY) --log.level=DEBUG --proxysql.password=radmin --run_mode=satellite --shutdown.draining_file=/tmp/proxysql-draining
test: ## Run tests
@go test --race --shuffle=on ./...