forked from aws/aws-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
232 lines (188 loc) · 7.97 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
LINTIGNOREDOC='service/[^/]+/(api|service|waiters)\.go:.+(comment on exported|should have comment or be unexported)'
LINTIGNORECONST='service/[^/]+/(api|service|waiters)\.go:.+(type|struct field|const|func) ([^ ]+) should be ([^ ]+)'
LINTIGNORESTUTTER='service/[^/]+/(api|service)\.go:.+(and that stutters)'
LINTIGNOREINFLECT='service/[^/]+/(api|errors|service)\.go:.+(method|const) .+ should be '
LINTIGNOREINFLECTS3UPLOAD='service/s3/s3manager/upload\.go:.+struct field SSEKMSKeyId should be '
LINTIGNOREENDPOINTS='aws/endpoints/(defaults|dep_service_ids).go:.+(method|const) .+ should be '
LINTIGNOREDEPS='vendor/.+\.go'
LINTIGNOREPKGCOMMENT='service/[^/]+/doc_custom.go:.+package comment should be of the form'
UNIT_TEST_TAGS="example codegen awsinclude"
# SDK's Core and client packages that are compatable with Go 1.5+.
SDK_CORE_PKGS=./aws/... ./private/... ./internal/...
SDK_CLIENT_PKGS=./service/...
SDK_COMPA_PKGS=${SDK_CORE_PKGS} ${SDK_CLIENT_PKGS}
# SDK additional packages that are used for development of the SDK.
SDK_EXAMPLES_PKGS=./example/...
SDK_TESTING_PKGS=./awstesting/...
SDK_MODELS_PKGS=./models/...
SDK_ALL_PKGS=${SDK_COMPA_PKGS} ${SDK_TESTING_PKGS} ${SDK_EXAMPLES_PKGS} ${SDK_MODELS_PKGS}
all: generate unit
###################
# Code Generation #
###################
generate: cleanup-models gen-test gen-endpoints gen-services
gen-test: gen-protocol-test gen-codegen-test
gen-codegen-test:
@echo "Generating SDK API tests"
go generate ./private/model/api/codegentest/service
gen-services:
@echo "Generating SDK clients"
go generate ./service
gen-protocol-test:
@echo "Generating SDK protocol tests"
go generate ./private/protocol/...
gen-endpoints:
@echo "Generating SDK endpoints"
go generate ./models/endpoints
cleanup-models:
@echo "Cleaning up stale model versions"
go run -tags codegen ./private/model/cli/cleanup-models/* "./models/apis/*/*/api-2.json"
###################
# Unit/CI Testing #
###################
unit: verify
@echo "go test SDK and vendor packages"
go test -count=1 -tags ${UNIT_TEST_TAGS} ${SDK_ALL_PKGS}
unit-with-race-cover: verify
@echo "go test SDK and vendor packages"
go test -count=1 -tags ${UNIT_TEST_TAGS} -race -cpu=1,2,4 ${SDK_ALL_PKGS}
unit-old-go-race-cover:
@echo "go test SDK only packages for old Go versions"
go test -count=1 -race -cpu=1,2,4 ${SDK_COMPA_PKGS}
ci-test: generate unit-with-race-cover ci-test-generate-validate
ci-test-generate-validate:
@echo "CI test validate no generated code changes"
git update-index --assume-unchanged go.mod go.sum
git add . -A
gitstatus=`git diff --cached --ignore-space-change`; \
git update-index --no-assume-unchanged go.mod go.sum
echo "$$gitstatus"; \
if [ "$$gitstatus" != "" ] && [ "$$gitstatus" != "skipping validation" ]; then echo "$$gitstatus"; exit 1; fi
#######################
# Integration Testing #
#######################
integration: core-integ client-integ
core-integ:
@echo "Integration Testing SDK core"
AWS_REGION="" go test -count=1 -tags "integration" -v -run '^TestInteg_' ${SDK_CORE_PKGS} ./awstesting/...
client-integ:
@echo "Integration Testing SDK clients"
AWS_REGION="" go test -count=1 -tags "integration" -v -run '^TestInteg_' ./service/...
s3crypto-integ:
@echo "Integration Testing S3 Cyrpto utility"
AWS_REGION="" go test -count=1 -tags "s3crypto_integ integration" -v -run '^TestInteg_' ./service/s3/s3crypto
cleanup-integ-buckets:
@echo "Cleaning up SDK integraiton resources"
go run -tags "integration" ./awstesting/cmd/bucket_cleanup/main.go "aws-sdk-go-integration"
###################
# Sandbox Testing #
###################
sandbox-tests: sandbox-test-go1.5 sandbox-test-go1.6 sandbox-test-go1.7 sandbox-test-go1.8 sandbox-test-go1.9 sandbox-test-go1.10 sandbox-test-go1.11 sandbox-test-go1.12 sandbox-test-gotip
sandbox-build-go1.5:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.5 -t "aws-sdk-go-1.5" .
sandbox-go1.5: sandbox-build-go1.5
docker run -i -t aws-sdk-go-1.5 bash
sandbox-test-go1.5: sandbox-build-go1.5
docker run -t aws-sdk-go-1.5
sandbox-build-go1.5-novendorexp:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.5-novendorexp -t "aws-sdk-go-1.5-novendorexp" .
sandbox-go1.5-novendorexp: sandbox-build-go1.5-novendorexp
docker run -i -t aws-sdk-go-1.5-novendorexp bash
sandbox-test-go1.5-novendorexp: sandbox-build-go1.5-novendorexp
docker run -t aws-sdk-go-1.5-novendorexp
sandbox-build-go1.6:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.6 -t "aws-sdk-go-1.6" .
sandbox-go1.6: sandbox-build-go1.6
docker run -i -t aws-sdk-go-1.6 bash
sandbox-test-go1.6: sandbox-build-go1.6
docker run -t aws-sdk-go-1.6
sandbox-build-go1.7:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.7 -t "aws-sdk-go-1.7" .
sandbox-go1.7: sandbox-build-go17
docker run -i -t aws-sdk-go-1.7 bash
sandbox-test-go1.7: sandbox-build-go17
docker run -t aws-sdk-go-1.7
sandbox-build-go1.8:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.8 -t "aws-sdk-go-1.8" .
sandbox-go1.8: sandbox-build-go1.8
docker run -i -t aws-sdk-go-1.8 bash
sandbox-test-go1.8: sandbox-build-go1.8
docker run -t aws-sdk-go-1.8
sandbox-build-go1.9:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.9 -t "aws-sdk-go-1.9" .
sandbox-go1.9: sandbox-build-go1.9
docker run -i -t aws-sdk-go-1.9 bash
sandbox-test-go1.9: sandbox-build-go1.9
docker run -t aws-sdk-go-1.9
sandbox-build-go1.10:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.10 -t "aws-sdk-go-1.10" .
sandbox-go1.10: sandbox-build-go1.10
docker run -i -t aws-sdk-go-1.10 bash
sandbox-test-go1.10: sandbox-build-go1.10
docker run -t aws-sdk-go-1.10
sandbox-build-go1.11:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.11 -t "aws-sdk-go-1.11" .
sandbox-go1.11: sandbox-build-go1.11
docker run -i -t aws-sdk-go-1.11 bash
sandbox-test-go1.11: sandbox-build-go1.11
docker run -t aws-sdk-go-1.11
sandbox-build-go1.12:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.12 -t "aws-sdk-go-1.12" .
sandbox-go1.12: sandbox-build-go1.12
docker run -i -t aws-sdk-go-1.12 bash
sandbox-test-go1.12: sandbox-build-go1.12
docker run -t aws-sdk-go-1.12
sandbox-build-gotip:
@echo "Run make update-aws-golang-tip, if this test fails because missing aws-golang:tip container"
docker build -f ./awstesting/sandbox/Dockerfile.test.gotip -t "aws-sdk-go-tip" .
sandbox-gotip: sandbox-build-gotip
docker run -i -t aws-sdk-go-tip bash
sandbox-test-gotip: sandbox-build-gotip
docker run -t aws-sdk-go-tip
update-aws-golang-tip:
docker build --no-cache=true -f ./awstesting/sandbox/Dockerfile.golang-tip -t "aws-golang:tip" .
##################
# Linting/Verify #
##################
verify: lint vet
lint:
@echo "go lint SDK and vendor packages"
@lint=`golint ./...`; \
dolint=`echo "$$lint" | grep -E -v -e ${LINTIGNOREDOC} -e ${LINTIGNORECONST} -e ${LINTIGNORESTUTTER} -e ${LINTIGNOREINFLECT} -e ${LINTIGNOREDEPS} -e ${LINTIGNOREINFLECTS3UPLOAD} -e ${LINTIGNOREPKGCOMMENT} -e ${LINTIGNOREENDPOINTS}`; \
echo "$$dolint"; \
if [ "$$dolint" != "" ]; then exit 1; fi
vet:
go vet -tags "example codegen awsinclude integration" --all ${SDK_ALL_PKGS}
################
# Dependencies #
################
get-deps: get-deps-tests get-deps-x-tests get-deps-codegen get-deps-verify
get-deps-tests:
@echo "go get SDK testing dependencies"
go get github.com/stretchr/testify
get-deps-x-tests:
@echo "go get SDK testing golang.org/x dependencies"
go get golang.org/x/net/http2
get-deps-codegen: get-deps-x-tests
@echo "go get SDK codegen dependencies"
go get golang.org/x/net/html
get-deps-verify:
@echo "go get SDK verification utilities"
go get golang.org/x/lint/golint
##############
# Benchmarks #
##############
bench:
@echo "go bench SDK packages"
go test -count=1 -run NONE -bench . -benchmem -tags 'bench' ${SDK_ALL_PKGS}
bench-protocol:
@echo "go bench SDK protocol marshallers"
go test -count=1 -run NONE -bench . -benchmem -tags 'bench' ./private/protocol/...
#############
# Utilities #
#############
docs:
@echo "generate SDK docs"
$(AWS_DOC_GEN_TOOL) `pwd`
api_info:
@go run private/model/cli/api-info/api-info.go