Makefile 5.8 KB

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