-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
makefile: buf setup backport v0.34 (#8863)
Co-authored-by: Jasmina Malicevic <jasmina.dustinac@gmail.com>
- Loading branch information
1 parent
69da06e
commit 781018a
Showing
7 changed files
with
125 additions
and
87 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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Verify that generated code is up-to-date. | ||
# | ||
# Note that we run these checks regardless whether the input files have | ||
# changed, because generated code can change in response to toolchain updates | ||
# even if no files in the repository are modified. | ||
name: Check generated code | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
check-mocks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.18' | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: "Check generated mocks" | ||
run: | | ||
set -euo pipefail | ||
readonly MOCKERY=v2.30.17 # N.B. no leading "v" | ||
curl -sL "https://github.com/vektra/mockery/releases/download/v${MOCKERY}/mockery_${MOCKERY}_Linux_x86_64.tar.gz" | tar -C /usr/local/bin -xzf - | ||
make mockery 2>/dev/null | ||
if ! git diff --stat --exit-code ; then | ||
echo ">> ERROR:" | ||
echo ">>" | ||
echo ">> Generated mocks require update (either Mockery or source files may have changed)." | ||
echo ">> Ensure your tools are up-to-date, re-run 'make mockery' and update this PR." | ||
echo ">>" | ||
exit 1 | ||
fi | ||
check-proto: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.18' | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 # we need a .git directory to run git diff | ||
|
||
- name: "Check protobuf generated code" | ||
run: | | ||
set -euo pipefail | ||
# Install buf and gogo tools, so that differences that arise from | ||
# toolchain differences are also caught. | ||
readonly tools="$(mktemp -d)" | ||
export PATH="${PATH}:${tools}/bin" | ||
export GOBIN="${tools}/bin" | ||
go install github.com/bufbuild/buf/cmd/buf | ||
go install github.com/gogo/protobuf/protoc-gen-gogofaster@latest | ||
make proto-gen | ||
if ! git diff --stat --exit-code ; then | ||
echo ">> ERROR:" | ||
echo ">>" | ||
echo ">> Protobuf generated code requires update (either tools or .proto files may have changed)." | ||
echo ">> Ensure your tools are up-to-date, re-run 'make proto-gen' and update this PR." | ||
echo ">>" | ||
exit 1 | ||
fi |
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
name: Protobuf Lint | ||
on: | ||
pull_request: | ||
paths: | ||
- 'proto/**' | ||
push: | ||
paths: | ||
- 'proto/**' | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: bufbuild/buf-setup-action@v1.5.0 | ||
- uses: bufbuild/buf-lint-action@v1 | ||
with: | ||
input: '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
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,19 @@ | ||
#!/bin/sh | ||
# | ||
# Update the generated code for protocol buffers in the Tendermint repository. | ||
# This must be run from inside a Tendermint working directory. | ||
# | ||
set -euo pipefail | ||
|
||
# Work from the root of the repository. | ||
cd "$(git rev-parse --show-toplevel)" | ||
|
||
# Run inside Docker to install the correct versions of the required tools | ||
# without polluting the local system. | ||
docker run --rm -i -v "$PWD":/w --workdir=/w golang:1.18-alpine sh <<"EOF" | ||
apk add git make | ||
go install github.com/bufbuild/buf/cmd/buf | ||
go install github.com/gogo/protobuf/protoc-gen-gogofaster@latest | ||
make proto-gen | ||
EOF |
This file was deleted.
Oops, something went wrong.