]> git.bitcoin.ninja Git - ldk-swift-linux/commitdiff
Add CI master
authorMatt Corallo <git@bluematt.me>
Fri, 30 Jul 2021 00:21:32 +0000 (00:21 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 30 Jul 2021 01:00:28 +0000 (01:00 +0000)
.github/workflows/build.yml [new file with mode: 0644]

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644 (file)
index 0000000..6f93f20
--- /dev/null
@@ -0,0 +1,53 @@
+name: Continuous Integration Checks
+
+on: [push, pull_request]
+
+jobs:
+  check_bindings:
+    runs-on: ubuntu-20.04
+    env:
+      TOOLCHAIN: stable
+    steps:
+      - name: Install native Rust toolchain, Valgrind, and build utilitis
+        run: |
+          sudo apt-get update
+          sudo apt-get -y dist-upgrade
+          sudo apt-get -y install cargo valgrind lld git g++ clang curl
+      - name: Checkout source code
+        uses: actions/checkout@v2
+      - name: Install cbindgen
+        run: cargo install --force cbindgen
+      - name: Checkout Rust-Lightning and LDK-C-Bindings git
+        run: |
+          git config --global user.email "ldk-ci@example.com"
+          git config --global user.name "LDK CI"
+          # Note this is a different endpoint, as we need one non-upstream commit!
+          git clone https://git.bitcoin.ninja/rust-lightning
+          cd rust-lightning
+          git checkout origin/2021-03-java-bindings-base
+          cd ..
+          git clone https://github.com/lightningdevkit/ldk-c-bindings
+      - name: Install Swift Toolchain
+        run: |
+          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
+          if [ "$(sha256sum swift-5.4.2-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')" != "86b849d9f6ba2eda4e12ea5eafaa0748bffcd6272466b514c2b0fd4a829c63a4" ]; then
+            echo "Bad hash"
+            exit 1
+          fi
+          tar xvvf swift-5.4.2-RELEASE-ubuntu20.04.tar.gz
+      - name: Rebuild C bindings
+        run: |
+          cd ldk-c-bindings
+          ./genbindings.sh ../rust-lightning true
+          cd ..
+      - name: Copy new headers into bindings
+        run: |
+          cp ldk-c-bindings/lightning-c-bindings/include/*.h LDKCHeaders/Headers/
+          cp ldk-c-bindings/ldk-net/ldk_net.h LDKCHeaders/Headers/
+      - name: Build and test bindings
+        run: |
+          cd LDKSwift
+          LDK_C_BINDINGS_BASE="../ldk-c-bindings" RUST_BACKTRACE=1 ../swift-5.4.2-RELEASE-ubuntu20.04/usr/bin/swift test
+      - name: Check that the latest headers are in the swift repo
+        run: |
+          git diff --exit-code