-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
REPO_ROOT=$(git rev-parse --show-toplevel) | ||
cd "$REPO_ROOT" | ||
|
||
# Iterate through all subfolders with their own go.mod and run tests | ||
for dir in $(find . -name "go.mod" -not -path "./go.mod" -exec dirname {} \;); do | ||
echo "Running tests in $dir..." | ||
|
||
# Run tests normally in all other directories | ||
(cd "$dir" && go test ./... ) || any_test_failed=1 | ||
done | ||
|
||
# Check if any test failed and exit with a non-zero status | ||
if [ "$any_test_failed" -ne 0 ]; then | ||
echo "The tests did not pass. Please check the errors above." | ||
exit 1 | ||
fi | ||
|
||
echo "All tests passed successfully." |