-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
32 lines (22 loc) · 1.17 KB
/
Copy pathMakefile
File metadata and controls
32 lines (22 loc) · 1.17 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
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
GO_TEST_COVERAGE_VERSION := v2.19.0 # renovate: datasource=go depName=github.com/vladopajic/go-test-coverage/v2
.PHONY: test lint fmt generate clean mod-tidy coverage check-coverage help
help: ## Show help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-15s %s\n", $$1, $$2}'
test: ## Run all tests with race detection and coverage profile
@mkdir -p coverage
go test -race -covermode=atomic -coverprofile=coverage/coverage.out ./...
coverage: ## Generate HTML coverage report from coverage/coverage.out
go tool cover -html=coverage/coverage.out -o coverage/coverage.html
check-coverage: ## Check coverage against the thresholds in .testcoverage.yml
go run github.com/vladopajic/go-test-coverage/v2@$(GO_TEST_COVERAGE_VERSION) --config=./.testcoverage.yml $(COVERAGE_FLAGS)
lint: ## Run linter
golangci-lint run --timeout=5m
fmt: ## Format code
golangci-lint fmt
generate: ## Run code generators (no-op when no //go:generate directives)
go generate ./...
clean: ## Clean coverage artifacts
rm -rf coverage/
mod-tidy: ## Tidy Go modules
go mod tidy