Skip to content

Commit

Permalink
[experimental] test results with a go.work file
Browse files Browse the repository at this point in the history
  • Loading branch information
Madrigal committed Nov 11, 2024
1 parent 5a89801 commit 20d4827
Show file tree
Hide file tree
Showing 3 changed files with 460 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: go install golang.org/x/lint/golint@latest

- name: Test
run: make ci-test-no-generate -j 4
run: make experimental-module

x86-tests:
name: Unix x86 SDK tests
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
run: go install golang.org/x/lint/golint@latest

- name: Test
run: make unit -j 4
run: make experimental-module-no-race

windows-tests:
name: Windows SDK Tests
Expand All @@ -93,4 +93,4 @@ jobs:
run: ./ci-find-smithy-go.sh

- name: Test
run: make vet build unit-test -j 4
run: make experimental-module-no-race
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,24 @@ unit-race-modules-%:
"go test ${BUILD_TAGS} ${RUN_NONE} ./..." \
"go test -timeout=2m ${UNIT_TEST_TAGS} -race -cpu=1 ./..."

# EXPERIMENT will explore more if the results are good
# Basically instead of invoking "go test" n times per module (we have around 400 of them)
# call "go test" will all modules as arguments. This however is not as straightforward since
# this is a monorepo, so we have multiple modules that are not visible from root.
# Doing this needs a `go.work` file that there's a hot debate on whether it should be included into VCS or not
# So, before exploring this, ensure that the benefits are there
experimental-module:
go list -f '{{.Dir}}/...' -m | xargs go vet ${BUILD_TAGS} --all && \
go list -f '{{.Dir}}/...' -m | xargs go test ${BUILD_TAGS} ${RUN_NONE} && \
go list -f '{{.Dir}}/...' -m | xargs go test -timeout=2m ${UNIT_TEST_TAGS} -race -cpu=1

# same as regular but no race test
experimental-module-no-race:
go list -f '{{.Dir}}/...' -m | xargs go vet ${BUILD_TAGS} --all && \
go list -f '{{.Dir}}/...' -m | xargs go test ${BUILD_TAGS} ${RUN_NONE} && \
go list -f '{{.Dir}}/...' -m | xargs go test -timeout=2m ${UNIT_TEST_TAGS} -cpu=1


unit-modules-%:
@# unit command that uses the pattern to define the root path that the
@# module testing will start from. Strips off the "unit-modules-" and
Expand Down Expand Up @@ -510,6 +528,10 @@ vet-modules-%:
&& go run . -p $(subst _,/,$(subst vet-modules-,,$@)) ${EACHMODULE_FLAGS} \
"go vet ${BUILD_TAGS} --all ./..."

experimental-vet:
go list -f '{{.Dir}}/...' -m | xargs go vet ${BUILD_TAGS} --all


sdkv1check:
@echo "Checking for usage of AWS SDK for Go v1"
@sdkv1usage=`go list -test -f '''{{ if not .Standard }}{{ range $$_, $$name := .Imports }} * {{ $$.ImportPath }} -> {{ $$name }}{{ print "\n" }}{{ end }}{{ range $$_, $$name := .TestImports }} *: {{ $$.ImportPath }} -> {{ $$name }}{{ print "\n" }}{{ end }}{{ end}}''' ./... | sort -u | grep '''/aws-sdk-go/'''`; \
Expand Down
Loading

0 comments on commit 20d4827

Please sign in to comment.