]> git.bitcoin.ninja Git - ldk-java/blob - .github/workflows/build.yml
Avoid git version always appearing as dirty
[ldk-java] / .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 openjdk-11-jdk maven
19       - name: Checkout source code
20         uses: actions/checkout@v2
21       - name: Install cbindgen
22         run: cargo install --force cbindgen
23       - name: Checkout Rust-Lightning and LDK-C-Bindings git
24         run: |
25           git clone https://github.com/rust-bitcoin/rust-lightning
26           cd rust-lightning
27           git remote add matt https://git.bitcoin.ninja/rust-lightning
28           git fetch matt
29           git merge matt/2021-03-java-bindings-base
30           cd ..
31           git clone https://github.com/lightningdevkit/ldk-c-bindings
32       - name: Rebuild C bindings without STD for WASM
33         run: |
34           cd ldk-c-bindings
35           ./genbindings.sh ../rust-lightning false
36           mv target/wasm32-wasi ./
37           cd ..
38       - name: Rebuild C bindings, and check the sample app builds + links
39         run: cd ldk-c-bindings && ./genbindings.sh ../rust-lightning true && mv wasm32-wasi target/ && cd ..
40       - name: Build Java/TS Debug Bindings
41         run: ./genbindings.sh ./ldk-c-bindings/ "-I/usr/lib/jvm/java-11-openjdk-amd64/include/ -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux/" true false
42       - name: Run Java Tests against Debug Bindings
43         run: |
44           rm liblightningjni.so
45           ln -s liblightningjni_debug.so liblightningjni.so
46           export LD_LIBRARY_PATH=.
47           export LD_PRELOAD=/usr/lib/llvm-11/lib/clang/11.0.1/lib/linux/libclang_rt.asan-x86_64.so
48           export ASAN_OPTIONS=detect_leaks=0
49           mvn test
50           git checkout liblightningjni.so
51       - name: Build Java/TS Release Bindings
52         run: ./genbindings.sh ./ldk-c-bindings/ "-I/usr/lib/jvm/java-11-openjdk-amd64/include/ -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux/" false false
53       - name: Check latest headers are in git
54         run: |
55           # For some reason the debug library is not deterministic, this may be fixed in a future rustc
56           git checkout liblightningjni_debug.so
57           git diff --exit-code