Skip to content

Commit c318ecf

Browse files
benthecarmanclaude
andcommitted
Add CI job to verify generated protobuf files are up to date
Runs proto generation and checks for uncommitted diffs whenever files in ldk-server-protos/ are changed. Now we will know if the generated files were correctly updated when we edit the protobufs. This found a formatting issue in the types.rs for me. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e3f6b83 commit c318ecf

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

.github/workflows/check-protos.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Check Generated Protos
2+
3+
on:
4+
push:
5+
paths:
6+
- 'ldk-server-protos/**'
7+
pull_request:
8+
paths:
9+
- 'ldk-server-protos/**'
10+
workflow_dispatch:
11+
12+
jobs:
13+
check-protos:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout source code
17+
uses: actions/checkout@v3
18+
- name: Install Rust stable toolchain
19+
run: |
20+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain stable
21+
- name: Install protoc
22+
run: sudo apt-get install -y protobuf-compiler
23+
- name: Generate protos
24+
run: RUSTFLAGS="--cfg genproto" cargo build -p ldk-server-protos
25+
- name: Format generated code
26+
run: rustup component add rustfmt && cargo fmt --all
27+
- name: Check for differences
28+
run: |
29+
if ! git diff --exit-code; then
30+
echo "error: Generated protobuf files are out of date. Run: RUSTFLAGS=\"--cfg genproto\" cargo build -p ldk-server-protos && cargo fmt --all"
31+
exit 1
32+
fi

ldk-server-protos/src/types.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,6 @@ impl PaymentStatus {
10811081
}
10821082
}
10831083
}
1084-
10851084
/// Indicates whether the balance is derived from a cooperative close, a force-close (for holder or counterparty),
10861085
/// or whether it is for an HTLC.
10871086
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
@@ -1098,7 +1097,6 @@ pub enum BalanceSource {
10981097
/// This balance is the result of an HTLC.
10991098
Htlc = 3,
11001099
}
1101-
11021100
impl BalanceSource {
11031101
/// String value of the enum field names used in the ProtoBuf definition.
11041102
///

0 commit comments

Comments
 (0)