forked from OrangeBao/clusterrouter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
36 lines (28 loc) · 1.17 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
REGISTRY_NAME=xxxx
GIT_COMMIT=$(shell git rev-parse "HEAD^{commit}")
VERSION=$(shell git describe --tags --abbrev=14 "${GIT_COMMIT}^{commit}" --always)
BUILD_TIME=$(shell TZ=Asia/Shanghai date +%FT%T%z)
CMDS=build-clusterrouter
all: build
build: clusterrouter
clusterrouter:
mkdir -p bin
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X 'main.buildVersion=$(VERSION)' -X 'main.buildTime=${BUILD_TIME}'" -o ./bin/clusterrouter ./cmd/virtualnode-manager
container: container-clusterrouter
container-clusterrouter: clusterrouter
docker build -t $(REGISTRY_NAME)/clusterrouter:$(VERSION) -f Dockerfile.clusterrouter --label revision=$(REV) .
.PHONY: lint
lint: golangci-lint
$(GOLANGLINT_BIN) run
golangci-lint:
ifeq (, $(shell which golangci-lint))
GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/[email protected]
GOLANGLINT_BIN=$(shell go env GOPATH)/bin/golangci-lint
else
GOLANGLINT_BIN=$(shell which golangci-lint)
endif
.PHONY: test
test:
mkdir -p ./_output/coverage/
go test --race --v ./pkg/... -coverprofile=./_output/coverage/coverage_pkg.txt -covermode=atomic
go test --race --v ./cmd/... -coverprofile=./_output/coverage/coverage_cmd.txt -covermode=atomic