Skip to content

Commit 9ad2841

Browse files
committed
Update CI to not require git tags checked in and fix WASM32 paths.
1 parent a6f3a48 commit 9ad2841

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ jobs:
1818
apt-get -y install cargo libstd-rust-dev-wasm32 valgrind lld git g++ clang openjdk-11-jdk maven
1919
- name: Checkout source code
2020
uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 0
2123
- name: Install cbindgen
2224
run: cargo install --force cbindgen
2325
- name: Checkout Rust-Lightning and LDK-C-Bindings git
2426
run: |
27+
git config --global user.email "[email protected]"
28+
git config --global user.name "LDK CI"
2529
git clone https://github.com/rust-bitcoin/rust-lightning
2630
cd rust-lightning
2731
git remote add matt https://git.bitcoin.ninja/rust-lightning
@@ -33,10 +37,16 @@ jobs:
3337
run: |
3438
cd ldk-c-bindings
3539
./genbindings.sh ../rust-lightning false
36-
mv target/wasm32-wasi ./
40+
mv lightning-c-bindings/target/wasm32-wasi ./
3741
cd ..
3842
- 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 ..
43+
run: |
44+
cd ldk-c-bindings
45+
# Reset the Cargo.toml file so that git describe doesn't think we're "-dirty"
46+
git checkout lightning-c-bindings/Cargo.toml
47+
./genbindings.sh ../rust-lightning true
48+
mv wasm32-wasi lightning-c-bindings/target/
49+
cd ..
4050
- name: Build Java/TS Debug Bindings
4151
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
4252
- name: Run Java Tests against Debug Bindings
@@ -49,7 +59,20 @@ jobs:
4959
mvn test
5060
git checkout liblightningjni.so
5161
- 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
62+
run: |
63+
# We assume the top commit is just a bindings update commit, so we
64+
# check out the previous commit to use as the commit we git describe.
65+
# If the top commit is a merge commit, we need to get the last merge
66+
# head and assume the latest bindings are built against its parent.
67+
COMMIT_PARENTS=$(git show -s --pretty=format:%P HEAD)
68+
if [ "${#COMMIT_PARENTS}" = 40 ]; then
69+
export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD^1)"
70+
else
71+
MERGE_HEAD=$(git show --pretty=format:%P HEAD | ( for last in $(cat /dev/stdin); do true; done; echo $last ))
72+
export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag $MERGE_HEAD^1)"
73+
fi
74+
echo "Using $LDK_GARBAGECOLLECTED_GIT_OVERRIDE as git version"
75+
./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
5376
- name: Check latest headers are in git
5477
run: |
5578
# For some reason the debug library is not deterministic, this may be fixed in a future rustc

src/test/java/org/ldk/HumanObjectPeerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ void wait_events_processed(Peer peer1, Peer peer2) {
517517
if (use_nio_peer_handler) {
518518
peer1.nio_peer_handler.check_events();
519519
peer2.nio_peer_handler.check_events();
520-
try { Thread.sleep(400); } catch (InterruptedException e) { assert false; }
520+
try { Thread.sleep(500); } catch (InterruptedException e) { assert false; }
521521
} else {
522522
synchronized (runqueue) {
523523
ran = false;

0 commit comments

Comments
 (0)