Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ocu-472] basic smithyctl boilerplate #705

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ protos=$(shell find . -not -path './vendor/*' -name '*.proto')
go_protos=$(protos:.proto=.pb.go)
latest_tag=$(shell git tag --list --sort="-version:refname" | head -n 1)
commits_since_latest_tag=$(shell git log --oneline $(latest_tag)..HEAD | wc -l)
GO_TEST_PACKAGES=$(shell go list ./... | grep -v /vendor/)
GO_TEST_PACKAGES=$(shell find . -name 'go.mod' -exec dirname {} \; | sort -u)
VENDOR_DIRS=$(shell find . -type d -name "vendor")
NOT_VENDOR_PATHS := $(shell echo $(VENDOR_DIRS) | awk '{for (i=1; i<=NF; i++) print "-not -path \""$$i"/*\""}' | tr '\n' ' ')
EXCLUDE_VENDOR_PATHS := $(shell echo $(VENDOR_DIRS) | awk '{for (i=1; i<=NF; i++) print "--exclude-path \""$$i"\""}' | tr '\n' ' ')
GO_TEST_OUT_DIR_PATH=$(shell pwd)/tests/output

# Deployment vars
# The following variables are used to define the deployment environment
Expand Down Expand Up @@ -133,7 +134,16 @@ install-go-test-tools:

go-tests:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now covers EVERY possible go test file in the repo. Before there were some issues due to multiple go.mods being present and test runs being hidden on CI.

Now this enable for a sane framework

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be simplified to find . -name go.mod -execdir go test ./... \;

you shouldn't be looking for _test.go files but for go.mod files

@mkdir -p tests/output
@gotestsum --junitfile tests/output/unit-tests.xml -- -race -coverprofile tests/output/cover.out $(GO_TEST_PACKAGES)
@for package in $(GO_TEST_PACKAGES); do \
if [ "$$package" = "./components/producers/golang-nancy/examples" ]; then \
continue; \
fi; \
LISTED_PACKAGES=./...; \
if [ "$$package" = "." ]; then \
LISTED_PACKAGES=$$(go list ./... | grep -v "^$$package$$"); \
fi; \
(cd $$package && gotestsum --junitfile $(GO_TEST_OUT_DIR_PATH)/unit-tests.xml -- -race -coverprofile $(GO_TEST_OUT_DIR_PATH)/cover.out $$LISTED_PACKAGES) || exit 1; \
done

go-cover: go-tests
@go tool cover -html=tests/output/cover.out -o=tests/output/cover.html && open tests/output/cover.html
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
cloud.google.com/go/bigquery v1.57.1
github.com/CycloneDX/cyclonedx-go v0.9.0
github.com/DependencyTrack/client-go v0.13.0
github.com/abice/go-enum v0.6.0
github.com/andygrunwald/go-jira v1.16.0
github.com/avast/retry-go/v4 v4.3.3
github.com/aws/aws-sdk-go v1.17.7
Expand Down Expand Up @@ -60,7 +61,6 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/abice/go-enum v0.6.0 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/apache/arrow/go/v12 v12.0.0 // indirect
Expand Down

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

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

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

Loading
Loading