-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile
67 lines (53 loc) · 1.76 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
GOOS ?= $(shell go env GOOS)
SOURCES := $(shell find . -type f -name '*.go')
# Git information
GIT_VERSION ?= $(shell git describe --tags --dirty)
GIT_COMMIT_HASH ?= $(shell git rev-parse HEAD)
GIT_TREESTATE = "clean"
GIT_DIFF = $(shell git diff --quiet >/dev/null 2>&1; if [ $$? -eq 1 ]; then echo "1"; fi)
ifeq ($(GIT_DIFF), 1)
GIT_TREESTATE = "dirty"
endif
BUILDDATE = $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
LDFLAGS := "-X github.com/gocrane/api/pkg/version.gitVersion=$(GIT_VERSION) \
-X github.com/gocrane/api/pkg/version.gitCommit=$(GIT_COMMIT_HASH) \
-X github.com/gocrane/api/pkg/version.gitTreeState=$(GIT_TREESTATE) \
-X github.com/gocrane/api/pkg/version.buildDate=$(BUILDDATE)"
# Images management
REGISTRY?="ccr.ccs.tencentyun.com/kube-orm"
REGISTRY_USER_NAME?=""
REGISTRY_PASSWORD?=""
REGISTRY_SERVER_ADDRESS?="ccr.ccs.tencentyun.com"
# Set your version by env or using latest tags from git
VERSION?=""
ifeq ($(VERSION), "")
LATEST_TAG=$(shell git describe --tags)
ifeq ($(LATEST_TAG),)
# Forked repo may not sync tags from upstream, so give it a default tag to make CI happy.
VERSION="unknown"
else
VERSION=$(LATEST_TAG)
endif
endif
clean:
rm -rf output
# Run go fmt against code
fmt:
go fmt ./pkg/... ./analysis/... ./autoscaling/... ./prediction/... ./ensurance/... ./topology/...
# Run go vet against code
vet:
go vet ./pkg/... ./analysis/... ./autoscaling/... ./prediction/... ./ensurance/... ./topology/...
test:
go test --race --v ./pkg/...
.PHONY: update
update: fmt vet
hack/update-all.sh
.PHONY: verify
verify:
hack/verify-all.sh
.PHONY: staticcheck
staticcheck:
hack/verify-staticcheck.sh
.PHONY: all
all:
hack/update-all.sh && hack/verify-all.sh