feat: commit generated Go code, consume via go get instead of submodule
Add go.mod, buf.gen.yaml, and generated gen/kafkamgmt/v1 so consumers fetch this module directly via go get against the self-hosted Forgejo host, with no local buf/protoc plugin installation required. Add a codegen-check CI job to keep gen/ in sync with proto/.
This commit is contained in:
@@ -20,3 +20,26 @@ jobs:
|
||||
- name: buf breaking (against main)
|
||||
run: buf breaking --against '.git#branch=main'
|
||||
if: github.ref != 'refs/heads/main'
|
||||
|
||||
codegen-check:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: golang:1.25
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install buf and protoc plugins
|
||||
run: |
|
||||
go install github.com/bufbuild/buf/cmd/buf@latest
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest
|
||||
|
||||
- name: Regenerate and diff
|
||||
run: |
|
||||
export PATH="$PATH:$(go env GOPATH)/bin"
|
||||
buf generate
|
||||
git diff --exit-code -- gen || (echo "::error::gen/ is out of date — run buf generate and commit the result" && exit 1)
|
||||
|
||||
- name: go build
|
||||
run: go build ./...
|
||||
|
||||
Reference in New Issue
Block a user