-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
50 lines (40 loc) · 2.03 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.PHONY: all build clean default help init test format check test-cover test-crosscover run
default: help
GOPRIVATE=github.com/percona,github.com/percona-platform
GONOSUMDB=github.com/percona,github.com/percona-platform
COMPONENT_VERSION ?= $(shell git describe --abbrev=0 --always --tags)
BUILD ?= $(shell date +%FT%T%z)
TELEMETRY_AGENT_RELEASE_FULLCOMMIT ?= $(shell git rev-parse HEAD)
GO_BUILD_LDFLAGS = -X github.com/percona/telemetry-agent/config.Version=${COMPONENT_VERSION} \
-X github.com/percona/telemetry-agent/config.BuildDate=${BUILD} \
-X github.com/percona/telemetry-agent/config.Commit=${TELEMETRY_AGENT_RELEASE_FULLCOMMIT} \
-extldflags -static
GOARCH?=amd64
help: ## Display this help message
@echo "Please use \`make <target>\` where <target> is one of:"
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
awk -F ':.*?## ' 'NF==2 {printf " %-26s%s\n", $$1, $$2}'
init: ## Install development tools
rm -rf bin
cd tools && go generate -x -tags=tools
build: ## Compile using plain go build
CGO_ENABLED=0 \
GOARCH=${GOARCH} \
go build -a -ldflags="${GO_BUILD_LDFLAGS}" -o ./bin/telemetry-agent ./cmd/telemetry-agent
format: ## Format source code
go mod tidy
bin/gofumpt -l -w .
bin/goimports -local github.com/percona/telemetry-agent -l -w .
check: ## Run checks/linters for the whole project
make format
bin/go-consistent -exclude=tools -pedantic ./...
LOG_LEVEL=error bin/golangci-lint run
test: ## Run tests
go test -race -timeout=10m ./...
test-cover: ## Run tests and collect per-package coverage information
go test -race -timeout=10m -count=1 -coverprofile=cover.out -covermode=atomic ./...
test-crosscover: ## Run tests and collect cross-package coverage information
go test -race -timeout=10m -count=1 -coverprofile=crosscover.out -covermode=atomic -p=1 -coverpkg=./... ./...
run: ## Run telemetry-agent with race detector
go run -race cmd/telemetry-agent/main.go \
--log.verbose --log.dev-mode