-
Notifications
You must be signed in to change notification settings - Fork 43
Integrate go lint unified CI #313
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
Conversation
Integrate the very basic unified CI process for bare minimum linting of Go files.
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #313 +/- ##
==========================================
- Coverage 57.36% 57.26% -0.10%
==========================================
Files 257 257
Lines 34597 34597
==========================================
- Hits 19847 19813 -34
- Misses 13164 13198 +34
Partials 1586 1586
🚀 New features to boost your workflow:
|
| uint64 nonce = 2; | ||
| // buf:lint:ignore FIELD_LOWER_SNAKE_CASE We have caught this late; keeping to avoid breaking changes. | ||
| string txHash = 3; | ||
| // buf:lint:ignore FIELD_LOWER_SNAKE_CASE We have caught this late; keeping to avoid breaking changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These have slipped through in the past and not worth the refactor, since I believe they will result in breaking API changes during JSON serialisation. Hence the ignore comment.
| @@ -0,0 +1,3 @@ | |||
| package sei_tendermint | |||
|
|
|||
| //go:generate ./scripts/proto-gen.sh | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nice thing about this is that we now can generate all the go related resources with go generate ./... which is more convenient for both DX and CI setup.
| ifeq (,$(shell which protoc-gen-gogofaster)) | ||
| $(error "gogofaster plugin for protoc is required. Run 'go install github.com/gogo/protobuf/protoc-gen-gogofaster@latest' to install") | ||
| endif | ||
| @go install github.com/gogo/protobuf/protoc-gen-gogofaster@v1.3.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified dependency checking here since go install is clever enough to not re-install it if it's already present. There is therefore little point in hassling the user. This way it just works.
| proto-format: check-proto-deps | ||
| @echo "Formatting Protobuf files" | ||
| @find . -name '*.proto' -path "./proto/*" -exec clang-format -i {} \; | ||
| @$(BUF) format -w |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropped clang-format entirely in favour of simply using buf; we are using it for generation and linting. Why not for formatting too. As an added bonus this is more IDE friendly since most IDEs use proto formatting by default for proto files.
| .PHONY: proto-check-breaking | ||
|
|
||
| proto-all: proto-gen proto-format proto-check-breaking | ||
| proto-all: proto-gen proto-format proto-lint proto-check-breaking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were missing proto-lint here; added.
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: bufbuild/buf-action@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buf ecosystem now comes with fancy GitHub actions, which is worth using instead of inventing our own.
# Conflicts: # proto/tendermint/blocksync/types.proto # proto/tendermint/types/canonical.pb.go # proto/tendermint/types/canonical.proto # proto/tendermint/types/types.pb.go # proto/tendermint/types/types.proto
Integrate the very basic unified CI process for bare minimum linting of Go files.
Note: changes here are mechanical only.