-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: repository tidiness checks on CI
Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com>
- Loading branch information
Showing
10 changed files
with
84 additions
and
9 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,26 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit -o nounset -o pipefail | ||
|
||
# First verify if the repository is clean. | ||
if ! git diff --exit-code; then | ||
>&2 echo "ERROR: The repository is not clean - please verify the changes and fix them." | ||
exit 1 | ||
fi | ||
|
||
# Then, run a series of commands that could produce changes to the source tree. | ||
# For each command, we check if the repository is still clean and proceed. | ||
commands=( | ||
"bazel run @go_sdk//:bin/go -- fmt \$(go list ./... | grep -v /bazel-/)" | ||
"bazel run @go_sdk//:bin/go -- mod tidy" | ||
"bazel run //:update_go_deps" | ||
"bazel run //:gazelle" | ||
) | ||
|
||
for cmd in "${commands[@]}"; do | ||
/bin/bash -c "${cmd}" | ||
if ! git diff --exit-code; then | ||
>&2 echo "ERROR: Please run '${cmd}' and commit the changes." | ||
exit 1 | ||
fi | ||
done |
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
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,38 @@ | ||
{ | ||
"composites": { | ||
"exclude_files": { | ||
"(third_party|vendor|external)/.*": "only run for first-party code" | ||
} | ||
}, | ||
"copylocks": { | ||
"exclude_files": { | ||
"(third_party|vendor|external)/.*": "only run for first-party code" | ||
} | ||
}, | ||
"nilness": { | ||
"exclude_files": { | ||
"(third_party|vendor|external)/.*": "only run for first-party code" | ||
} | ||
}, | ||
"shadow": { | ||
"exclude_files": { | ||
"(third_party|vendor|external)/.*": "only run for first-party code", | ||
"pkg/bazel/bazelisk.go": "copied third-party code" | ||
} | ||
}, | ||
"stdmethods": { | ||
"exclude_files": { | ||
"(third_party|vendor|external)/.*": "only run for first-party code" | ||
} | ||
}, | ||
"unreachable": { | ||
"exclude_files": { | ||
"(third_party|vendor|external)/.*": "only run for first-party code" | ||
} | ||
}, | ||
"unsafeptr": { | ||
"exclude_files": { | ||
"(third_party|vendor|external)/.*": "only run for first-party code" | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
//go:build dummy | ||
// +build dummy | ||
|
||
// This file exists to make the go tooling happy. This package is generated by | ||
// bazel. | ||
package proto |
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
//go:build dummy | ||
// +build dummy | ||
|
||
// This file exists to make the go tooling happy. This package is generated by | ||
// bazel. | ||
package proto |