-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
55 lines (41 loc) · 1.37 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
include tools/tools.mk
MOCK_QUIET ?= --quiet
.PHONY: all
all: generate deps lint test
.PHONY: clean
clean:
@go clean
.PHONY: clean-tools
clean-tools:
@-rm -rf $(TOOLS_BIN_DIR)
.PHONY: lint
lint: $(GOLANGCI_LINT)
@ $(GOLANGCI_LINT) run --config=.golangci.yaml --fix
@ $(BUF) lint
@ $(BUF) format --diff --exit-code
.PHONY: deps
deps:
@ go mod tidy -e -compat=1.18
.PHONY: generate
generate: clean generate-proto-code generate-mocks
.PHONY: generate-proto-code
generate-proto-code: proto-gen-deps
@ $(BUF) format -w
@-rm -rf $(GENPB_DIR)
@ $(BUF) generate --template '$(BUF_GEN_TEMPLATE)' $(PROTOS_DIR)
.PHONY: generate-mocks
generate-mocks: $(MOCKERY)
@ $(MOCKERY) $(MOCK_QUIET) --srcpkg=./genpb/cerbos/cloud/apikey/v1/apikeyv1connect --name=ApiKeyServiceHandler
@ $(MOCKERY) $(MOCK_QUIET) --srcpkg=./genpb/cerbos/cloud/bundle/v1/bundlev1connect --name=CerbosBundleServiceHandler
@ $(MOCKERY) $(MOCK_QUIET) --srcpkg=./genpb/cerbos/cloud/logs/v1/logsv1connect --name=CerbosLogsServiceHandler
.PHONY: compile
compile:
@ go build ./... && go test -tags="tests integration" -run=ignore ./... > /dev/null
.PHONY: test
test: $(GOTESTSUM) test-integration
.PHONY: test-unit
test-unit: $(GOTESTSUM)
@ $(GOTESTSUM) -- -tags=tests $(COVERPROFILE) -cover ./...
.PHONY: test-integration
test-integration: $(GOTESTSUM)
@ $(GOTESTSUM) -- -tags=tests,integration $(COVERPROFILE) -cover ./...