-
Notifications
You must be signed in to change notification settings - Fork 296
91 lines (84 loc) · 3.24 KB
/
buf-pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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