forked from screwdriver-cd/sd-local
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (41 loc) · 1008 Bytes
/
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
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOLIST=$(GOCMD) list
GOTOOL=$(GOCMD) tool
GOLIST_PKG=$(GOLIST) ./... | grep -v /vendor/
GOLINT=$(GOPATH)/bin/golint
GORELEASER=goreleaser
BINARY_NAME=sd-local
COVERPROFILE?=cover.out
all: test build
test: format vet lint clean_mod_file
$(GOTEST) -race -cover -coverprofile=$(COVERPROFILE) -covermode=atomic ./...
vet:
$(GOCMD) vet -v ./...
lint:
$(GOLIST_PKG) | xargs -n 1 $(GOLINT) -set_exit_status
format:
find . -name '*.go' | xargs gofmt -s -w
clean_mod_file:
$(GOCMD) mod tidy
mod_download:
$(GOCMD) mod download
build: mod_download
$(GOBUILD) -o $(BINARY_NAME) -v
publish_dry_run:
$(GORELEASER) --snapshot --skip-publish --rm-dist
publish:
$(GORELEASER) --rm-dist
run: build
./$(BINARY_NAME)
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -rf ./dist
cover_html:
$(GOTEST) -race -cover -coverprofile=cover.out -covermode=atomic ./...
$(GOTOOL) cover -html=cover.out -o cover.html
open cover.html