forked from apache/incubator-horaedb-meta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (30 loc) · 1.28 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
# Refers to https://github.com/tikv/pd/blob/master/Makefile
default: build
GO_TOOLS_BIN_PATH := $(shell pwd)/.tools/bin
PATH := $(GO_TOOLS_BIN_PATH):$(PATH)
SHELL := env PATH='$(PATH)' GOBIN='$(GO_TOOLS_BIN_PATH)' $(shell which bash)
install-tools:
@mkdir -p $(GO_TOOLS_BIN_PATH)
@(which golangci-lint && golangci-lint version | grep '1.49') >/dev/null 2>&1 || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_TOOLS_BIN_PATH) v1.49.0
@grep '_' tools.go | sed 's/"//g' | awk '{print $$2}' | xargs go install
META_PKG := github.com/CeresDB/ceresmeta
PACKAGES := $(shell go list ./... | tail -n +2)
PACKAGE_DIRECTORIES := $(subst $(META_PKG)/,,$(PACKAGES))
check: install-tools
@ echo "check license ..."
@ make check-license
@ echo "gofmt ..."
@ gofmt -s -l -d $(PACKAGE_DIRECTORIES) 2>&1 | awk '{ print } END { if (NR > 0) { exit 1 } }'
@ echo "golangci-lint ..."
@ golangci-lint run $(PACKAGE_DIRECTORIES)
@ echo "revive ..."
@ revive -formatter friendly -config revive.toml $(PACKAGES)
test: install-tools
@ echo "go test ..."
@ go test -timeout 5m -coverprofile=coverage.txt -covermode=atomic $(PACKAGES)
check-license:
@ sh ./scripts/check-license.sh
build: check
@ go build -o ceresmeta ./cmd/meta/...
clean:
@ rm -f ceresmeta