forked from vesoft-inc/nebula-importer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (58 loc) · 1.86 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
DOCKER_REGISTRY ?= localhost:5000
DOCKER_REPO ?= ${DOCKER_REGISTRY}/vesoft
IMAGE_TAG ?= latest
export GO111MODULE := on
GOENV := GO15VENDOREXPERIMENT="1" CGO_ENABLED=0
GO := $(GOENV) go
GO_BUILD := $(GO) build -trimpath
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
all: build
go-generate: $(GOBIN)/mockgen
go generate ./...
check: tidy fmt vet imports lint
tidy:
go mod tidy
fmt: $(GOBIN)/gofumpt
# go fmt ./...
$(GOBIN)/gofumpt -w -l ./
vet:
go vet ./...
imports: $(GOBIN)/goimports $(GOBIN)/impi
$(GOBIN)/impi --local github.com/vesoft-inc --scheme stdLocalThirdParty \
-ignore-generated ./... \
|| exit 1
lint: $(GOBIN)/golangci-lint
$(GOBIN)/golangci-lint run
build:
$(GO_BUILD) -ldflags '$(LDFLAGS)' -o bin/nebula-importer ./cmd/nebula-importer/
test:
go test -gcflags=all="-l" -race -coverprofile=coverage.txt -covermode=atomic ./pkg/...
test-it: # integration-testing
docker-compose -f integration-testing/docker-compose.yaml up --build --exit-code-from importer
docker-build:
docker build -t "${DOCKER_REPO}/nebula-importer:${IMAGE_TAG}" -f Dockerfile .
docker-push: docker-build
docker push "${DOCKER_REPO}/nebula-importer:${IMAGE_TAG}"
tools: $(GOBIN)/goimports \
$(GOBIN)/impi \
$(GOBIN)/gofumpt \
$(GOBIN)/golangci-lint \
$(GOBIN)/mockgen
$(GOBIN)/goimports:
go install golang.org/x/tools/cmd/[email protected]
$(GOBIN)/impi:
go install github.com/pavius/impi/cmd/[email protected]
$(GOBIN)/gofumpt:
go install mvdan.cc/[email protected]
$(GOBIN)/golangci-lint:
@[ -f $(GOBIN)/golangci-lint ] || { \
set -e ;\
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.51.2 ;\
}
$(GOBIN)/mockgen:
go install github.com/golang/mock/[email protected]