forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
161 lines (123 loc) · 3.87 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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
all: build
include tests/robustness/makefile.mk
.PHONY: build
build:
GO_BUILD_FLAGS="${GO_BUILD_FLAGS} -v -mod=readonly" ./scripts/build.sh
.PHONY: tools
tools:
GO_BUILD_FLAGS="${GO_BUILD_FLAGS} -v -mod=readonly" ./scripts/build_tools.sh
TEMP_TEST_ANALYZER_DIR=/tmp/etcd-test-analyzer
TEST_ANALYZER_BIN=${PWD}/bin
bin/etcd-test-analyzer: $(TEMP_TEST_ANALYZER_DIR)/*
make -C ${TEMP_TEST_ANALYZER_DIR} build
mkdir -p ${TEST_ANALYZER_BIN}
install ${TEMP_TEST_ANALYZER_DIR}/bin/etcd-test-analyzer ${TEST_ANALYZER_BIN}
${TEST_ANALYZER_BIN}/etcd-test-analyzer -h
$(TEMP_TEST_ANALYZER_DIR)/*:
git clone "https://github.com/endocrimes/etcd-test-analyzer.git" ${TEMP_TEST_ANALYZER_DIR}
# Tests
GO_TEST_FLAGS?=
.PHONY: test
test:
PASSES="unit integration release e2e" ./scripts/test.sh $(GO_TEST_FLAGS)
.PHONY: test-unit
test-unit:
PASSES="unit" ./scripts/test.sh $(GO_TEST_FLAGS)
.PHONY: test-integration
test-integration:
PASSES="integration" ./scripts/test.sh $(GO_TEST_FLAGS)
.PHONY: test-e2e
test-e2e: build
PASSES="e2e" ./scripts/test.sh $(GO_TEST_FLAGS)
.PHONY: test-grpcproxy-integration
test-grpcproxy-integration:
PASSES="grpcproxy_integration" ./scripts/test.sh $(GO_TEST_FLAGS)
.PHONY: test-grpcproxy-e2e
test-grpcproxy-e2e: build
PASSES="grpcproxy_e2e" ./scripts/test.sh $(GO_TEST_FLAGS)
.PHONY: test-e2e-release
test-e2e-release: build
PASSES="release e2e" ./scripts/test.sh $(GO_TEST_FLAGS)
.PHONY: test-robustness
test-robustness:
PASSES="robustness" ./scripts/test.sh $(GO_TEST_FLAGS)
.PHONY: fuzz
fuzz:
./scripts/fuzzing.sh
# Static analysis
verify: verify-gofmt verify-bom verify-lint verify-dep verify-shellcheck verify-goword \
verify-govet verify-license-header verify-receiver-name verify-mod-tidy verify-shellcheck \
verify-shellws verify-proto-annotations verify-genproto verify-goimport verify-yamllint
fix: fix-bom fix-lint fix-yamllint
./scripts/fix.sh
.PHONY: verify-gofmt
verify-gofmt:
PASSES="gofmt" ./scripts/test.sh
.PHONY: verify-bom
verify-bom:
PASSES="bom" ./scripts/test.sh
.PHONY: update-bom
fix-bom:
./scripts/updatebom.sh
.PHONY: verify-dep
verify-dep:
PASSES="dep" ./scripts/test.sh
.PHONY: verify-lint
verify-lint:
golangci-lint run --config tools/.golangci.yaml
.PHONY: update-lint
fix-lint:
golangci-lint run --config tools/.golangci.yaml --fix
.PHONY: verify-shellcheck
verify-shellcheck:
PASSES="shellcheck" ./scripts/test.sh
.PHONY: verify-goword
verify-goword:
PASSES="goword" ./scripts/test.sh
.PHONY: verify-govet
verify-govet:
PASSES="govet" ./scripts/test.sh
.PHONY: verify-license-header
verify-license-header:
PASSES="license_header" ./scripts/test.sh
.PHONY: verify-receiver-name
verify-receiver-name:
PASSES="receiver_name" ./scripts/test.sh
.PHONY: verify-mod-tidy
verify-mod-tidy:
PASSES="mod_tidy" ./scripts/test.sh
.PHONY: verify-shellws
verify-shellws:
PASSES="shellws" ./scripts/test.sh
.PHONY: verify-proto-annotations
verify-proto-annotations:
PASSES="proto_annotations" ./scripts/test.sh
.PHONY: verify-genproto
verify-genproto:
PASSES="genproto" ./scripts/test.sh
.PHONY: verify-goimport
verify-goimport:
PASSES="goimport" ./scripts/test.sh
.PHONY: verify-yamllint
verify-yamllint:
yamllint --config-file tools/.yamllint .
YAMLFMT_VERSION = $(shell cd tools/mod && go list -m -f '{{.Version}}' github.com/google/yamlfmt)
.PHONY: fix-yamllint
fix-yamllint:
ifeq (, $(shell which yamlfmt))
$(shell go install github.com/google/yamlfmt/cmd/yamlfmt@$(YAMLFMT_VERSION))
endif
yamlfmt -conf tools/.yamlfmt .
# Cleanup
clean:
rm -f ./codecov
rm -rf ./covdir
rm -f ./bin/Dockerfile-release
rm -rf ./bin/etcd*
rm -rf ./default.etcd
rm -rf ./tests/e2e/default.etcd
rm -rf ./release
rm -rf ./coverage/*.err ./coverage/*.out
rm -rf ./tests/e2e/default.proxy
rm -rf ./bin/shellcheck*
find ./ -name "127.0.0.1:*" -o -name "localhost:*" -o -name "*.log" -o -name "agent-*" -o -name "*.coverprofile" -o -name "testname-proxy-*" -delete