-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (45 loc) · 1.47 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
export GOPATH ?= $(shell go env GOPATH)
export GO111MODULE ?= on
GOBASE=$(shell pwd)
export GOBIN=$(GOBASE)/bin
BIN_DIR = bin
APPNAME = app
LDFLAGS ?=
#.DEFAULT_GOAL := all
.PHONY: all
all: build
.PHONY: mod
mod:
go mod download
.PHONY: clean
clean: ## run all cleanup tasks
go clean ./...
rm -rf $(BIN_DIR)
cd cmd/go-runner && packr2 clean
cd cmd/go-test-parser && packr2 clean
golangci: ## install golangci-linter
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${BIN_DIR} v1.21.0
install_packr: ## install packr2
go install github.com/gobuffalo/packr/v2/packr2
.PHONY: install_deps
install_deps: golangci install_packr ## install necessary dependencies
.PHONY: build
build: ## build all applications
go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/go-test-parser cmd/go-test-parser/*.go
go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/go-runner cmd/go-runner/*.go
.PHONY: packr
packr: ##
cd cmd/go-runner && $(GOBIN)/packr2
cd cmd/go-test-parser && $(GOBIN)/packr2
.PHONY: unit
unit: ## run unit tests
go test -v ./... -count 10 -race
.PHONY: unit-ci
unit-ci: ## run unit tests with json output
go test -v ./... -count 10 -race -json
.PHONY: lint
lint: golangci ## run linter
${BIN_DIR}/golangci-lint --color=always run ./... -v --timeout 5m
.PHONY: help
help: ## display help screen
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'