-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
52 lines (39 loc) · 1.3 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
all: push
TAG = 1.0
PREFIX = danielqsj/k8s-slackbot
REPO_INFO=$(shell git config --get remote.origin.url)
ifndef VERSION
VERSION := git-$(shell git rev-parse --short HEAD)
endif
# base package. It contains the common and backends code
PKG := "github.com/danielqsj/k8s-slackbot"
GO_LIST_FILES=$(shell go list ${PKG}/... | grep -v vendor | grep -v -e "test/e2e")
.PHONY: k8s-slackbot
k8s-slackbot: clean
CGO_ENABLED=0 GOOS=linux GO15VENDOREXPERIMENT=1 go build -a -installsuffix cgo -ldflags \
"-s -w -X main.version=${VERSION} -X main.gitRepo=${REPO_INFO}" \
-o k8s-slackbot \
./main.go
.PHONY: container
container: k8s-slackbot
docker build -t $(PREFIX):$(TAG) .
.PHONY: push
push: container
docker push $(PREFIX):$(TAG)
.PHONY: clean
clean:
rm -f k8s-slackbot
.PHONY: cover
cover:
@go list -f '{{if len .TestGoFiles}}"go test -coverprofile={{.Dir}}/.coverprofile {{.ImportPath}}"{{end}}' ${GO_LIST_FILES} | xargs -L 1 sh -c
gover
goveralls -coverprofile=gover.coverprofile -service travis-ci
.PHONY: vet
vet:
@go vet ${GO_LIST_FILES}
.PHONY: fmt
fmt:
@go list -f '{{if len .TestGoFiles}}"gofmt -s -l {{.Dir}}"{{end}}' ${GO_LIST_FILES} | xargs -L 1 sh -c
.PHONY: lint
lint:
@go list -f '{{if len .TestGoFiles}}"golint -min_confidence=0.85 {{.Dir}}/..."{{end}}' ${GO_LIST_FILES} | xargs -L 1 sh -c