Skip to content

Commit 9f0fa04

Browse files
committed
Add CI run for bindings generation (though we'll allow it to fail)
1 parent af9d1cf commit 9f0fa04

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ jobs:
1717
include:
1818
- toolchain: stable
1919
build-net-tokio: true
20+
build-bindings: true
2021
- toolchain: beta
2122
build-net-tokio: true
23+
build-bindings: true
2224
- toolchain: 1.39.0
2325
build-net-tokio: true
26+
build-bindings: true
2427
coverage: true
28+
- toolchain: 1.34.2
29+
build-bindings: true
2530
runs-on: ubuntu-latest
2631
steps:
2732
- name: Checkout source code
@@ -38,6 +43,9 @@ jobs:
3843
- name: Build on Rust ${{ matrix.toolchain }}
3944
if: "! matrix.build-net-tokio"
4045
run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always -p lightning
46+
- name: Build bindings on Rust ${{ matrix.toolchain }}
47+
if: matrix.build-bindings
48+
run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always -p lightning-c-bindings
4149
- name: Test on Rust ${{ matrix.toolchain }} with net-tokio
4250
if: matrix.build-net-tokio
4351
run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
@@ -98,3 +106,43 @@ jobs:
98106
run: cd fuzz && cargo test --verbose --color always
99107
- name: Run fuzzers
100108
run: cd fuzz && ./ci-fuzz.sh
109+
110+
check_bindings:
111+
runs-on: ubuntu-latest
112+
# Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
113+
# This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
114+
container: debian:testing
115+
env:
116+
TOOLCHAIN: stable
117+
steps:
118+
- name: Install native Rust toolchain, Valgrind, and build utilitis
119+
run: |
120+
apt-get update
121+
apt-get -y dist-upgrade
122+
apt-get -y install cargo valgrind lld git g++ clang
123+
- name: Checkout source code
124+
uses: actions/checkout@v2
125+
- name: Install cbindgen
126+
run: cargo install --force cbindgen
127+
- name: Rebuild bindings, and check the sample app builds + links
128+
run: ./genbindings.sh
129+
- name: Check that the latest bindings are in git
130+
run: |
131+
if [ "$(git diff)" != "" ]; then
132+
# cbindgen's bindings output order can be FS-dependant, so check that the lines are all the same:
133+
mv lightning-c-bindings/include/lightning.h lightning-c-bindings/include/lightning.h.new
134+
git checkout lightning-c-bindings/include/lightning.h
135+
cat lightning-c-bindings/include/lightning.h | sort > lightning-c-bindings/include/lightning.h.sorted
136+
cat lightning-c-bindings/include/lightning.h.new | sort > lightning-c-bindings/include/lightning.h.new.sorted
137+
diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted
138+
#
139+
mv lightning-c-bindings/include/lightningpp.hpp lightning-c-bindings/include/lightningpp.hpp.new
140+
git checkout lightning-c-bindings/include/lightningpp.hpp
141+
cat lightning-c-bindings/include/lightningpp.hpp | sort > lightning-c-bindings/include/lightningpp.hpp.sorted
142+
cat lightning-c-bindings/include/lightningpp.hpp.new | sort > lightning-c-bindings/include/lightningpp.hpp.new.sorted
143+
diff lightning-c-bindings/include/lightningpp.hpp.sorted lightning-c-bindings/include/lightningpp.hpp.new.sorted
144+
#
145+
[ "$(diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted)" != "" ] && exit 2
146+
[ "$(diff lightning-c-bindings/include/lightningpp.hpp.sorted lightning-c-bindings/include/lightningpp.hpp.new.sorted)" != "" ] && exit 3
147+
git diff --exit-code
148+
fi

0 commit comments

Comments
 (0)