-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (43 loc) · 1.28 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
export GO111MODULE=on
export GOSUMDB=off
BIN := $(CURDIR)/bin
CMD := $(CURDIR)/cmd
CLI_BIN_NAME := assist
CLI_CMD_NAME := console
LINTER_TAG := v1.32.2
LINTER_BIN := $(BIN)/golangci-lint
CHECKLICENSE := $(CURDIR)/checklicense.sh
LOGS_DIR := $(CURDIR)/logs
TESTS_LOGS := $(LOGS_DIR)/tests.log
LINTER_LOGS := $(LOGS_DIR)/linter.log
.PHONY: all
all: lint test
.PHONY: lint
lint:
@echo "# Checking license headers ..."
@bash $(CHECKLICENSE) | tee $(LINTER_LOGS)
@echo "# Checking code with linters ..."
@$(LINTER_BIN) run --config=.golangci.yaml ./... | tee $(LINTER_LOGS)
@[ ! -s $(LINTER_LOGS) ]
.PHONY: test
test:
@echo "# Running tests ..."
@go test -race ./... | tee $(TESTS_LOGS)
.PHONY: cover
cover:
@echo "# Running coverage tests ..."
@go test -race -covermode=atomic -coverprofile=cover.out -coverpkg=./... ./...
@echo "# See coverage results in ./cover.html file"
@go tool cover -html=cover.out -o cover.html
.PHONY: generate
generate:
@echo "# Generating stuff ..."
@go generate ./...
.PHONY: linter
linter:
@echo "# Installing golangci-lint ..."
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin $(LINTER_TAG)
.PHONY: assist
assist:
@echo "# Building assist ..."
@go build -o $(BIN)/$(CLI_BIN_NAME) $(CMD)/$(CLI_CMD_NAME)