-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (40 loc) · 1.81 KB
/
Makefile
File metadata and controls
59 lines (40 loc) · 1.81 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
.PHONY: all build test test-unit test-integration lint fmt vet clean tidy help
GO ?= go
GOFLAGS ?=
PACKAGES := $(shell $(GO) list ./... | grep -v '/examples/' | grep -v '/docs/' | grep -v '/integration')
INTEGRATION_PKG := ./integration/...
all: fmt vet lint test-unit ## Run all checks and unit tests
build: ## Build all packages
$(GO) build $(GOFLAGS) ./...
test: test-unit ## Alias for test-unit
test-unit: ## Run unit tests only
$(GO) test $(GOFLAGS) $(PACKAGES)
test-unit-v: ## Run unit tests with verbose output
$(GO) test $(GOFLAGS) -v $(PACKAGES)
test-integration: ## Run integration tests
$(GO) test $(GOFLAGS) -tags=integration $(INTEGRATION_PKG)
test-integration-v: ## Run integration tests with verbose output
VERBOSE=1 $(GO) test $(GOFLAGS) -v -tags=integration $(INTEGRATION_PKG)
test-all: test-unit test-integration ## Run all tests (unit + integration)
test-v: ## Run unit tests with verbose output (alias for test-unit-v)
$(GO) test $(GOFLAGS) -v $(PACKAGES)
test-race: ## Run tests with race detector
$(GO) test $(GOFLAGS) -race $(PACKAGES)
test-cover: ## Run tests with coverage
$(GO) test $(GOFLAGS) -cover $(PACKAGES)
test-cover-html: ## Run tests and generate HTML coverage report
$(GO) test $(GOFLAGS) -coverprofile=coverage.out $(PACKAGES)
$(GO) tool cover -html=coverage.out -o coverage.html
lint: ## Run linter (requires golangci-lint)
@which golangci-lint > /dev/null || (echo "golangci-lint not installed, skipping" && exit 0)
golangci-lint run ./...
fmt: ## Format code
$(GO) fmt ./...
vet: ## Run go vet
$(GO) vet ./...
tidy: ## Tidy go.mod
$(GO) mod tidy
clean: ## Clean build artifacts
rm -f coverage.out coverage.html
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'