-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
33 lines (25 loc) · 1.11 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
GOCMD=go
GOBUILD=$(GOCMD) build
GOTEST=$(GOCMD) test
GOLANGCI_LINT=$(GOPATH)/bin/golangci-lint
GOLANGCI_LINT_RUN=$(GOLANGCI_LINT) run
GOVERALLS=$(GOPATH)/bin/goveralls
DIST=./dist
BINARY_NAME=treb
BINARY_NAME_WINDOWS=$(BINARY_NAME).exe
.PHONY: all restore build-prepare lint build build-unix build-windows test
all: build-prepare lint test build
build-prepare:
mkdir -p $(DIST)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.27.0
GO111MODULE=off go get -u github.com/mattn/goveralls
lint:
$(GOLANGCI_LINT_RUN) ./...
test:
$(GOTEST) -v -cover -coverprofile=./coverage.out ./...
$(GOVERALLS) -coverprofile="./coverage.out" -service=travis-ci
build: build-unix build-windows
build-unix: build-prepare
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -ldflags "-X github.com/hylandsoftware/trebuchet/cmd.version=$(VERSION)" -o $(DIST)/$(BINARY_NAME) -v main.go
build-windows: build-prepare
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -ldflags "-X github.com/hylandsoftware/trebuchet/cmd.version=$(VERSION)" -o $(DIST)/$(BINARY_NAME_WINDOWS) -v main.go