-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
56 lines (40 loc) · 1.32 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
VERSION := `cat VERSION`
LDFLAGS := -X "main.Version=$(VERSION)"
GO_BUILD := go build -v -ldflags "$(LDFLAGS)"
CURRENTDIR = $(shell pwd)
COVERAGEDIR = $(CURRENTDIR)/coverage
PACKAGES = $(shell go list ./... | grep -v /vendor/)
TEST_TARGETS = $(PACKAGES)
all: lint test build
build: deps
$(GO_BUILD) -o build/appcop .
build_linux:
env GOOS=linux GOARCH=amd64 GO111MODULE=on $(GO_BUILD) -o build/appcop .
clean:
go clean -v .
rm -rf build
debug: deps
$(GO_BUILD) -race -tags 'debug' -o build/appcop .
deps:
@mkdir -p $(COVERAGEDIR)
@go get github.com/modocache/gover
@go get -u github.com/Masterminds/glide
@glide install
lint: deps lint-deps onlylint
lint-deps:
@which golangci-lint > /dev/null || \
(go get -u github.com/golangci/golangci-lint/cmd/golangci-lint)
release: lint test
GOARCH=amd64 GOOS=linux $(GO_BUILD) -o build/appcop .
test: deps $(SOURCES) $(TEST_TARGETS)
gover $(COVERAGEDIR) $(COVERAGEDIR)/gover.coverprofile
$(TEST_TARGETS):
go test -coverprofile=coverage/$(shell basename $@).coverprofile $@
pack: test lint build_linux
docker build -t appcop . && mkdir -p dist && docker run -v ${PWD}/dist:/work/dist appcop
onlylint: build
golangci-lint run --config=golangcilinter.yaml web marathon metrics mgc score config
version: deps
echo -n $(v) > VERSION
git add VERSION
git commit -m "Release $(v)"