Skip to content

Commit

Permalink
add windows builds to SDK CI (#733)
Browse files Browse the repository at this point in the history
Updates Travis CI tests to include windows builds for latest versions of the SDK.

Also updates the travis CI to only build for master and feature/SmithyAPIClient branches so other feature branches for PRs don't have CI duplicated.
  • Loading branch information
jasdel authored and skmcgrail committed Sep 24, 2020
1 parent cb41c66 commit 477d531
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 28 deletions.
14 changes: 13 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,25 @@ os:
- osx
go:
- 1.15.x
- 1.14.x
- tip

script:
make ci-test-no-generate;

before_install:
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install make; fi

matrix:
allow_failures:
- go: tip

include:
- language: go
os: windows
go: 1.15.x
script:
- make ci-test-no-generate

- language: java
jdk: openjdk8
before_script:
Expand All @@ -40,3 +48,7 @@ matrix:
script:
- make smithy-generate # generation is not stable ci-test-generate-validate

branches:
only:
- master
- feature/SmithyAPIClient
27 changes: 17 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ LINTIGNOREDEPS='vendor/.+\.go'
LINTIGNOREPKGCOMMENT='service/[^/]+/doc_custom.go:.+package comment should be of the form'
LINTIGNOREENDPOINTS='aws/endpoints/defaults.go:.+(method|const) .+ should be '
LINTIGNORESINGLEFIGHT='internal/sync/singleflight/singleflight.go:.+error should be the last type'
UNIT_TEST_TAGS="example codegen awsinclude"
ALL_TAGS="example codegen awsinclude integration perftest sdktool"

UNIT_TEST_TAGS="example,codegen,awsinclude"
ALL_TAGS="example,codegen,awsinclude,integration,perftest,sdktool"

# SDK's Core and client packages that are compatable with Go 1.9+.
SDK_CORE_PKGS=./aws/... ./internal/...
Expand All @@ -20,7 +21,6 @@ SDK_COMPA_PKGS=${SDK_CORE_PKGS} ${SDK_CLIENT_PKGS}
SDK_EXAMPLES_PKGS=
SDK_ALL_PKGS=${SDK_COMPA_PKGS} ${SDK_EXAMPLES_PKGS}


all: generate unit

###################
Expand All @@ -31,9 +31,10 @@ generate: smithy-generate gen-external-asserts
smithy-generate:
cd codegen && ./gradlew clean build -Plog-tests

gen-external-asserts:
@echo "Generating SDK external package implementor assertions"
go generate ./aws/external

gen-config-asserts:
@echo "Generating SDK config package implementor assertions"
cd config && go generate

gen-repo-mod-replace:
@echo "Generating go.mod replace for repo modules"
Expand All @@ -43,19 +44,19 @@ gen-repo-mod-replace:
# Unit/CI Testing #
###################
build:
go build -o /dev/null -tags ${ALL_TAGS} ${SDK_ALL_PKGS}
go test -tags ${ALL_TAGS} -run NONE ${SDK_ALL_PKGS}

unit: verify build test-protocols test-services test-ec2imds test-credentials test-config
@echo "go test SDK and vendor packages"
@go test -tags ${UNIT_TEST_TAGS} ${SDK_ALL_PKGS}

unit-with-race-cover: verify build
unit-with-race-cover: verify build test-protocols test-services test-config test-credentials
@echo "go test SDK and vendor packages"
@go test -tags ${UNIT_TEST_TAGS} -race -cpu=1,2,4 ${SDK_ALL_PKGS}

ci-test: generate unit-with-race-cover ci-test-generate-validate test-protocols test-services
ci-test: generate unit-with-race-cover ci-test-generate-validate

ci-test-no-generate: unit-with-race-cover test-protocols test-services
ci-test-no-generate: unit-with-race-cover

ci-test-generate-validate:
@echo "CI test validate no generated code changes"
Expand All @@ -66,11 +67,16 @@ ci-test-generate-validate:
if [ "$$gitstatus" != "" ] && [ "$$gitstatus" != "skipping validation" ]; then echo "$$gitstatus"; exit 1; fi
git update-index --no-assume-unchanged go.mod go.sum

test-all:
./test_submodules.sh `pwd` "go test -tags ${ALL_TAGS} -count 1 ./..."


test-protocols:
# TODO replace with module walker.
./test_submodules.sh `pwd`/internal/protocoltest "go test -count 1 -run NONE ./..."

test-services:
# TODO replace with module walker.
./test_submodules.sh `pwd`/service "go test -count 1 -tags "integration,ec2env" -run NONE ./..."

test-ec2imds:
Expand All @@ -82,6 +88,7 @@ test-credentials:
test-config:
cd config && go test -run NONE -tags "integration,ec2env" ./... && go test -count 1 ./...


mod_replace_local:
./mod_replace_local_submodules.sh `pwd` `pwd` `pwd`/../smithy-go

Expand Down
4 changes: 2 additions & 2 deletions config/codegen/main.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/resolve_processcreds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func TestProcessCredentialsProvider_FromCredentialsWithProfile(t *testing.T) {
restoreEnv := awstesting.StashEnv()
defer awstesting.PopEnv(restoreEnv)

os.Setenv("AWS_PROFILE", "non_expire")
os.Setenv("AWS_PROFILE", "not_expire")
setupEnvForProcesscredsCredentialsFile()

config, err := LoadDefaultConfig(WithRegion("region"))
Expand Down
2 changes: 2 additions & 0 deletions config/shared_config_other_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !windows

package config

import (
Expand Down
2 changes: 1 addition & 1 deletion config/shared_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func TestLoadSharedConfigFromFile(t *testing.T) {
10: {
Profile: "does_not_exist",
Err: SharedConfigProfileNotExistError{
Filename: "testdata/shared_config",
Filename: filepath.Join("testdata", "shared_config"),
Profile: "does_not_exist",
Err: nil,
},
Expand Down
2 changes: 2 additions & 0 deletions config/shared_config_windows_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build windows

package config

import (
Expand Down
2 changes: 1 addition & 1 deletion config/testdata/proc_creds_config_win.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[default]
credential_process = type .\testdata\proc_creds_expired.json

[profile non_expire]
[profile not_expire]
credential_process = type .\testdata\proc_creds_not_expire.json

[profile not_alone]
Expand Down
2 changes: 1 addition & 1 deletion config/testdata/proc_creds_credentials.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[default]
credential_process = cat ./testdata/proc_creds_expired.json

[non_expire]
[not_expire]
credential_process = cat ./testdata/proc_creds_not_expire.json

[not_alone]
Expand Down
2 changes: 1 addition & 1 deletion config/testdata/proc_creds_credentials_win.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[default]
credential_process = type .\testdata\proc_creds_expired.json

[non_expire]
[not_expire]
credential_process = type .\testdata\proc_creds_not_expire.json

[not_alone]
Expand Down
14 changes: 4 additions & 10 deletions credentials/processcreds/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
Expand Down Expand Up @@ -290,16 +289,11 @@ func TestProviderForceExpire(t *testing.T) {
}

func TestProviderAltConstruct(t *testing.T) {
// constructing with exec.Cmd instead of string
cmdBuilder := NewCommandBuilderFunc(func(ctx context.Context) (*exec.Cmd, error) {
cmd := exec.CommandContext(ctx,
getOSCat(),
cmdBuilder := DefaultNewCommandBuilder{Args: []string{
fmt.Sprintf("%s %s", getOSCat(),
filepath.Join("testdata", "static.json"),
)
cmd.Env = os.Environ()

return cmd, nil
})
),
}}

provider := NewProviderCommand(cmdBuilder, func(options *Options) {
options.Timeout = time.Duration(1) * time.Second
Expand Down
2 changes: 2 additions & 0 deletions internal/shareddefaults/shared_config_other_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !windows

package shareddefaults_test

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/shareddefaults/shared_config_windows_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build windows

package shareddefaults_test

import (
Expand Down

0 comments on commit 477d531

Please sign in to comment.