forked from AliyunContainerService/ack-kms-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
77 lines (64 loc) · 2.02 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
##############################################################################################################
BINARY := ack-kms-plugin
DOCKER_IMAGE ?= acs/ack-kms-plugin
METALINTER_CONCURRENCY ?= 4
METALINTER_DEADLINE ?= 180
VERSION ?= v0.0.1
CGO_ENABLED_FLAG ?= 0
ifeq ($(OS),Windows_NT)
GOOS_FLAG = windows
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
GOOS_FLAG = linux
endif
ifeq ($(UNAME_S), Darwin)
GOOS_FLAG = darwin
endif
endif
.PHONY: build
build:
@echo "Building..."
$Q GOOS=${GOOS_FLAG} CGO_ENABLED=${CGO_ENABLED_FLAG} go build .
build-image:
@echo "Building docker image..."
$Q docker build -t $(DOCKER_IMAGE):$(VERSION) .
.PHONY: clean deps test testint
deps: setup
@echo "Ensuring Dependencies..."
$Q go env
$Q dep ensure
clean:
@echo "Clean..."
$Q rm -rf $(BINARY)
setup: clean
@echo "Setup..."
go get -u github.com/golang/dep/cmd/dep
authors:
$Q git log --all --format='%aN <%cE>' | sort -u | sed -n '/github/!p' > GITAUTHORS
$Q cat AUTHORS GITAUTHORS | sort -u > NEWAUTHORS
$Q mv NEWAUTHORS AUTHORS
$Q rm -f NEWAUTHORS
$Q rm -f GITAUTHORS
testint:
@echo "Running Integration tests..."
$Q sudo GOPATH=$(GOPATH) go test -v -count=1 github.com/AliyunContainerService/ack-kms-plugin/tests/client
test:
@echo "Running Unit Tests..."
ifndef CI
@echo "Running Unit Tests outside CI..."
$Q go env
go test -v -count=1 `go list ./... | grep -v client`
else
@echo "Running Unit Tests inside CI..."
go test -v `go list ./... | grep -v client`
endif
check:
go install ./main.go
gometalinter --concurrency=$(METALINTER_CONCURRENCY) --deadline=$(METALINTER_DEADLINE)s ./... --vendor --linter='errcheck:errcheck:-ignore=net:Close' --cyclo-over=20 \
--linter='vet:go vet --no-recurse -composites=false:PATH:LINE:MESSAGE' --disable=interfacer --dupl-threshold=50
check-all:
go install ./main.go
gometalinter --concurrency=$(METALINTER_CONCURRENCY) --deadline=600s ./... --vendor --cyclo-over=20 \
--linter='vet:go vet --no-recurse:PATH:LINE:MESSAGE' --dupl-threshold=50
--dupl-threshold=50