-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (120 loc) · 5.77 KB
/
Makefile
File metadata and controls
142 lines (120 loc) · 5.77 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
.PHONY: all
all: proto-all tool-all test-unit build
#=============================================================================#
# Build #
#=============================================================================#
.PHONY: build
build:
@echo "==================================================================="
@echo "Building simd..."
@cd simapp && GOWORK=off make build 1> /dev/null
@echo "Completed build!"
#=============================================================================#
# Protobuf #
#=============================================================================#
BUF_VERSION=1.50
BUILDER_VERSION=0.15.3
.PHONY: proto-all proto-format proto-lint proto-gen
proto-all: proto-format proto-lint proto-gen proto-testutil-gen
proto-format:
@echo "==================================================================="
@echo "Running protobuf formatter..."
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
bufbuild/buf:$(BUF_VERSION) format --diff --write
@echo "Completed protobuf formatting!"
proto-gen:
@echo "==================================================================="
@echo "Generating code from protobuf..."
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
ghcr.io/cosmos/proto-builder:$(BUILDER_VERSION) sh ./proto/generate.sh
@echo "Completed code generation!"
proto-lint:
@echo "==================================================================="
@echo "Running protobuf linter..."
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
bufbuild/buf:$(BUF_VERSION) lint
@echo "Completed protobuf linting!"
proto-testutil-gen:
@echo "==================================================================="
@echo "Generating code from testutil protobuf..."
@docker run --rm --volume "$(PWD)"/testutil/testdata:/workspace --workdir /workspace \
ghcr.io/cosmos/proto-builder:$(BUILDER_VERSION) buf generate --template ./buf.gen.yaml
@echo "Completed code generation!"
#=============================================================================#
# Tooling #
#=============================================================================#
.PHONY: tool-all license format lint vulncheck nancy
tool-all : license format lint vulncheck nancy
FILES := $(shell find . -name "*.go" -not -path "./simapp/*" -not -name "*.pb.go" -not -name "*.pb.gw.go" -not -name "*.pulsar.go")
license:
@echo "==================================================================="
@echo "Adding license to files..."
@go-license --config .github/license.yaml $(FILES)
@echo "Completed license addition!"
check-license:
@echo "==================================================================="
@echo "Checking files for license..."
@go-license --config .github/license.yaml $(FILES) --verify
format:
@echo "==================================================================="
@echo "Running formatters..."
@go tool golangci-lint fmt -c ./.golangci.yaml
@echo "Completed formatting!"
lint:
@echo "==================================================================="
@echo "Running linter..."
-@go tool golangci-lint run -c ./.golangci.yaml
-@go-license --config .github/license.yaml --verify $(FILES)
@echo "Completed linting!"
vulncheck:
@echo "==================================================================="
@echo "Running vulnerability check..."
@go tool govulncheck ./...
@echo "Completed vulnerability check!"
NANCY_VERSION=v1.0
NANCY_IMAGE=sonatypecommunity/nancy:$(NANCY_VERSION)
nancy:
@echo "==================================================================="
@echo "Running Nancy vulnerability scanner..."
@go list -json -deps ./... | docker run --rm -i \
--volume "$(PWD)":/workspace \
--workdir /workspace \
-e NANCY_USER \
-e NANCY_TOKEN \
$(NANCY_IMAGE) sleuth \
--username $(NANCY_USER) \
--token $(NANCY_TOKEN) \
--exclude-vulnerability-file .nancy-ignore
@echo "Completed Nancy vulnerability scan!"
#=============================================================================#
# Test #
#=============================================================================#
.PHONY: test-unit test-unit-viz local-image
test-unit:
@echo "==================================================================="
@echo "Running unit tests for keeper package..."
@go test -v ./keeper/...
@echo "Running unit tests for controller package..."
@go test -v ./controller/...
@echo "Running unit tests for types package..."
@go test -v ./types/...
test-unit-viz:
@echo "==================================================================="
@echo "Running unit tests for keeper package..."
@go test -cover -coverpkg=./keeper/... -coverprofile=coverage_keeper.out -race -v ./keeper/...
@go tool cover -html=coverage_keeper.out && go tool cover -func=coverage_keeper.out
@echo "Running unit tests for controller package..."
@go test -cover -coverpkg=./controller/... -coverprofile=coverage_controller.out -race -v ./controller/...
@go tool cover -html=coverage_controller.out && go tool cover -func=coverage_controller.out
@echo "Running unit tests for types package..."
@go test -cover -coverpkg=./types/... -coverprofile=coverage_types.out -race -v ./types/...
@go tool cover -html=coverage_types.out && go tool cover -func=coverage_types.out
local-image:
@echo "🤖 Building image..."
@docker build -t orbiter-simd:local .
@echo "✅ Completed build!"
test-e2e:
@echo "==================================================================="
@echo "Running e2e tests..."
@cd e2e && go test -timeout 15m -race -v ./...
@echo "Completed e2e tests!"