Skip to content

feat(proto)!: remove optional fields in protos #2707

feat(proto)!: remove optional fields in protos

feat(proto)!: remove optional fields in protos #2707

name: Protobuf
on: pull_request
jobs:
lint:
name: Lint protobuf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bufbuild/buf-setup-action@v1
with:
buf_api_token: ${{ secrets.BUF_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
input: 'proto'
- uses: bufbuild/buf-lint-action@v1
with:
input: 'proto'
buf_token: ${{ secrets.BUF_TOKEN }}
- name: Check for module path changes
shell: bash
run: |
cd proto/penumbra
buf mod update
s="$(git status --porcelain)"
if [[ -n "$s" ]]; then
echo "ERROR: run 'buf mod update' to synchronize buf.lock"
echo "$s"
exit 1
else
echo "OK: no changes required to buf.lock"
fi
- name: Check for breaking changes
uses: bufbuild/buf-breaking-action@v1
with:
input: 'proto'
# The 'main' branch of the GitHub repository that defines the module.
against: 'https://github.com/${GITHUB_REPOSITORY}.git#branch=main,subdir=proto'
protobuf-fresh:
name: Compile protobuf specs to rust code
runs-on: buildjet-16vcpu-ubuntu-2004
# runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v2
with:
lfs: true
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: false
- uses: bufbuild/buf-setup-action@v1
with:
buf_api_token: ${{ secrets.BUF_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
input: 'proto'
- name: Install protobuf compiler
shell: bash
run: |
cd /tmp
curl -sSfL -O https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip
unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d $HOME/.local
env:
PROTOC_VERSION: "23.3"
# We exclude the proto_descriptor file from diff inspection, since
# different versions of `protoc` can generate non-substantive changes,
# causing noisy CI failures.
- name: Compile protobuf specs into rust src files
shell: bash
run: |
./deployments/scripts/protobuf-codegen
git checkout crates/proto/src/gen/proto_descriptor.bin
s="$(git status --porcelain)"
if [[ -n "$s" ]]; then
echo "ERROR: protobuf files must be regenerated and committed."
echo "Run this command locally: ./deployments/scripts/protobuf-codegen"
echo "These are the files that reported differences:"
echo "$s"
exit 1
else
echo "OK: no changes required to protobuf specs"
fi