-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (28 loc) · 1 KB
/
Makefile
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
CPUS ?= $(shell (nproc --all || sysctl -n hw.ncpu) 2>/dev/null || echo 1)
MAKEFLAGS += --jobs=$(CPUS)
.PHONY: help
help: ## Display available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: build
build: ## Build the application
@go build ./...
.PHONY: test
test: ## Run tests
@go test ./...
.PHONY: lint
lint: ## Lint files
@golangci-lint run ./...
.PHONY: coverage
coverage: coverage-html coverage-xml ## Generate and report coverage
.PHONY: coverage-profile
coverage-profile:
@mkdir -p coverage
@go test -cover -covermode=count -coverprofile=coverage/profile.cov ./...
.PHONY: coverage-html
coverage-html: coverage-profile
@go tool cover -html=coverage/profile.cov -o coverage/coverage.html
.PHONY: coverage-xml
coverage-xml: coverage-profile
@go install github.com/axw/gocov/gocov@latest
@go install github.com/AlekSi/gocov-xml@latest
@gocov convert coverage/profile.cov | gocov-xml > coverage/coverage.xml