Fix no-std+WASM builds by not mixing -flto and -fembed-bitcode
[ldk-c-bindings] / .github / workflows / build.yml
1 name: Continuous Integration Checks
2
3 on: [push, pull_request]
4
5 jobs:
6   check_bindings:
7     runs-on: ubuntu-latest
8     # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
9     # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
10     container: debian:bullseye
11     env:
12       TOOLCHAIN: stable
13     steps:
14       - name: Install native Rust toolchain, Valgrind, and build utilitis
15         run: |
16           apt-get update
17           apt-get -y dist-upgrade
18           apt-get -y install cargo libstd-rust-dev-wasm32 valgrind lld git g++ clang
19       - name: Checkout source code
20         uses: actions/checkout@v2
21       - name: Sanity test bindings against Cargo.toml RL
22         working-directory: lightning-c-bindings
23         run: cargo check
24       - name: Install cbindgen
25         run: cargo install --force cbindgen
26       - name: Checkout Rust-Lightning git
27         run: git clone https://github.com/rust-bitcoin/rust-lightning
28       - name: Rebuild bindings without std, and check the sample app builds + links
29         run: ./genbindings.sh ./rust-lightning false
30       - name: Rebuild bindings, and check the sample app builds + links
31         run: ./genbindings.sh ./rust-lightning true
32       - name: Check that the latest bindings are in git
33         run: |
34           git checkout lightning-c-bindings/Cargo.toml # genbindings edits this to update the path
35           if [ "$(git diff)" != "" ]; then
36             # cbindgen's bindings output order can be FS-dependant, so check that the lines are all the same:
37             mv lightning-c-bindings/include/lightning.h lightning-c-bindings/include/lightning.h.new
38             git checkout lightning-c-bindings/include/lightning.h
39             cat lightning-c-bindings/include/lightning.h | grep -v "Generated with cbindgen:[0-9\.]*" | sort > lightning-c-bindings/include/lightning.h.sorted
40             cat lightning-c-bindings/include/lightning.h.new | grep -v "Generated with cbindgen:[0-9\.]*" | sort > lightning-c-bindings/include/lightning.h.new.sorted
41             diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted
42             [ "$(diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted)" != "" ] && exit 2
43             git diff --exit-code
44           fi
45