github.com/aavshr/aws-sdk-go@v1.41.3/Makefile (about) 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 LINTIGNORESINGLEFIGHT='internal/sync/singleflight/singleflight.go:.+error should be the last type' 10 UNIT_TEST_TAGS="example codegen awsinclude" 11 ALL_TAGS="example codegen awsinclude integration perftest" 12 13 # SDK's Core and client packages that are compatable with Go 1.5+. 14 SDK_CORE_PKGS=./aws/... ./private/... ./internal/... 15 SDK_CLIENT_PKGS=./service/... 16 SDK_COMPA_PKGS=${SDK_CORE_PKGS} ${SDK_CLIENT_PKGS} 17 18 # SDK additional packages that are used for development of the SDK. 19 SDK_EXAMPLES_PKGS=./example/... 20 SDK_TESTING_PKGS=./awstesting/... 21 SDK_MODELS_PKGS=./models/... 22 SDK_ALL_PKGS=${SDK_COMPA_PKGS} ${SDK_TESTING_PKGS} ${SDK_EXAMPLES_PKGS} ${SDK_MODELS_PKGS} 23 24 TEST_TIMEOUT=-timeout 5m 25 26 all: generate unit 27 28 ################### 29 # Code Generation # 30 ################### 31 generate: cleanup-models gen-test gen-endpoints gen-services 32 33 gen-test: gen-protocol-test gen-codegen-test 34 35 gen-codegen-test: 36 @echo "Generating SDK API tests" 37 go generate ./private/model/api/codegentest/service 38 39 gen-services: 40 @echo "Generating SDK clients" 41 go generate ./service 42 43 gen-protocol-test: 44 @echo "Generating SDK protocol tests" 45 go generate ./private/protocol/... 46 47 gen-endpoints: 48 @echo "Generating SDK endpoints" 49 go generate ./models/endpoints 50 51 cleanup-models: 52 @echo "Cleaning up stale model versions" 53 go run -tags codegen ./private/model/cli/cleanup-models/* "./models/apis/*/*/api-2.json" 54 55 ################### 56 # Unit/CI Testing # 57 ################### 58 59 build: 60 go build -o /dev/null -tags ${ALL_TAGS} ${SDK_ALL_PKGS} 61 62 unit-no-verify: 63 @echo "go test SDK and vendor packages" 64 go test ${TEST_TIMEOUT} -v -count=1 -tags ${UNIT_TEST_TAGS} ${SDK_ALL_PKGS} 65 66 unit: verify build unit-no-verify 67 68 unit-with-race-cover: verify build 69 @echo "go test SDK and vendor packages" 70 go test ${TEST_TIMEOUT} -v -count=1 -tags ${UNIT_TEST_TAGS} -race -cpu=1,2,4 ${SDK_ALL_PKGS} 71 72 unit-old-go-race-cover: 73 @echo "go test SDK only packages for old Go versions" 74 go test ${TEST_TIMEOUT} -v -count=1 -race -cpu=1,2,4 ${SDK_COMPA_PKGS} 75 76 ci-test: generate unit-with-race-cover ci-test-generate-validate 77 78 ci-test-generate-validate: 79 @echo "CI test validate no generated code changes" 80 git update-index --assume-unchanged go.mod go.sum 81 git add . -A 82 gitstatus=`git diff --cached --ignore-space-change`; \ 83 echo "$$gitstatus"; \ 84 if [ "$$gitstatus" != "" ] && [ "$$gitstatus" != "skipping validation" ]; then echo "$$gitstatus"; exit 1; fi 85 git update-index --no-assume-unchanged go.mod go.sum 86 87 ####################### 88 # Integration Testing # 89 ####################### 90 integration: core-integ client-integ 91 92 core-integ: 93 @echo "Integration Testing SDK core" 94 AWS_REGION="" go test -count=1 -tags "integration" -v -run '^TestInteg_' ${SDK_CORE_PKGS} ./awstesting/... 95 96 client-integ: 97 @echo "Integration Testing SDK clients" 98 AWS_REGION="" go test -count=1 -tags "integration" -v -run '^TestInteg_' ./service/... 99 100 s3crypto-integ: 101 @echo "Integration Testing S3 Cyrpto utility" 102 AWS_REGION="" go test -count=1 -tags "s3crypto_integ integration" -v -run '^TestInteg_' ./service/s3/s3crypto 103 104 cleanup-integ-buckets: 105 @echo "Cleaning up SDK integraiton resources" 106 go run -tags "integration" ./awstesting/cmd/bucket_cleanup/main.go "aws-sdk-go-integration" 107 108 ################### 109 # Sandbox Testing # 110 ################### 111 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-go1.13 sandbox-test-go1.14 sandbox-test-go1.15 sandbox-test-go1.16 sandbox-test-go1.17 sandbox-test-gotip 112 113 sandbox-build-%: 114 @# sandbox-build-go1.17 115 @# sandbox-build-gotip 116 docker build \ 117 -f ./awstesting/sandbox/Dockerfile.test.$(subst sandbox-build-,,$@) \ 118 -t "aws-sdk-go-$(subst sandbox-build-,,$@)" . 119 sandbox-run-%: sandbox-build-% 120 @# sandbox-run-go1.17 121 @# sandbox-run-gotip 122 docker run -i -t "aws-sdk-go-$(subst sandbox-run-,,$@)" bash 123 sandbox-test-%: sandbox-build-% 124 @# sandbox-test-go1.17 125 @# sandbox-test-gotip 126 docker run -t "aws-sdk-go-$(subst sandbox-test-,,$@)" 127 128 update-aws-golang-tip: 129 docker build --no-cache=true -f ./awstesting/sandbox/Dockerfile.golang-tip -t "aws-golang:tip" . 130 131 ################## 132 # Linting/Verify # 133 ################## 134 verify: lint vet 135 136 lint: 137 @echo "go lint SDK and vendor packages" 138 @lint=`golint ./...`; \ 139 dolint=`echo "$$lint" | grep -E -v -e ${LINTIGNOREDOC} -e ${LINTIGNORECONST} -e ${LINTIGNORESTUTTER} -e ${LINTIGNOREINFLECT} -e ${LINTIGNOREDEPS} -e ${LINTIGNOREINFLECTS3UPLOAD} -e ${LINTIGNOREPKGCOMMENT} -e ${LINTIGNOREENDPOINTS} -e ${LINTIGNORESINGLEFIGHT}`; \ 140 echo "$$dolint"; \ 141 if [ "$$dolint" != "" ]; then exit 1; fi 142 143 vet: 144 go vet -tags "example codegen awsinclude integration" --all ${SDK_ALL_PKGS} 145 146 ################ 147 # Dependencies # 148 ################ 149 get-deps: 150 @echo "getting pre go module dependnecies" 151 go get github.com/jmespath/go-jmespath 152 153 get-deps-verify: 154 @echo "go get SDK verification utilities" 155 go get golang.org/x/lint/golint 156 157 ############## 158 # Benchmarks # 159 ############## 160 bench: 161 @echo "go bench SDK packages" 162 go test -count=1 -run NONE -bench . -benchmem -tags 'bench' ${SDK_ALL_PKGS} 163 164 bench-protocol: 165 @echo "go bench SDK protocol marshallers" 166 go test -count=1 -run NONE -bench . -benchmem -tags 'bench' ./private/protocol/... 167 168 ############# 169 # Utilities # 170 ############# 171 docs: 172 @echo "generate SDK docs" 173 $(AWS_DOC_GEN_TOOL) `pwd` 174 175 api_info: 176 @go run private/model/cli/api-info/api-info.go