-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add checkstyle check and fix script for go deps (#1491)
- Loading branch information
Showing
7 changed files
with
302 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,11 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.17.2" # Keep in sync with WORKSPACE | ||
|
||
- name: gofmt | ||
run: | | ||
gofmt -d . > gofmt-diff.txt || true | ||
|
@@ -25,18 +30,27 @@ jobs: | |
- name: buildifier | ||
run: | | ||
go get -u github.com/bazelbuild/buildtools/buildifier | ||
go install github.com/bazelbuild/buildtools/buildifier@3.4.0 | ||
"$(go env GOPATH)/bin/buildifier" -d -r . > buildifier-diff.txt || true | ||
echo "buildifier diff:" | ||
cat buildifier-diff.txt | ||
- name: gazelle | ||
# Keep Gazelle version in sync with WORKSPACE | ||
run: | | ||
go get github.com/bazelbuild/bazel-gazelle/cmd/gazelle | ||
go install github.com/bazelbuild/bazel-gazelle/cmd/gazelle@v0.23.0 | ||
"$(go env GOPATH)/bin/gazelle" -mode diff > gazelle-diff.txt || true | ||
echo "gazelle diff:" | ||
cat gazelle-diff.txt | ||
- name: go deps | ||
# Keep Gazelle version in sync with WORKSPACE | ||
run: | | ||
go install github.com/bazelbuild/bazel-gazelle/cmd/[email protected] | ||
GAZELLE_PATH="$(go env GOPATH)/bin/gazelle" tools/fix_go_deps.sh --diff &> go-deps-diff.txt || true | ||
echo "go deps diff:" | ||
cat go-deps-diff.txt | ||
- name: clang-format | ||
run: | | ||
git ls-files | grep '\.proto$' | xargs --no-run-if-empty -d'\n' clang-format -i --style=Google --dry-run &> clang-format-errors.txt || true | ||
|
@@ -58,18 +72,21 @@ jobs: | |
- name: Check | ||
run: | | ||
echo "===== gofmt diff =====" | ||
echo "===== gofmt diff (fix with ./buildfix.sh) =====" | ||
cat gofmt-diff.txt | ||
echo "===== buildifier diff =====" | ||
echo "===== buildifier diff (fix with ./buildfix.sh) =====" | ||
cat buildifier-diff.txt | ||
echo "===== gazelle diff =====" | ||
echo "===== gazelle diff (fix with ./buildfix.sh --gazelle) =====" | ||
cat gazelle-diff.txt | ||
echo "===== clang-format errors =====" | ||
echo "===== go deps diff (fix with ./buildfix.sh --go_deps) =====" | ||
cat go-deps-diff.txt | ||
echo "===== clang-format errors (fix with ./buildfix.sh) =====" | ||
cat clang-format-errors.txt | ||
echo "===== prettier errors =====" | ||
echo "===== prettier errors (fix with ./buildfix.sh) =====" | ||
cat prettier-errors.txt | ||
if [ -s gazelle-diff.txt ]; then exit 1; fi | ||
if [ -s go-deps-diff.txt ]; then exit 1; fi | ||
if [ -s gofmt-diff.txt ]; then exit 1; fi | ||
if [ -s buildifier-diff.txt ]; then exit 1; fi | ||
if [ -s clang-format-errors.txt ]; then exit 1; fi | ||
|
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
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
Oops, something went wrong.