Skip to content

Add CI check that auto-generated code is up to date #1828

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

Merged
merged 30 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
db9fa33
Add CI check that auto-generated code is up to date
dhrubabasu Aug 9, 2023
d0fde64
fix wording
dhrubabasu Aug 9, 2023
1f83b18
nit
dhrubabasu Aug 9, 2023
60bfa39
wip
dhrubabasu Aug 9, 2023
0e51d5a
wi
dhrubabasu Aug 9, 2023
fe04e24
wip
dhrubabasu Aug 9, 2023
073aa38
fix script location
dhrubabasu Aug 9, 2023
176f800
executable
dhrubabasu Aug 9, 2023
ee8babd
nit
dhrubabasu Aug 9, 2023
84884e0
make some changes that should fail
dhrubabasu Aug 9, 2023
7e06cac
Revert "make some changes that should fail"
dhrubabasu Aug 9, 2023
346935b
fix versions
dhrubabasu Aug 9, 2023
4be103b
super nits
dhrubabasu Aug 9, 2023
37fc2ca
less jank
dhrubabasu Aug 9, 2023
f9d2636
changes that should fail
dhrubabasu Aug 9, 2023
c14a4c5
Revert "changes that should fail"
dhrubabasu Aug 9, 2023
0ed344f
testing
hexfusion Aug 16, 2023
61136c9
remove explicit go intall
hexfusion Aug 16, 2023
f1ce4ec
Merge branch 'dev' into gh-1553
dhrubabasu Aug 16, 2023
adb8e95
changes that should fail
dhrubabasu Aug 16, 2023
3a2628a
nit
dhrubabasu Aug 16, 2023
edb55f9
Revert "changes that should fail"
dhrubabasu Aug 16, 2023
5e62ab9
Merge branch 'dev' into gh-1553
dhrubabasu Aug 16, 2023
406dc6c
last nit
dhrubabasu Aug 16, 2023
880f971
nit
dhrubabasu Aug 16, 2023
635349e
add boilerplate
dhrubabasu Aug 16, 2023
7c68479
Merge branch 'dev' into gh-1553
dhrubabasu Aug 16, 2023
dff797c
update script
dhrubabasu Aug 16, 2023
755bd17
revert
dhrubabasu Aug 16, 2023
cd6b01c
Merge branch 'dev' into gh-1553
StephenButtolph Aug 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/auto-generated-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Auto-Generated Code Checker
on:
push:
tags:
- "*"
branches:
- master
- dev
pull_request:

jobs:
protobuf_codegen:
name: Protobuf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
check-latest: true
- uses: bufbuild/buf-setup-action@v1.23.1
- shell: bash
run: scripts/protobuf_codegen.sh
- shell: bash
run: .github/workflows/check-clean-branch.sh
mock_gen:
name: Mocks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
check-latest: true
- shell: bash
run: scripts/mock.gen.sh
- shell: bash
run: .github/workflows/check-clean-branch.sh
9 changes: 9 additions & 0 deletions .github/workflows/check-clean-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# Exits if any uncommitted changes are found.

set -o errexit
set -o nounset
set -o pipefail

git update-index --really-refresh >> /dev/null
git diff-index --quiet HEAD
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ To regenerate the protobuf go code, run `scripts/protobuf_codegen.sh` from the r

This should only be necessary when upgrading protobuf versions or modifying .proto definition files.

To use this script, you must have [buf](https://docs.buf.build/installation) (v1.23.1), protoc-gen-go (v1.28.0) and protoc-gen-go-grpc (v1.2.0) installed.
To use this script, you must have [buf](https://docs.buf.build/installation) (v1.23.1), protoc-gen-go (v1.30.0) and protoc-gen-go-grpc (v1.3.0) installed.

To install the buf dependencies:

```sh
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.0
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2.0
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30.0
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
```

If you have not already, you may need to add `$GOPATH/bin` to your `$PATH`:
Expand Down
4 changes: 2 additions & 2 deletions proto/Dockerfile.buf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY --from=builder /usr/local/bin/buf /usr/local/bin/

# any version changes here should also be bumped in scripts/protobuf_codegen.sh
RUN \
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2.0
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30.0 && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0

ENV PATH="${PATH}:/root/go/bin/"