Skip to content

ci: introduce the deff check for rust #5356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- CFG: "make-EXPERIMENTAL-check"
TEST_CMD: "make check-source check-units installcheck check-gen-updated"
EXPERIMENTAL_FEATURES: 1
VALGRIND: 1
steps:
- name: Checkout
uses: actions/[email protected]
Expand Down Expand Up @@ -97,6 +98,33 @@ jobs:
./configure
make check-doc

check-rust:
name: Check Rust file diff
runs-on: ubuntu-20.04
env:
DEVELOPER: 1
VALGRIND: 0
EXPERIMENTAL_FEATURES: 0
COMPAT: 1
steps:
- name: Checkout
uses: actions/[email protected]

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: bash -x .github/scripts/setup.sh

- name: Check Rust diff file
run: |
pip install mako
./configure
make check-rust


proto-test:
name: Protocol Test Config
runs-on: ubuntu-20.04
Expand Down
3 changes: 2 additions & 1 deletion .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,8 @@
"ListPeers.peers[].features": 6,
"ListPeers.peers[].id": 1,
"ListPeers.peers[].log[]": 3,
"ListPeers.peers[].netaddr[]": 5
"ListPeers.peers[].netaddr[]": 5,
"ListPeers.peers[].remote_addr": 7
},
"ListpeersPeersChannels": {
"ListPeers.peers[].channels[].alias": 50,
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,9 @@ check-python-flake8:
check-pytest-pyln-proto:
PATH=$(PYLN_PATH) PYTHONPATH=$(MY_CHECK_PYTHONPATH) $(PYTEST) contrib/pyln-proto/tests/

check-rust:
git diff --exit-code .msggen.json || (echo "diff in rust file, need to be updated by enabling rust"; exit 1)

check-includes: check-src-includes check-hdr-includes
@tools/check-includes.sh

Expand Down
1 change: 1 addition & 0 deletions cln-grpc/proto/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ message ListpeersPeers {
repeated ListpeersPeersLog log = 3;
repeated ListpeersPeersChannels channels = 4;
repeated string netaddr = 5;
optional string remote_addr = 7;
optional bytes features = 6;
}

Expand Down
1 change: 1 addition & 0 deletions cln-grpc/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ impl From<&responses::ListpeersPeers> for pb::ListpeersPeers {
log: c.log.as_ref().map(|arr| arr.iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
channels: c.channels.iter().map(|i| i.into()).collect(), // Rule #3 for type ListpeersPeersChannels
netaddr: c.netaddr.as_ref().map(|arr| arr.iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
remote_addr: c.remote_addr.clone(), // Rule #2 for type string?
features: c.features.as_ref().map(|v| hex::decode(&v).unwrap()), // Rule #2 for type hex?
}
}
Expand Down
2 changes: 2 additions & 0 deletions cln-rpc/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,8 @@ pub mod responses {
pub channels: Vec<ListpeersPeersChannels>,
#[serde(alias = "netaddr", skip_serializing_if = "Option::is_none")]
pub netaddr: Option<Vec<String>>,
#[serde(alias = "remote_addr", skip_serializing_if = "Option::is_none")]
pub remote_addr: Option<String>,
#[serde(alias = "features", skip_serializing_if = "Option::is_none")]
pub features: Option<String>,
}
Expand Down