-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathversion.mk
More file actions
92 lines (86 loc) · 4.84 KB
/
version.mk
File metadata and controls
92 lines (86 loc) · 4.84 KB
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
84
85
86
87
88
89
90
91
92
# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
GOLINTVERSION_HAVE := $(shell golangci-lint version | sed 's/.*version //' | sed 's/ .*//')
GOLINTVERSION_REQ := 2.8.0
GOJUNITREPORTVERSION_HAVE := $(shell go-junit-report -version | sed s/.*" v"// | sed 's/ .*//')
GOJUNITREPORTVERSION_REQ := 2.1.0
GOVERSION_REQ := 1.25.7
GOVERSION_HAVE := $(shell go version | sed 's/.*version go//' | sed 's/ .*//')
GCC_REQ := $(shell command -v gcc)
PROTOCGENDOCVERSION_HAVE := $(shell protoc-gen-doc --version | sed s/.*"version "// | sed 's/ .*//')
PROTOCGENDOCVERSION_REQ := 1.5.1
BUFVERSION_HAVE := $(shell buf --version)
BUFVERSION_REQ := 1.45.0
PROTOCGENGOGRPCVERSION_HAVE := $(shell protoc-gen-go-grpc -version | sed s/.*"protoc-gen-go-grpc "// | sed 's/ .*//')
PROTOCGENGOGRPCVERSION_REQ := 1.2.0
PROTOCGENGOVERSION_HAVE := $(shell protoc-gen-go --version | sed s/.*"protoc-gen-go v"// | sed 's/ .*//')
PROTOCGENGOVERSION_REQ := 1.30.0
# No version reported
GNOSTICVERSION_REQ := 0.6.9
GOCOBERTURAVERSION_REQ := 1.2.0
PROTOCGENENTVERSION_REQ := 0.6.0
PROTOCGENVALIDATEGOVERSION_REQ := 1.0.1
POSTGRES_VERSION := 16.4
dependency-check: go-dependency-check ## Check versions of installed tools against recommended versions
dependency: go-dependency ## Install all the dependency
go-dependency-check:
@(echo "$(GOVERSION_HAVE)" | grep "$(GOVERSION_REQ)" > /dev/null) || \
(echo "\e[1;31mWARNING: You are not using the recommended version of go\nRecommended: $(GOVERSION_REQ)\nYours: $(GOVERSION_HAVE)\e[1;m" && exit 1)
ifeq ($(GCC), true)
@(if ! [ $(GCC_REQ) > /dev/null 2>&1 ]; then echo "\e[1;31mWARNING: You seem not having \"gcc\" installed\e[1;m" && exit 1 ; fi)
endif
ifeq ($(GOLINT), true)
@(echo "$(GOLINTVERSION_HAVE)" | grep "$(GOLINTVERSION_REQ)" > /dev/null) || \
(echo "\e[1;31mWARNING: You are not using the recommended version of go-lint\nRecommended: $(GOLINTVERSION_REQ)\nYours: $(GOLINTVERSION_HAVE)\e[1;m" && exit 1)
endif
ifeq ($(GOJUNITREPORT), true)
@(echo "$(GOJUNITREPORTVERSION_HAVE)" | grep "$(GOJUNITREPORTVERSION_REQ)" > /dev/null) || \
(echo "\e[1;31mWARNING: You are not using the recommended version of go-junit-report\nRecommended: $(GOJUNITREPORTVERSION_REQ)\nYours: $(GOJUNITREPORTVERSION_HAVE)\e[1;m" && exit 1)
endif
ifeq ($(PROTOCGENDOC), true)
@(echo "$(PROTOCGENDOCVERSION_HAVE)" | grep "$(PROTOCGENDOCVERSION_REQ)" > /dev/null) || \
(echo "\e[1;31mWARNING: You are not using the recommended version of protoc-gen-doc\nRecommended: $(PROTOCGENDOCVERSION_REQ)\nYours: $(PROTOCGENDOCVERSION_HAVE)\e[1;m" && exit 1)
endif
ifeq ($(BUF), true)
@(echo "$(BUFVERSION_HAVE)" | grep "$(BUFVERSION_REQ)" > /dev/null) || \
(echo "\e[1;31mWARNING: You are not using the recommended version of buf\nRecommended: $(BUFVERSION_REQ)\nYours: $(BUFVERSION_HAVE)\e[1;m" && exit 1)
endif
ifeq ($(PROTOCGENGO), true)
@(echo "$(PROTOCGENGOVERSION_HAVE)" | grep "$(PROTOCGENGOVERSION_REQ)" > /dev/null) || \
(echo "\e[1;31mWARNING: You are not using the recommended version of protoc-gen-go\nRecommended: $(PROTOCGENGOVERSION_REQ)\nYours: $(PROTOCGENGOVERSION_HAVE)\e[1;m" && exit 1)
endif
ifeq ($(PROTOCGENGOGRPC), true)
@(echo "$(PROTOCGENGOGRPCVERSION_HAVE)" | grep "$(PROTOCGENGOGRPCVERSION_REQ)" > /dev/null) || \
(echo "\e[1;31mWARNING: You are not using the recommended version of protoc-gen-go-grpc\nRecommended: $(PROTOCGENGOGRPCVERSION_REQ)\nYours: $(PROTOCGENGOGRPCVERSION_HAVE)\e[1;m" && exit 1)
endif
go-dependency: ## install go dependency tooling
ifeq ($(GOJUNITREPORT), true)
$(GOCMD) install github.com/jstemmer/go-junit-report/v2@v$(GOJUNITREPORTVERSION_REQ)
endif
ifeq ($(GOLINT), true)
$(GOCMD) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v$(GOLINTVERSION_REQ)
endif
ifeq ($(PROTOCGENENT), true)
$(GOCMD) install entgo.io/contrib/entproto/cmd/protoc-gen-ent@v$(PROTOCGENENTVERSION_REQ)
endif
ifeq ($(MOCKGEN), true)
$(GOCMD) install github.com/golang/mock/mockgen@v$(MOCKGENVERSION_REQ)
endif
ifeq ($(BUF), true)
$(GOCMD) install github.com/bufbuild/buf/cmd/buf@v$(BUFVERSION_REQ)
endif
ifeq ($(PROTOCGENDOC), true)
$(GOCMD) install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v$(PROTOCGENDOCVERSION_REQ)
endif
ifeq ($(GOCOBERTURA), true)
$(GOCMD) install github.com/boumenot/gocover-cobertura@v$(GOCOBERTURAVERSION_REQ)
endif
ifeq ($(PROTOCGENGO), true)
$(GOCMD) install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v$(PROTOCGENGOGRPCVERSION_REQ)
endif
ifeq ($(PROTOCGENGOGRPC), true)
$(GOCMD) install google.golang.org/protobuf/cmd/protoc-gen-go@v$(PROTOCGENGOVERSION_REQ)
endif
ifeq ($(PROTOCGENVALIDATEGO), true)
$(GOCMD) install github.com/envoyproxy/protoc-gen-validate@v$(PROTOCGENVALIDATEGOVERSION_REQ)
endif