Makefile 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. LINTIGNOREDOT='awstesting/integration.+should not use dot imports'
  2. LINTIGNOREDOC='service/[^/]+/(api|service|waiters)\.go:.+(comment on exported|should have comment or be unexported)'
  3. LINTIGNORECONST='service/[^/]+/(api|service|waiters)\.go:.+(type|struct field|const|func) ([^ ]+) should be ([^ ]+)'
  4. LINTIGNORESTUTTER='service/[^/]+/(api|service)\.go:.+(and that stutters)'
  5. LINTIGNOREINFLECT='service/[^/]+/(api|errors|service)\.go:.+(method|const) .+ should be '
  6. LINTIGNOREINFLECTS3UPLOAD='service/s3/s3manager/upload\.go:.+struct field SSEKMSKeyId 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_WITH_VENDOR_PKGS=$(shell go list -tags ${UNIT_TEST_TAGS} ./... | grep -v "/vendor/src")
  11. SDK_ONLY_PKGS=$(shell go list ./... | grep -v "/vendor/")
  12. SDK_UNIT_TEST_ONLY_PKGS=$(shell go list -tags ${UNIT_TEST_TAGS} ./... | grep -v "/vendor/")
  13. SDK_GO_1_4=$(shell go version | grep "go1.4")
  14. SDK_GO_1_5=$(shell go version | grep "go1.5")
  15. SDK_GO_VERSION=$(shell go version | awk '''{print $$3}''' | tr -d '''\n''')
  16. all: get-deps generate unit
  17. help:
  18. @echo "Please use \`make <target>' where <target> is one of"
  19. @echo " api_info to print a list of services and versions"
  20. @echo " docs to build SDK documentation"
  21. @echo " build to go build the SDK"
  22. @echo " unit to run unit tests"
  23. @echo " integration to run integration tests"
  24. @echo " performance to run performance tests"
  25. @echo " verify to verify tests"
  26. @echo " lint to lint the SDK"
  27. @echo " vet to vet the SDK"
  28. @echo " generate to go generate and make services"
  29. @echo " gen-test to generate protocol tests"
  30. @echo " gen-services to generate services"
  31. @echo " get-deps to go get the SDK dependencies"
  32. @echo " get-deps-tests to get the SDK's test dependencies"
  33. @echo " get-deps-verify to get the SDK's verification dependencies"
  34. generate: gen-test gen-endpoints gen-services
  35. gen-test: gen-protocol-test
  36. gen-services:
  37. go generate ./service
  38. gen-protocol-test:
  39. go generate ./private/protocol/...
  40. gen-endpoints:
  41. go generate ./models/endpoints/
  42. build:
  43. @echo "go build SDK and vendor packages"
  44. @go build ${SDK_ONLY_PKGS}
  45. unit: get-deps-tests build verify
  46. @echo "go test SDK and vendor packages"
  47. @go test -tags ${UNIT_TEST_TAGS} $(SDK_UNIT_TEST_ONLY_PKGS)
  48. unit-with-race-cover: get-deps-tests build verify
  49. @echo "go test SDK and vendor packages"
  50. @go test -tags ${UNIT_TEST_TAGS} -race -cpu=1,2,4 $(SDK_UNIT_TEST_ONLY_PKGS)
  51. integration: get-deps-tests integ-custom smoke-tests performance
  52. integ-custom:
  53. go test -tags "integration" ./awstesting/integration/customizations/...
  54. cleanup-integ:
  55. go run -tags "integration" ./awstesting/cmd/bucket_cleanup/main.go "aws-sdk-go-integration"
  56. smoke-tests: get-deps-tests
  57. gucumber -go-tags "integration" ./awstesting/integration/smoke
  58. performance: get-deps-tests
  59. AWS_TESTING_LOG_RESULTS=${log-detailed} AWS_TESTING_REGION=$(region) AWS_TESTING_DB_TABLE=$(table) gucumber -go-tags "integration" ./awstesting/performance
  60. sandbox-tests: sandbox-test-go15 sandbox-test-go15-novendorexp sandbox-test-go16 sandbox-test-go17 sandbox-test-go18 sandbox-test-go19 sandbox-test-gotip
  61. sandbox-build-go15:
  62. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.5 -t "aws-sdk-go-1.5" .
  63. sandbox-go15: sandbox-build-go15
  64. docker run -i -t aws-sdk-go-1.5 bash
  65. sandbox-test-go15: sandbox-build-go15
  66. docker run -t aws-sdk-go-1.5
  67. sandbox-build-go15-novendorexp:
  68. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.5-novendorexp -t "aws-sdk-go-1.5-novendorexp" .
  69. sandbox-go15-novendorexp: sandbox-build-go15-novendorexp
  70. docker run -i -t aws-sdk-go-1.5-novendorexp bash
  71. sandbox-test-go15-novendorexp: sandbox-build-go15-novendorexp
  72. docker run -t aws-sdk-go-1.5-novendorexp
  73. sandbox-build-go16:
  74. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.6 -t "aws-sdk-go-1.6" .
  75. sandbox-go16: sandbox-build-go16
  76. docker run -i -t aws-sdk-go-1.6 bash
  77. sandbox-test-go16: sandbox-build-go16
  78. docker run -t aws-sdk-go-1.6
  79. sandbox-build-go17:
  80. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.7 -t "aws-sdk-go-1.7" .
  81. sandbox-go17: sandbox-build-go17
  82. docker run -i -t aws-sdk-go-1.7 bash
  83. sandbox-test-go17: sandbox-build-go17
  84. docker run -t aws-sdk-go-1.7
  85. sandbox-build-go18:
  86. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.8 -t "aws-sdk-go-1.8" .
  87. sandbox-go18: sandbox-build-go18
  88. docker run -i -t aws-sdk-go-1.8 bash
  89. sandbox-test-go18: sandbox-build-go18
  90. docker run -t aws-sdk-go-1.8
  91. sandbox-build-go19:
  92. docker build -f ./awstesting/sandbox/Dockerfile.test.go1.8 -t "aws-sdk-go-1.9" .
  93. sandbox-go19: sandbox-build-go19
  94. docker run -i -t aws-sdk-go-1.9 bash
  95. sandbox-test-go19: sandbox-build-go19
  96. docker run -t aws-sdk-go-1.9
  97. sandbox-build-gotip:
  98. @echo "Run make update-aws-golang-tip, if this test fails because missing aws-golang:tip container"
  99. docker build -f ./awstesting/sandbox/Dockerfile.test.gotip -t "aws-sdk-go-tip" .
  100. sandbox-gotip: sandbox-build-gotip
  101. docker run -i -t aws-sdk-go-tip bash
  102. sandbox-test-gotip: sandbox-build-gotip
  103. docker run -t aws-sdk-go-tip
  104. update-aws-golang-tip:
  105. docker build --no-cache=true -f ./awstesting/sandbox/Dockerfile.golang-tip -t "aws-golang:tip" .
  106. verify: get-deps-verify lint vet
  107. lint:
  108. @echo "go lint SDK and vendor packages"
  109. @lint=`if [ \( -z "${SDK_GO_1_4}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then golint ./...; else echo "skipping golint"; fi`; \
  110. lint=`echo "$$lint" | grep -E -v -e ${LINTIGNOREDOT} -e ${LINTIGNOREDOC} -e ${LINTIGNORECONST} -e ${LINTIGNORESTUTTER} -e ${LINTIGNOREINFLECT} -e ${LINTIGNOREDEPS} -e ${LINTIGNOREINFLECTS3UPLOAD} -e ${LINTIGNOREPKGCOMMENT}`; \
  111. echo "$$lint"; \
  112. if [ "$$lint" != "" ] && [ "$$lint" != "skipping golint" ]; then exit 1; fi
  113. SDK_BASE_FOLDERS=$(shell ls -d */ | grep -v vendor | grep -v awsmigrate)
  114. ifneq (,$(findstring go1.4, ${SDK_GO_VERSION}))
  115. GO_VET_CMD=echo skipping go vet, ${SDK_GO_VERSION}
  116. else ifneq (,$(findstring go1.6, ${SDK_GO_VERSION}))
  117. GO_VET_CMD=go tool vet --all -shadow -example=false
  118. else
  119. GO_VET_CMD=go tool vet --all -shadow
  120. endif
  121. vet:
  122. ${GO_VET_CMD} ${SDK_BASE_FOLDERS}
  123. get-deps: get-deps-tests get-deps-verify
  124. @echo "go get SDK dependencies"
  125. @go get -v $(SDK_ONLY_PKGS)
  126. get-deps-tests:
  127. @echo "go get SDK testing dependencies"
  128. go get github.com/gucumber/gucumber/cmd/gucumber
  129. go get github.com/stretchr/testify
  130. go get github.com/smartystreets/goconvey
  131. go get golang.org/x/net/html
  132. go get golang.org/x/net/http2
  133. get-deps-verify:
  134. @echo "go get SDK verification utilities"
  135. @if [ \( -z "${SDK_GO_1_4}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then go get github.com/golang/lint/golint; else echo "skipped getting golint"; fi
  136. bench:
  137. @echo "go bench SDK packages"
  138. @go test -run NONE -bench . -benchmem -tags 'bench' $(SDK_ONLY_PKGS)
  139. bench-protocol:
  140. @echo "go bench SDK protocol marshallers"
  141. @go test -run NONE -bench . -benchmem -tags 'bench' ./private/protocol/...
  142. docs:
  143. @echo "generate SDK docs"
  144. @# This env variable, DOCS, is for internal use
  145. @if [ -z ${AWS_DOC_GEN_TOOL} ]; then\
  146. rm -rf doc && bundle install && bundle exec yard;\
  147. else\
  148. $(AWS_DOC_GEN_TOOL) `pwd`;\
  149. fi
  150. api_info:
  151. @go run private/model/cli/api-info/api-info.go