-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (49 loc) · 1.51 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
PKGS := $(shell go list ./... | grep -v /vendor)
.default: test
BIN_DIR := $(GOPATH)/bin
GOMETALINTER := $(BIN_DIR)/gometalinter
GOCOV := $(BIN_DIR)/gocov
GOCOV_XML := $(BIN_DIR)/gocov-xml
GO_JUNIT_REPORT := $(BIN_DIR)/go-junit-report
.PHONY: test
test: lint $(GOCOV) $(GOCOV_XML) $(GO_JUNIT_REPORT) reports_prepare
go test -v $(PKGS)
go test -v $(PKGS) | $(GO_JUNIT_REPORT) > reports/test.xml
$(GOCOV) test $(PKGS) | $(GOCOV_XML) > reports/coverage.xml
$(GOMETALINTER):
go get -u github.com/alecthomas/gometalinter
gometalinter --install
$(GOCOV):
go get -u github.com/axw/gocov/...
$(GOCOV_XML):
go get -u github.com/AlekSi/gocov-xml
$(GO_JUNIT_REPORT):
go get -u github.com/jstemmer/go-junit-report
.PHONY: dependencies
dependencies:
go get -u github.com/golang/dep/cmd/dep
dep ensure
.PHONY: reports_prepare
reports_prepare:
mkdir -p reports
.PHONY: lint
lint: $(GOMETALINTER) dependencies reports_prepare
$(GOMETALINTER) ./... --vendor -e "Subprocess launching with variable" -e "Subprocess launched with variable"
$(GOMETALINTER) ./... --vendor -e "Subprocess launching with variable" -e "Subprocess launched with variable" --checkstyle > reports/report.xml
BINARY := clp
PLATFORMS := windows linux darwin
os = $(word 1, $@)
.PHONY: $(PLATFORMS)
$(PLATFORMS):
mkdir -p release/
GOOS=$(os) GOARCH=amd64 go build -o release/$(BINARY)-$(os)
.PHONY: release
release: windows linux darwin
.PHONY: clean
clean:
rm -r release/
.PHONY: all
all: test release
.PHONY: release_tag
release_tag:
git tag `date +%Y%m%d%H%M`