-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
41 lines (32 loc) · 1.31 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
# ------------------------------------------------------------------------------
# Configuration - Tooling
# ------------------------------------------------------------------------------
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
.PHONY: _download_tool
_download_tool:
(cd third_party && go mod tidy ) && \
GOBIN=$(PROJECT_DIR)/bin go install -modfile third_party/go.mod $(TOOL)
GOLANGCI_LINT = $(PROJECT_DIR)/bin/golangci-lint
.PHONY: golangci-lint
golangci-lint: ## Download golangci-lint locally if necessary.
@$(MAKE) _download_tool TOOL=github.com/golangci/golangci-lint/cmd/golangci-lint
GOTESTFMT = $(PROJECT_DIR)/bin/gotestfmt
.PHONY: gotestfmt
gotestfmt: ## Download gotestfmt locally if necessary.
@$(MAKE) _download_tool TOOL=github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt
# ------------------------------------------------------------------------------
# Build & Tests
# ------------------------------------------------------------------------------
.PHONY: verify.diff
verify.diff:
@./scripts/verify-diff.sh
.PHONY: lint
lint: golangci-lint
$(GOLANGCI_LINT) run -v
.PHONY: test.unit
test.unit:
go test -count 1 -v ./...
.PHONY: test.unit.pretty
test.unit.pretty: gotestfmt
go test -json -count 1 -v ./... | \
$(GOTESTFMT) -hide successful-downloads,empty-packages -showteststatus