-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
48 lines (37 loc) · 928 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
43
44
45
46
47
48
PACKAGE := github.com/deeprefactoring/deeprefactoring-bot
BINARY_NAME := deeprefactoring-bot
SHELL := /bin/bash
VERSION ?= $(shell git describe --long --tags --dirty --always)
DATE := $(shell date +%FT%T%z)
VERSION_FLAGS := -X main.buildVersion=$(VERSION) -X main.buildDate=$(DATE)
.PHONY: version
version:
@echo $(VERSION)
.PHONY: format-check
format-check:
@gofmt -l . | tee /dev/stderr | grep ^ && exit 1 || true > /dev/null 2>&1
.PHONY: vet
vet:
@go vet ./...
.PHONY: lint
lint: format-check vet
.PHONY: build
build:
go build -v -x \
-ldflags "-extldflags -static $(VERSION_FLAGS)" \
-o $(BINARY_NAME) \
$(PACKAGE)/cmd/app
.PHONY: test
test:
go test -v \
-cover -coverprofile=coverage.out \
-race \
./...
go tool cover -html=coverage.out -o coverage.html
.PHONY: bench
bench:
go test -v \
-bench . -benchtime 5s \
$(PACKAGE)
.PHONY: package
package: lint test build