forked from goto/guardian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (64 loc) · 2.29 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
NAME="github.com/goto/guardian"
COMMIT := $(shell git rev-parse --short HEAD)
TAG := "$(shell git rev-list --tags --max-count=1)"
VERSION := "$(shell git describe --tags ${TAG})-next"
BUILD_DIR=dist
PROTON_COMMIT := "9a99d4894eba2ae6319da2667838121209da9ec8"
.PHONY: all build clean test tidy vet proto setup format generate
all: clean test build format lint
tidy:
@echo "Tidy up go.mod..."
@go mod tidy -v
install:
@echo "Installing Guardian to ${GOBIN}..."
@go install
format:
@echo "Running go fmt..."
@go fmt
lint:
@echo "Running lint checks using golangci-lint..."
@golangci-lint run
clean: tidy
@echo "Cleaning up build directories..."
@rm -rf $coverage.out ${BUILD_DIR}
test:
go test ./... -race -coverprofile=coverage.out
test-short:
@echo "Running short tests by disabling store tests..."
go test ./... -race -short -coverprofile=coverage.out
coverage: test
@echo "Generating coverage report..."
@go tool cover -html=coverage.out
build:
@echo "Building guardian version ${VERSION}..."
go build -ldflags "-X ${NAME}/core.Version=${VERSION} -X ${NAME}/core.BuildCommit=${COMMIT}" -o dist/guardian .
@echo "Build complete"
buildr: setup
goreleaser --snapshot --skip-publish --rm-dist
vet:
go vet ./...
download:
@go mod download
generate:
@echo "Running go generate..."
go generate ./...
config:
@echo "Initializing sample server config..."
@cp internal/server/config.yaml config.yaml
proto:
@echo "Generating protobuf from goto/proton"
@echo " [info] make sure correct version of dependencies are installed using 'make setup'"
@buf generate https://github.com/goto/proton/archive/${PROTON_COMMIT}.zip#strip_components=1 --template buf.gen.yaml --path gotocompany/guardian
@echo "Protobuf compilation finished"
setup:
@echo "Installing dependencies..."
go mod download
go get google.golang.org/protobuf/cmd/[email protected]
go get github.com/golang/protobuf/[email protected]
go get github.com/golang/protobuf/[email protected]
go get google.golang.org/[email protected]
go get google.golang.org/grpc/cmd/[email protected]
go get github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
go get github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
go get github.com/bufbuild/buf/cmd/[email protected]
go get github.com/vektra/mockery/[email protected]