Skip to content

Commit 6cc237c

Browse files
committed
Update CI tests to ensure all codegen changes are accounted for in PR
Updates the CI tests to ensure that any code generation changes are accounted for in the PR, and that there were no mistaken changes made without also running code generation. This change should also help ensure that code generation order is stable, and there are no ordering issues with the SDK's codegen. V2 port of: aws/aws-sdk-go#1966
1 parent b82e064 commit 6cc237c

File tree

3 files changed

+39
-21
lines changed

3 files changed

+39
-21
lines changed

.travis.yml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
language: go
22

3-
sudo: required
4-
5-
go:
6-
- 1.5
7-
- 1.6
8-
- 1.7
9-
- 1.8
10-
- 1.9
11-
- tip
12-
13-
# Use Go 1.5's vendoring experiment for 1.5 tests.
14-
env:
15-
- GO15VENDOREXPERIMENT=1
16-
17-
install:
18-
- make get-deps
3+
matrix:
4+
allow_failures:
5+
- go: tip
6+
include:
7+
- os: linux
8+
sudo: required
9+
- os: linux
10+
sudo: required
11+
go: 1.9.x
12+
- os: linux
13+
sudo: required
14+
go: 1.10.x
15+
- os: linux
16+
sudo: required
17+
go: tip
18+
- os: osx
19+
go: 1.9.x
20+
- os: osx
21+
go: 1.10.x
22+
- os: osx
23+
go: tip
1924

2025
script:
21-
- make unit-with-race-cover
26+
- make ci-test
2227

23-
matrix:
24-
allow_failures:
25-
- go: tip
28+
branches:
29+
only:
30+
- master

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ SDK_ONLY_PKGS=$(shell go list ./... | grep -v "/vendor/")
1313
SDK_UNIT_TEST_ONLY_PKGS=$(shell go list -tags ${UNIT_TEST_TAGS} ./... | grep -v "/vendor/")
1414
SDK_GO_1_4=$(shell go version | grep "go1.4")
1515
SDK_GO_1_5=$(shell go version | grep "go1.5")
16+
SDK_GO_1_6=$(shell go version | grep "go1.6")
1617
SDK_GO_VERSION=$(shell go version | awk '''{print $$3}''' | tr -d '''\n''')
1718
SDK_V1_USAGE=$(shell go list -f '''{{ if not .Standard }}{{ range $$_, $$name := .Imports }} * {{ $$.ImportPath }} -> {{ $$name }}{{ print "\n" }}{{ end }}{{ end }}''' ./... | sort -u | grep '''/aws-sdk-go/''')
1819

@@ -65,6 +66,18 @@ unit-with-race-cover: get-deps-tests build verify
6566
@echo "go test SDK and vendor packages"
6667
@go test -tags ${UNIT_TEST_TAGS} -race -cpu=1,2,4 $(SDK_UNIT_TEST_ONLY_PKGS)
6768

69+
ci-test: ci-test-generate unit-with-race-cover ci-test-generate-validate
70+
71+
ci-test-generate: get-deps
72+
@echo "CI test generated code"
73+
@if [ \( -z "${SDK_GO_1_6}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then make generate; else echo "skipping generate"; fi
74+
75+
ci-test-generate-validate:
76+
@echo "CI test validate no generated code changes"
77+
@gitstatus=`if [ \( -z "${SDK_GO_1_6}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then git status --porcelain; else echo "skipping validation"; fi`; \
78+
echo "$$gitstatus"; \
79+
if [ "$$gitstatus" != "" ] && [ "$$gitstatus" != "skipping validation" ]; then git diff; exit 1; fi
80+
6881
integration: get-deps-tests integ-custom smoke-tests performance
6982

7083
integ-custom:

buildspec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ phases:
1212
- cd $SDK_GO_ROOT
1313
- go get -u github.com/golang/dep/cmd/dep
1414
- dep ensure
15-
- make unit
15+
- make ci-test
1616
- cd $SDK_CB_ROOT
1717
post_build:
1818
commands:

0 commit comments

Comments
 (0)