-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (43 loc) · 1.58 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
DOCKER ?= docker
GO_CMD?=go
CI_LINT ?= golangci-lint
CGO_ENABLED?=0
GOOS?=linux
GOARCH=amd64
GO111MODULE?=on
BUILD_INFO_PACKAGE = github.com/robotomize/cribe/internal/buildinfo
BUILD_TAG=$(shell git describe --tags --abbrev=0)
BUILD_TIME?=$(shell date -u '+%Y-%m-%d-%H:%M')
BUILD_NAME?=cribebot
unittest:
@$(GO_CMD) test -short $$(go list ./... | grep -v /vendor/)
test:
@$(GO_CMD) test -v -cover -covermode=atomic ./...
test-cover:
@$(GO_CMD) test -count=2 -race -timeout=10m ./... -coverprofile=coverage.out
build:
GOARCH=${GOARCH} GO111MODULE=${GO111MODULE} CGO_ENABLED=0 GOOS=${GOOS} \
$(GO_CMD) build -o bin/cribe-bot -trimpath \
-ldflags "-s -w -X ${BUILD_INFO_PACKAGE}.BuildTag=${BUILD_TAG} -X ${BUILD_INFO_PACKAGE}.Time=${BUILD_TIME} -X ${BUILD_INFO_PACKAGE}.Name=${BUILD_NAME}" \
./cmd/cribe-bot
docker:
@$(DOCKER) build -t cribe .
vet:
@$(GO_CMD) list -f '{{.Dir}}' ./... | grep -v /vendor/ \
| grep -v '.*github.com/robotomize/cribe$$' \
| xargs $(GO_CMD) vet ; if [ $$? -eq 1 ]; then \
echo ""; \
echo "Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for reviewal."; \
fi
lint:
@$(GO_CMD) list -f '{{.Dir}}' ./... | grep -v /vendor/ \
| xargs golangci-lint run; if [ $$? -eq 1 ]; then \
echo ""; \
echo "Lint found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for reviewal."; \
fi
ci-lint:
@$(CI_LINT) run --deadline 10m --new-from-rev=HEAD~
bootstrap:
@$(GO_CMD) generate -tags tools tools/tools.go