1 name: Continuous Integration Checks
3 on: [push, pull_request]
10 # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
11 # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
12 distro: [ "debian:bookworm", "fedora:39" ]
13 runs-on: ubuntu-latest
14 container: ${{ matrix.distro }}
18 - name: Install native Rust toolchain, Valgrind, and build utilitis
19 if: "matrix.distro == 'debian:bookworm'"
22 apt-get -y dist-upgrade
23 apt-get -y install cargo libstd-rust-dev-wasm32 wasi-libc valgrind lld git g++ clang wget
24 - name: Install native Rust toolchain, Valgrind, and build utilitis
25 if: "matrix.distro == 'fedora:39'"
27 dnf -y install cargo rust-std-static-wasm32-wasi valgrind lld git g++ clang wget which diffutils
28 - name: Checkout source code
29 uses: actions/checkout@v2
32 - name: Sanity test bindings against Cargo.toml RL
33 working-directory: lightning-c-bindings
35 # Note that the version tags aren't checked into git
37 RUSTFLAGS="--cfg=c_bindings" cargo check --features std
38 - name: Install cbindgen
40 git clone https://github.com/eqrion/cbindgen
43 cargo update -p indexmap --precise "1.6.2" --verbose
44 cargo install --locked --path .
45 - name: Checkout Rust-Lightning git
47 git clone https://github.com/rust-bitcoin/rust-lightning
49 git checkout 0.0.123-bindings
50 - name: Fix Github Actions to not be broken
51 run: git config --global --add safe.directory /__w/ldk-c-bindings/ldk-c-bindings
52 - name: Pin proc-macro and quote to meet MSRV
55 cargo update -p quote --precise "1.0.30" --verbose
56 cargo update -p proc-macro2 --precise "1.0.65" --verbose
57 - name: Rebuild bindings without std, and check the sample app builds + links
58 run: ./genbindings.sh ./rust-lightning false
59 - name: Rebuild bindings, and check the sample app builds + links
60 run: ./genbindings.sh ./rust-lightning true
61 - name: Check that the latest bindings are in git
63 git checkout lightning-c-bindings/Cargo.toml # genbindings edits this to update the path
64 if [ "$(git diff)" != "" ]; then
65 # cbindgen's bindings output order can be FS-dependant, so check that the lines are all the same:
66 mv lightning-c-bindings/include/lightning.h lightning-c-bindings/include/lightning.h.new
67 git checkout lightning-c-bindings/include/lightning.h
68 cat lightning-c-bindings/include/lightning.h | grep -v "Generated with cbindgen:[0-9\.]*" | sort > lightning-c-bindings/include/lightning.h.sorted
69 cat lightning-c-bindings/include/lightning.h.new | grep -v "Generated with cbindgen:[0-9\.]*" | sort > lightning-c-bindings/include/lightning.h.new.sorted
70 diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted
71 [ "$(diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted)" != "" ] && exit 2
76 runs-on: ubuntu-latest
77 # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
78 # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
79 container: debian:bookworm
83 - name: Install native Rust toolchain, Valgrind, and build utilitis
86 apt-get -y dist-upgrade
87 apt-get -y install cargo libstd-rust-dev-wasm32 valgrind lld git g++ clang wget rust-src
88 - name: Checkout source code
89 uses: actions/checkout@v2
92 - name: Sanity test bindings against Cargo.toml RL
93 working-directory: lightning-c-bindings
95 # Note that the version tags aren't checked into git
97 RUSTFLAGS="--cfg=c_bindings" cargo check --features std
98 - name: Install cbindgen
100 git clone https://github.com/eqrion/cbindgen
103 cargo update -p indexmap --precise "1.6.2" --verbose
104 cargo install --locked --path .
105 - name: Checkout Rust-Lightning git
107 git clone https://github.com/rust-bitcoin/rust-lightning
109 git checkout 0.0.123-bindings
110 - name: Fix Github Actions to not be broken
111 run: git config --global --add safe.directory /__w/ldk-c-bindings/ldk-c-bindings
112 - name: Fetch MacOS SDK
114 wget https://bitcoincore.org/depends-sources/sdks/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
115 tar xvvf Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
116 - name: Rebuild bindings, and check the sample app builds + links
118 # rust-src doesn't distribute the rustlib Cargo.lock, but an empty
119 # file seems to suffice to make `-Zbuild-std` happy.
120 touch /usr/lib/rustlib/src/rust/Cargo.lock
121 MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers" ./genbindings.sh ./rust-lightning true
130 runs-on: ${{ matrix.platform }}
134 - name: Install other Rust platforms
135 run: rustup target install aarch64-apple-darwin
136 - name: Fetch upstream LLVM/clang snapshot
138 wget -O clang+llvm-15.0.3-x86_64-apple-darwin.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.3/clang+llvm-15.0.3-x86_64-apple-darwin.tar.xz
139 if [ "$(shasum -a 256 clang+llvm-15.0.3-x86_64-apple-darwin.tar.xz | awk '{ print $1 }')" != "ac668586b2b3d068f1e43520a3ef0b1592e5dc3eff1a4a4b772e29803b428a69" ]; then
143 - name: Unpack upstream LLVM+clang and use it by default
145 tar xvvf clang+llvm-15.0.3-x86_64-apple-darwin.tar.xz
146 - name: Checkout source code
147 uses: actions/checkout@v2
150 - name: Install cbindgen
151 run: cargo install cbindgen
152 - name: Checkout Rust-Lightning git
154 git clone https://github.com/rust-bitcoin/rust-lightning
156 git checkout 0.0.123-bindings
157 - name: Rebuild bindings using Apple clang, and check the sample app builds + links
158 run: ./genbindings.sh ./rust-lightning true
159 - name: Rebuild bindings using upstream clang, and check the sample app builds + links
161 export PATH=`pwd`/clang+llvm-15.0.3-x86_64-apple-darwin/bin:$PATH
162 CC=clang ./genbindings.sh ./rust-lightning true