-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
55 lines (43 loc) · 1.13 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
# Copyright SecureKey Technologies Inc.
#
# SPDX-License-Identifier: Apache-2.0
# Tool commands (overridable)
DOCKER_CMD ?= docker
GOBIN_PATH=$(abspath .)/build/bin
MOCKGEN=$(GOBIN_PATH)/mockgen
GOMOCKS=pkg/internal/gomocks
MOCK_VERSION ?=v1.7.0-rc.1
OS := $(shell uname)
ifeq ($(OS),$(filter $(OS),Darwin Linux))
PATH:=$(PATH):$(GOBIN_PATH)
else
PATH:=$(PATH);$(subst /,\\,$(GOBIN_PATH))
endif
.PHONY: all
all: clean checks unit-test
.PHONY: checks
checks: generate license lint
.PHONY: lint
lint: generate
@scripts/check_lint.sh
.PHONY: license
license:
@scripts/check_license.sh
.PHONY: unit-test
unit-test: generate
@scripts/check_unit.sh
.PHONY: clean
clean:
@rm -rf ./.build
@rm -rf coverage*.out
.PHONY: generate
generate:
@GOBIN=$(GOBIN_PATH) go install github.com/golang/mock/mockgen@$(MOCK_VERSION)
@go generate ./...
.PHONY: tidy-modules
tidy-modules:
@find . -type d \( -name build -prune \) -o -name go.mod -print | while read -r gomod_path; do \
dir_path=$$(dirname "$$gomod_path"); \
echo "Executing 'go mod tidy' in directory: $$dir_path"; \
(cd "$$dir_path" && GOPROXY=$(GOPROXY) go mod tidy) || exit 1; \
done