Makefile 6.0 KB

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