UIP-6: App Version Safeguard #5853
Workflow file for this run
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
name: Protobuf | |
on: | |
# Exclude feature branches, only run if the PR is targeting main. | |
pull_request: | |
branches: | |
- "main" | |
jobs: | |
# Ensure there are no breaking changes to the protocol specs, | |
# by running the "buf lint" action against the changes in this PR. | |
lint: | |
name: Lint protobuf | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: bufbuild/buf-setup-action@v1 | |
with: | |
buf_api_token: ${{ secrets.BUF_TOKEN }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- 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 dep update | |
s="$(git status --porcelain)" | |
if [[ -n "$s" ]]; then | |
echo "ERROR: run 'buf dep 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" | |
# Run our bespoke tooling for codegen, consuming the protocol buffer definitions | |
# and emitting generated code. Afterward, there should be no uncommitted changes. | |
protobuf-fresh: | |
name: Compile protobuf specs to rust code | |
runs-on: buildjet-16vcpu-ubuntu-2204 | |
steps: | |
- name: Checkout the source code | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- 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: "24.4" | |
# 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 | |
# https://github.com/penumbra-zone/penumbra/issues/3038#issuecomment-1722534133 | |
git checkout crates/proto/src/gen/proto_descriptor.bin.no_lfs | |
git checkout crates/cnidarium/src/gen/proto_descriptor.bin.no_lfs | |
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 |