-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (76 loc) · 2.32 KB
/
Makefile
File metadata and controls
95 lines (76 loc) · 2.32 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
# Makefile for PromViz
.PHONY: build test test-unit test-integration test-coverage bench clean lint fmt vet
# Build variables
BINARY_NAME=promviz
GO_FILES=$(shell find . -name "*.go" -not -path "./vendor/*")
# Build the application
build:
go build -o $(BINARY_NAME) main.go
# Install dependencies
deps:
go mod download
go mod tidy
# Run all tests
test: test-unit test-integration
# Run unit tests only
test-unit:
go test -v ./internal/...
# Run integration tests (requires build tags)
test-integration:
go test -v -tags=integration .
# Run tests with coverage
test-coverage:
go test -v -coverprofile=coverage.out ./internal/...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Run benchmarks
bench:
go test -bench=. -benchmem ./internal/...
go test -bench=. -benchmem -tags=integration .
# Clean build artifacts
clean:
rm -f $(BINARY_NAME)
rm -f coverage.out coverage.html
# Lint the code
lint:
golangci-lint run
# Format the code
fmt:
go fmt ./...
# Vet the code
vet:
go vet ./...
# Check code quality
check: fmt vet lint test-unit
# Install development tools
dev-tools:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Run the application with default config
run:
./$(BINARY_NAME)
# Run the application with Prometheus config
run-prometheus:
./$(BINARY_NAME) --config queries.yaml
# Run the application with InfluxDB config
run-influxdb:
./$(BINARY_NAME) --config queries-influxdb.yaml
# Help
help:
@echo "Available targets:"
@echo " build Build the application"
@echo " deps Install dependencies"
@echo " test Run all tests"
@echo " test-unit Run unit tests only"
@echo " test-integration Run integration tests"
@echo " test-coverage Run tests with coverage report"
@echo " bench Run benchmarks"
@echo " clean Clean build artifacts"
@echo " lint Lint the code"
@echo " fmt Format the code"
@echo " vet Vet the code"
@echo " check Run fmt, vet, lint, and unit tests"
@echo " dev-tools Install development tools"
@echo " run Run with default config"
@echo " run-prometheus Run with Prometheus config"
@echo " run-influxdb Run with InfluxDB config"
@echo " help Show this help message"