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:bullseye", "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:bullseye'"
22 apt-get -y dist-upgrade
23 apt-get -y install cargo libstd-rust-dev-wasm32 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.118-bindings
51 if: "matrix.distro == 'debian:bullseye'"
53 # Pin memchr until we can remove it
55 cargo update -p memchr --precise "2.5.0" --verbose
56 - name: Fix Github Actions to not be broken
57 run: git config --global --add safe.directory /__w/ldk-c-bindings/ldk-c-bindings
58 - name: Pin proc-macro, quote and memchr to meet MSRV
61 cargo update -p quote --precise "1.0.30" --verbose
62 cargo update -p proc-macro2 --precise "1.0.65" --verbose
63 cd ../lightning-c-bindings
64 cargo update -p memchr --precise "2.5.0" --verbose
65 - name: Rebuild bindings without std, and check the sample app builds + links
66 run: ./genbindings.sh ./rust-lightning false
67 - name: Rebuild bindings, and check the sample app builds + links
68 run: ./genbindings.sh ./rust-lightning true
69 - name: Check that the latest bindings are in git
71 git checkout lightning-c-bindings/Cargo.toml # genbindings edits this to update the path
72 if [ "$(git diff)" != "" ]; then
73 # cbindgen's bindings output order can be FS-dependant, so check that the lines are all the same:
74 mv lightning-c-bindings/include/lightning.h lightning-c-bindings/include/lightning.h.new
75 git checkout lightning-c-bindings/include/lightning.h
76 cat lightning-c-bindings/include/lightning.h | grep -v "Generated with cbindgen:[0-9\.]*" | sort > lightning-c-bindings/include/lightning.h.sorted
77 cat lightning-c-bindings/include/lightning.h.new | grep -v "Generated with cbindgen:[0-9\.]*" | sort > lightning-c-bindings/include/lightning.h.new.sorted
78 diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted
79 [ "$(diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted)" != "" ] && exit 2
84 runs-on: ubuntu-latest
85 # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
86 # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
87 container: debian:bookworm
91 - name: Install native Rust toolchain, Valgrind, and build utilitis
94 apt-get -y dist-upgrade
95 apt-get -y install cargo libstd-rust-dev-wasm32 valgrind lld git g++ clang wget rust-src
96 - name: Checkout source code
97 uses: actions/checkout@v2
100 - name: Sanity test bindings against Cargo.toml RL
101 working-directory: lightning-c-bindings
103 # Note that the version tags aren't checked into git
105 RUSTFLAGS="--cfg=c_bindings" cargo check --features std
106 - name: Install cbindgen
108 git clone https://github.com/eqrion/cbindgen
111 cargo update -p indexmap --precise "1.6.2" --verbose
112 cargo install --locked --path .
113 - name: Checkout Rust-Lightning git
115 git clone https://github.com/rust-bitcoin/rust-lightning
117 git checkout 0.0.118-bindings
118 - name: Fix Github Actions to not be broken
119 run: git config --global --add safe.directory /__w/ldk-c-bindings/ldk-c-bindings
120 - name: Fetch MacOS SDK
122 wget https://bitcoincore.org/depends-sources/sdks/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
123 tar xvvf Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
124 - name: Rebuild bindings, and check the sample app builds + links
126 # rust-src doesn't distribute the rustlib Cargo.lock, but an empty
127 # file seems to suffice to make `-Zbuild-std` happy.
128 touch /usr/lib/rustlib/src/rust/Cargo.lock
129 MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers" ./genbindings.sh ./rust-lightning true
138 runs-on: ${{ matrix.platform }}
142 - name: Install other Rust platforms
143 run: rustup target install aarch64-apple-darwin
144 - name: Fetch upstream LLVM/clang snapshot
146 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
147 if [ "$(shasum -a 256 clang+llvm-15.0.3-x86_64-apple-darwin.tar.xz | awk '{ print $1 }')" != "ac668586b2b3d068f1e43520a3ef0b1592e5dc3eff1a4a4b772e29803b428a69" ]; then
151 - name: Unpack upstream LLVM+clang and use it by default
153 tar xvvf clang+llvm-15.0.3-x86_64-apple-darwin.tar.xz
154 - name: Checkout source code
155 uses: actions/checkout@v2
158 - name: Install cbindgen
159 run: cargo install cbindgen
160 - name: Checkout Rust-Lightning git
162 git clone https://github.com/rust-bitcoin/rust-lightning
164 git checkout 0.0.118-bindings
165 - name: Rebuild bindings using Apple clang, and check the sample app builds + links
166 run: ./genbindings.sh ./rust-lightning true
167 - name: Rebuild bindings using upstream clang, and check the sample app builds + links
169 export PATH=`pwd`/clang+llvm-15.0.3-x86_64-apple-darwin/bin:$PATH
170 CC=clang ./genbindings.sh ./rust-lightning true