Makefile 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. LINTIGNOREDOC='service/[^/]+/(api|service|waiters)\.go:.+(comment on exported|should have comment or be unexported)'
  2. LINTIGNORECONST='service/[^/]+/(api|service|waiters)\.go:.+(type|struct field|const|func) ([^ ]+) should be ([^ ]+)'
  3. LINTIGNORESTUTTER='service/[^/]+/(api|service)\.go:.+(and that stutters)'
  4. LINTIGNOREINFLECT='service/[^/]+/(api|errors|service)\.go:.+(method|const) .+ should be '
  5. LINTIGNOREINFLECTS3UPLOAD='service/s3/s3manager/upload\.go:.+struct field SSEKMSKeyId should be '
  6. LINTIGNOREENDPOINTS='aws/endpoints/(defaults|dep_service_ids).go:.+(method|const) .+ should be '
  7. LINTIGNOREDEPS='vendor/.+\.go'
  8. LINTIGNOREPKGCOMMENT='service/[^/]+/doc_custom.go:.+package comment should be of the form'
  9. UNIT_TEST_TAGS="example codegen awsinclude"
  10. # SDK's Core and client packages that are compatable with Go 1.5+.
  11. SDK_CORE_PKGS=./aws/... ./private/... ./internal/...
  12. SDK_CLIENT_PKGS=./service/...
  13. SDK_COMPA_PKGS=${SDK_CORE_PKGS} ${SDK_CLIENT_PKGS}
  14. # SDK additional packages that are used for development of the SDK.
  15. SDK_EXAMPLES_PKGS=./examples/...
  16. SDK_TESTING_PKGS=./awstesting/...
  17. SDK_MODELS_PKGS=./models/...
  18. SDK_ALL_PKGS=${SDK_COMPA_PKGS} ${SDK_TESTING_PKGS} ${SDK_EXAMPLES_PKGS} ${SDK_MODELS_PKGS}
  19. all: generate unit
  20. help:
  21. @echo "Please use \`make <target>' where <target> is one of"
  22. @echo " api_info to print a list of services and versions"
  23. @echo " docs to build SDK documentation"
  24. @echo " unit to run unit tests"
  25. @echo " integration to run integration tests"
  26. @echo " performance to run performance tests"
  27. @echo " verify to verify tests"
  28. @echo " lint to lint the SDK"
  29. @echo " vet to vet the SDK"
  30. @echo " generate to go generate and make services"
  31. @echo " gen-test to generate protocol tests"
  32. @echo " gen-services to generate services"
  33. @echo " get-deps to go get the SDK dependencies"
  34. ###################
  35. # Code Generation #
  36. ###################
  37. generate: cleanup-models gen-test gen-endpoints gen-services
  38. gen-test: gen-protocol-test gen-codegen-test
  39. gen-codegen-test: get-deps-codegen
  40. @echo "Generating SDK API tests"
  41. go generate ./private/model/api/codegentest/service
  42. gen-services: get-deps-codegen
  43. @echo "Generating SDK clients"
  44. go generate ./service
  45. gen-protocol-test: get-deps-codegen
  46. @echo "Generating SDK protocol tests"
  47. go generate ./private/protocol/...
  48. gen-endpoints: get-deps-codegen
  49. @echo "Generating SDK endpoints"
  50. go generate ./models/endpoints/
  51. cleanup-models: get-deps-codegen
  52. @echo "Cleaning up stale model versions"
  53. go run -tags codegen ./private/model/cli/cleanup-models/* "./models/apis/*/*/api-2.json"
  54. ###################
  55. # Unit/CI Testing #
  56. ###################
  57. unit: get-deps verify
  58. @echo "go test SDK and vendor packages"
  59. go test -tags ${UNIT_TEST_TAGS} ${SDK_ALL_PKGS}
  60. unit-with-race-cover: get-deps verify
  61. @echo "go test SDK and vendor packages"
  62. go test -tags ${UNIT_TEST_TAGS} -race -cpu=1,2,4 ${SDK_ALL_PKGS}
  63. unit-old-go-race-cover: get-deps-tests
  64. @echo "go test SDK only packages for old Go versions"
  65. go test -race -cpu=1,2,4 ${SDK_COMPA_PKGS}
  66. ci-test: generate unit-with-race-cover ci-test-generate-validate
  67. ci-test-generate-validate:
  68. @echo "CI test validate no generated code changes"
  69. git add . -A
  70. gitstatus=`git diff --cached --ignore-space-change`; \
  71. echo "$$gitstatus"; \
  72. if [ "$$gitstatus" != "" ] && [ "$$gitstatus" != "skipping validation" ]; then echo "$$gitstatus"; exit 1; fi
  73. #######################
  74. # Integration Testing #
  75. #######################
  76. integration: core-integ client-integ
  77. core-integ:
  78. @echo "Integration Testing SDK core"
  79. AWS_REGION="" go test -count=1 -tags "integration" -v -run '^TestInteg_' ./aws/... ./private/... ./internal/... ./awstesting/...
  80. client-integ:
  81. @echo "Integration Testing SDK clients"
  82. AWS_REGION="" go test -count=1 -tags "integration" -v -run '^TestInteg_' ./service/...
  83. s3crypto-integ:
  84. @echo "Integration Testing S3 Cyrpto utility"
  85. AWS_REGION="" go test -count=1 -tags "s3crypto_integ integration" -v -run '^TestInteg_' ./service/s3/s3crypto
  86. cleanup-integ-buckets:
  87. @echo "Cleaning up SDK integraiton resources"
  88. go run -tags "integration" ./awstesting/cmd/bucket_cleanup/main.go "aws-sdk-go-integration"
  89. ###################
  90. # Sandbox Testing #
  91. ###################
  92. sandbox-tests: sandbox-test-go15 sandbox-test-go16 sandbox-test-go17 sandbox-test-go18 sandbox-test-go19 sandbox-test-go110 sandbox-test-go111 sandbox-test-gotip
  93. sandbox-build-go15:
  94. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.5 -t "aws-sdk-go-1.5" .
  95. sandbox-go15: sandbox-build-go15
  96. docker run -i -t aws-sdk-go-1.5 bash
  97. sandbox-test-go15: sandbox-build-go15
  98. docker run -t aws-sdk-go-1.5
  99. sandbox-build-go15-novendorexp:
  100. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.5-novendorexp -t "aws-sdk-go-1.5-novendorexp" .
  101. sandbox-go15-novendorexp: sandbox-build-go15-novendorexp
  102. docker run -i -t aws-sdk-go-1.5-novendorexp bash
  103. sandbox-test-go15-novendorexp: sandbox-build-go15-novendorexp
  104. docker run -t aws-sdk-go-1.5-novendorexp
  105. sandbox-build-go16:
  106. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.6 -t "aws-sdk-go-1.6" .
  107. sandbox-go16: sandbox-build-go16
  108. docker run -i -t aws-sdk-go-1.6 bash
  109. sandbox-test-go16: sandbox-build-go16
  110. docker run -t aws-sdk-go-1.6
  111. sandbox-build-go17:
  112. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.7 -t "aws-sdk-go-1.7" .
  113. sandbox-go17: sandbox-build-go17
  114. docker run -i -t aws-sdk-go-1.7 bash
  115. sandbox-test-go17: sandbox-build-go17
  116. docker run -t aws-sdk-go-1.7
  117. sandbox-build-go18:
  118. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.8 -t "aws-sdk-go-1.8" .
  119. sandbox-go18: sandbox-build-go18
  120. docker run -i -t aws-sdk-go-1.8 bash
  121. sandbox-test-go18: sandbox-build-go18
  122. docker run -t aws-sdk-go-1.8
  123. sandbox-build-go19:
  124. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.9 -t "aws-sdk-go-1.9" .
  125. sandbox-go19: sandbox-build-go19
  126. docker run -i -t aws-sdk-go-1.9 bash
  127. sandbox-test-go19: sandbox-build-go19
  128. docker run -t aws-sdk-go-1.9
  129. sandbox-build-go110:
  130. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.10 -t "aws-sdk-go-1.10" .
  131. sandbox-go110: sandbox-build-go110
  132. docker run -i -t aws-sdk-go-1.10 bash
  133. sandbox-test-go110: sandbox-build-go110
  134. docker run -t aws-sdk-go-1.10
  135. sandbox-build-go111:
  136. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.11 -t "aws-sdk-go-1.11" .
  137. sandbox-go111: sandbox-build-go111
  138. docker run -i -t aws-sdk-go-1.11 bash
  139. sandbox-test-go111: sandbox-build-go111
  140. docker run -t aws-sdk-go-1.11
  141. sandbox-build-gotip:
  142. @echo "Run make update-aws-golang-tip, if this test fails because missing aws-golang:tip container"
  143. docker build -f ./awstesting/sandbox/Dockerfile.test.gotip -t "aws-sdk-go-tip" .
  144. sandbox-gotip: sandbox-build-gotip
  145. docker run -i -t aws-sdk-go-tip bash
  146. sandbox-test-gotip: sandbox-build-gotip
  147. docker run -t aws-sdk-go-tip
  148. update-aws-golang-tip:
  149. docker build --no-cache=true -f ./awstesting/sandbox/Dockerfile.golang-tip -t "aws-golang:tip" .
  150. ##################
  151. # Linting/Verify #
  152. ##################
  153. verify: get-deps-verify lint vet
  154. lint:
  155. @echo "go lint SDK and vendor packages"
  156. @lint=`golint ./...`; \
  157. dolint=`echo "$$lint" | grep -E -v -e ${LINTIGNOREDOC} -e ${LINTIGNORECONST} -e ${LINTIGNORESTUTTER} -e ${LINTIGNOREINFLECT} -e ${LINTIGNOREDEPS} -e ${LINTIGNOREINFLECTS3UPLOAD} -e ${LINTIGNOREPKGCOMMENT} -e ${LINTIGNOREENDPOINTS}`; \
  158. echo "$$dolint"; \
  159. if [ "$$dolint" != "" ]; then exit 1; fi
  160. vet:
  161. go vet -tags "example codegen awsinclude integration" --all ${SDK_ALL_PKGS}
  162. ################
  163. # Dependencies #
  164. ################
  165. get-deps: get-deps-tests get-deps-x-tests get-deps-codegen get-deps-verify
  166. get-deps-tests:
  167. @echo "go get SDK testing dependencies"
  168. go get github.com/stretchr/testify
  169. get-deps-x-tests:
  170. @echo "go get SDK testing golang.org/x dependencies"
  171. go get golang.org/x/net/http2
  172. get-deps-codegen: get-deps-x-tests
  173. @echo "go get SDK codegen dependencies"
  174. go get golang.org/x/net/html
  175. get-deps-verify:
  176. @echo "go get SDK verification utilities"
  177. go get golang.org/x/lint/golint
  178. bench:
  179. @echo "go bench SDK packages"
  180. go test -run NONE -bench . -benchmem -tags 'bench' ${SDK_ALL_PKGS}
  181. bench-protocol:
  182. @echo "go bench SDK protocol marshallers"
  183. go test -run NONE -bench . -benchmem -tags 'bench' ./private/protocol/...
  184. #############
  185. # Utilities #
  186. #############
  187. docs:
  188. @echo "generate SDK docs"
  189. $(AWS_DOC_GEN_TOOL) `pwd`
  190. api_info:
  191. @go run private/model/cli/api-info/api-info.go