|
| 1 | +name: Continuous Integration Checks |
| 2 | + |
| 3 | +on: [ push, pull_request ] |
| 4 | + |
| 5 | +jobs: |
| 6 | + check_bindings: |
| 7 | + runs-on: ubuntu-20.04 |
| 8 | + env: |
| 9 | + TOOLCHAIN: stable |
| 10 | + steps: |
| 11 | + - name: Install native Rust toolchain, Valgrind, and build utilitis |
| 12 | + run: | |
| 13 | + sudo apt-get update |
| 14 | + sudo apt-get -y dist-upgrade |
| 15 | + sudo apt-get -y install cargo valgrind lld git g++ clang curl |
| 16 | + - name: Checkout source code |
| 17 | + uses: actions/checkout@v2 |
| 18 | + - name: Install cbindgen |
| 19 | + run: cargo install --force cbindgen |
| 20 | + - name: Checkout Rust-Lightning and LDK-C-Bindings git |
| 21 | + run: | |
| 22 | + git config --global user.email "[email protected]" |
| 23 | + git config --global user.name "LDK CI" |
| 24 | + # Note this is a different endpoint, as we need one non-upstream commit! |
| 25 | + git clone https://git.bitcoin.ninja/rust-lightning |
| 26 | + cd rust-lightning |
| 27 | + git checkout origin/2021-03-java-bindings-base |
| 28 | + cd .. |
| 29 | + git clone https://github.com/lightningdevkit/ldk-c-bindings |
| 30 | + - name: Install Swift Toolchain |
| 31 | + run: | |
| 32 | + curl https://swift.org/builds/swift-5.4.2-release/ubuntu2004/swift-5.4.2-RELEASE/swift-5.4.2-RELEASE-ubuntu20.04.tar.gz > swift-5.4.2-RELEASE-ubuntu20.04.tar.gz |
| 33 | + if [ "$(sha256sum swift-5.4.2-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')" != "86b849d9f6ba2eda4e12ea5eafaa0748bffcd6272466b514c2b0fd4a829c63a4" ]; then |
| 34 | + echo "Bad hash" |
| 35 | + exit 1 |
| 36 | + fi |
| 37 | + tar xvvf swift-5.4.2-RELEASE-ubuntu20.04.tar.gz |
| 38 | + - name: Rebuild C bindings |
| 39 | + run: | |
| 40 | + cd ldk-c-bindings |
| 41 | + ./genbindings.sh ../rust-lightning true |
| 42 | + cd .. |
| 43 | + - name: Copy new headers into bindings |
| 44 | + run: | |
| 45 | + cp ldk-c-bindings/lightning-c-bindings/include/*.h ci/LDKCHeaders/Headers/ |
| 46 | + cp ldk-c-bindings/ldk-net/ldk_net.h ci/LDKCHeaders/Headers/ |
| 47 | + - name: Fix header files |
| 48 | + run: | |
| 49 | + python ci/fix_header_includes.py |
| 50 | + - name: Copy Swift bindings into sources |
| 51 | + run: | |
| 52 | + cp -a bindings/LDK/. ci/LDKSwift/Sources/LDKSwift |
| 53 | + cp -R bindings/batteries ci/LDKSwift/Sources/LDKSwift |
| 54 | + - name: Build and test bindings |
| 55 | + run: | |
| 56 | + cd ci/LDKSwift |
| 57 | + LDK_C_BINDINGS_BASE="../ldk-c-bindings" RUST_BACKTRACE=1 ../swift-5.4.2-RELEASE-ubuntu20.04/usr/bin/swift test |
| 58 | + - name: Check that the latest headers are in the swift repo |
| 59 | + run: | |
| 60 | + git diff --exit-code |
0 commit comments