]> git.bitcoin.ninja Git - ldk-java/commitdiff
Update CI to not require git tags checked in and fix WASM32 paths.
authorMatt Corallo <git@bluematt.me>
Sun, 2 May 2021 22:34:52 +0000 (22:34 +0000)
committerMatt Corallo <git-ldk-build@bluematt.me>
Tue, 8 Jun 2021 21:25:20 +0000 (21:25 +0000)
.github/workflows/build.yml
src/test/java/org/ldk/HumanObjectPeerTest.java

index f6cf74a30987235a8a2875856c69f7efa6aa0433..68ca3df2831ee0769937a15fefc96e060d844d02 100644 (file)
@@ -18,10 +18,14 @@ jobs:
           apt-get -y install cargo libstd-rust-dev-wasm32 valgrind lld git g++ clang openjdk-11-jdk maven
       - name: Checkout source code
         uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
       - 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"
           git clone https://github.com/rust-bitcoin/rust-lightning
           cd rust-lightning
           git remote add matt https://git.bitcoin.ninja/rust-lightning
@@ -33,10 +37,10 @@ jobs:
         run: |
           cd ldk-c-bindings
           ./genbindings.sh ../rust-lightning false
-          mv target/wasm32-wasi ./
+          mv lightning-c-bindings/target/wasm32-wasi ./
           cd ..
       - name: Rebuild C bindings, and check the sample app builds + links
-        run: cd ldk-c-bindings && ./genbindings.sh ../rust-lightning true && mv wasm32-wasi target/ && cd ..
+        run: cd ldk-c-bindings && ./genbindings.sh ../rust-lightning true && mv wasm32-wasi lightning-c-bindings/target/ && cd ..
       - name: Build Java/TS Debug Bindings
         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
       - name: Run Java Tests against Debug Bindings
@@ -49,7 +53,20 @@ jobs:
           mvn test
           git checkout liblightningjni.so
       - name: Build Java/TS Release Bindings
-        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
+        run: |
+          # We assume the top commit is just a bindings update commit, so we
+          # check out the previous commit to use as the commit we git describe.
+          # If the top commit is a merge commit, we need to get the last merge
+          # head and assume the latest bindings are built against its parent.
+          COMMIT_PARENTS=$(git show -s --pretty=format:%P HEAD)
+          if [ "${#COMMIT_PARENTS}" = 40 ]; then
+            export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD^1)"
+          else
+            MERGE_HEAD=$(git show --pretty=format:%P HEAD | ( for last in $(cat /dev/stdin); do true; done; echo $last ))
+            export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag $MERGE_HEAD^1)"
+          fi
+          echo "Using $LDK_GARBAGECOLLECTED_GIT_OVERRIDE as git version"
+          ./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
       - name: Check latest headers are in git
         run: |
           # For some reason the debug library is not deterministic, this may be fixed in a future rustc
index 576f6d338a2475e2834dfa3a3104426587a0b9c6..742d388ec8c29047cc8c3744e35340775ff8d9cf 100644 (file)
@@ -517,7 +517,7 @@ class HumanObjectPeerTestInstance {
         if (use_nio_peer_handler) {
             peer1.nio_peer_handler.check_events();
             peer2.nio_peer_handler.check_events();
-            try { Thread.sleep(400); } catch (InterruptedException e) { assert false; }
+            try { Thread.sleep(500); } catch (InterruptedException e) { assert false; }
         } else {
             synchronized (runqueue) {
                 ran = false;