-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (30 loc) · 897 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
TOOL := "jimmystewpot/in-addr"
INTERACTIVE := $(shell [ -t 0 ] && echo 1)
TEST_DIRS := ./...
REPORTS_DIR := ci
test-all: deps lint test
reportdir:
if [ ! -d "$(REPORTS_DIR)" ]; then mkdir $(REPORTS_DIR); fi
deps:
@echo ""
@echo "***** Installing dependencies for ${TOOL} *****"
go clean --cache
go install github.com/golangci/golangci-lint/cmd/[email protected]
lint: deps reportdir
@echo ""
@echo "***** linting ${TOOL} with golangci-lint *****"
ifdef INTERACTIVE
golangci-lint run -v $(TEST_DIRS)
else
golangci-lint run --out-format checkstyle -v $(TEST_DIRS) 1> $(REPORTS_DIR)/checkstyle-lint.xml
endif
.PHONY: lint
test:
@echo ""
@echo "***** Testing ${TOOL} *****"
ifdef INTERACTIVE
go test -a -v -race $(TEST_DIRS)
else
go test -a -v -race -coverprofile=$(REPORTS_DIR)/coverage.txt -covermode=atomic -json $(TEST_DIRS) 1> $(REPORTS_DIR)/testreport.json
endif
@echo ""