5151 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
5252 - name : Run Java Tests against Debug Bindings
5353 run : |
54- rm liblightningjni.so
55- ln -s liblightningjni_debug.so liblightningjni.so
56- export LD_LIBRARY_PATH=.
57- export LD_PRELOAD=/usr/lib/llvm-11/lib/clang/11.0.1/lib/linux/libclang_rt.asan-x86_64.so
54+ mv liblightningjni_debug_Linux-amd64.so liblightningjni.so
5855 export ASAN_OPTIONS=detect_leaks=0
59- mvn test
60- git checkout liblightningjni.so
56+ LD_PRELOAD=/usr/lib/llvm-11/lib/clang/11.0.1/lib/linux/libclang_rt.asan-x86_64.so LD_LIBRARY_PATH=. mvn test
6157 - name : Build Java/TS Release Bindings
6258 run : |
6359 # We assume the top commit is just a bindings update commit, so we
@@ -73,8 +69,113 @@ jobs:
7369 fi
7470 echo "Using $LDK_GARBAGECOLLECTED_GIT_OVERRIDE as git version"
7571 ./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
76- - name : Check latest headers are in git
72+ - name : Check latest headers and release lib are in git
7773 run : |
78- # For some reason the debug library is not deterministic, this may be fixed in a future rustc
79- git checkout liblightningjni_debug.so
8074 git diff --exit-code
75+ - name : Run Java Tests against built release jar
76+ run : |
77+ mvn -DskipTests=true package
78+ mvn install:install-file -Dfile=target/ldk-java-1.0-SNAPSHOT.jar -DgroupId=org.ldk -DartifactId=ldk-java -Dversion=1.0-SNAPSHOT -Dpackaging=jar
79+ cd javatester
80+ mvn package
81+ java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar
82+ cd ..
83+
84+ osx :
85+ strategy :
86+ matrix :
87+ include :
88+ - platform : macos-10.15
89+ # MacOS 11 is currently in private preview, we've applied for access
90+ # - platform: macos-11
91+ runs-on : ${{ matrix.platform }}
92+ env :
93+ TOOLCHAIN : stable
94+ steps :
95+ - name : Install other Rust platforms
96+ run : rustup target install aarch64-apple-darwin
97+ - name : Fetch upstream LLVM/clang snapshot
98+ run : |
99+ wget -O clang+llvm-12.0.0-x86_64-apple-darwin.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/clang+llvm-12.0.0-x86_64-apple-darwin.tar.xz
100+ if [ "$(shasum -a 256 clang+llvm-12.0.0-x86_64-apple-darwin.tar.xz | awk '{ print $1 }')" != "7bc2259bf75c003f644882460fc8e844ddb23b27236fe43a2787870a4cd8ab50" ]; then
101+ echo "Bad hash"
102+ exit 1
103+ fi
104+ - name : Unpack upstream LLVM+clang and use it by default
105+ run : |
106+ tar xvvf clang+llvm-12.0.0-x86_64-apple-darwin.tar.xz
107+ - name : Checkout source code
108+ uses : actions/checkout@v2
109+ with :
110+ fetch-depth : 0
111+ - name : Install cbindgen
112+ run : cargo install --force cbindgen
113+ - name : Checkout Rust-Lightning and LDK-C-Bindings git
114+ run : |
115+ git config --global user.email "[email protected] " 116+ git config --global user.name "LDK CI"
117+ git clone https://github.com/rust-bitcoin/rust-lightning
118+ cd rust-lightning
119+ git remote add matt https://git.bitcoin.ninja/rust-lightning
120+ git fetch matt
121+ git merge matt/2021-03-java-bindings-base
122+ cd ..
123+ git clone https://github.com/lightningdevkit/ldk-c-bindings
124+ - name : Rebuild C bindings with upstream clang, and check the sample app builds + links
125+ run : |
126+ cd ldk-c-bindings
127+ export PATH=`pwd`/clang+llvm-12.0.0-x86_64-apple-darwin/bin:$PATH
128+ CC=clang ./genbindings.sh ../rust-lightning true
129+ cd ..
130+ - name : Fetch OpenJDK 16
131+ run : |
132+ wget -O openjdk-16.0.1_osx-x64_bin.tar.gz https://download.java.net/java/GA/jdk16.0.1/7147401fd7354114ac51ef3e1328291f/9/GPL/openjdk-16.0.1_osx-x64_bin.tar.gz
133+ if [ "$(shasum -a 256 openjdk-16.0.1_osx-x64_bin.tar.gz | awk '{ print $1 }')" != "6098f839954439d4916444757c542c1b8778a32461706812d41cc8bbefce7f2f" ]; then
134+ echo "Bad hash"
135+ exit 1
136+ fi
137+ tar xvvf openjdk-16.0.1_osx-x64_bin.tar.gz
138+ export JAVA_HOME=`pwd`/jdk-16.0.1.jdk/Contents/Home
139+ export PATH=$JAVA_HOME/bin:$PATH
140+ - name : Build Java/TS Release Bindings
141+ run : |
142+ # We assume the top commit is just a bindings update commit, so we
143+ # check out the previous commit to use as the commit we git describe.
144+ # If the top commit is a merge commit, we need to get the last merge
145+ # head and assume the latest bindings are built against its parent.
146+ COMMIT_PARENTS=$(git show -s --pretty=format:%P HEAD)
147+ if [ "${#COMMIT_PARENTS}" = 40 ]; then
148+ export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD^1)"
149+ else
150+ MERGE_HEAD=$(git show --pretty=format:%P HEAD | ( for last in $(cat /dev/stdin); do true; done; echo $last ))
151+ export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag $MERGE_HEAD^1)"
152+ fi
153+ echo "Using $LDK_GARBAGECOLLECTED_GIT_OVERRIDE as git version"
154+ # genbindings.sh always fails as there is no wasm32-wasi library
155+ # available, so instead we delete the expected JNI library and check
156+ # that it was created.
157+ rm src/main/resources/liblightningjni_MacOSX-x86_64.nativelib
158+ ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$(xcrun --show-sdk-path)" false false || echo
159+ cat src/main/resources/liblightningjni_MacOSX-x86_64.nativelib > /dev/null
160+ - name : Fetch Maven 3.8.1
161+ run : |
162+ wget -O apache-maven-3.8.1-bin.tar.gz https://apache.osuosl.org/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz
163+ if [ "$(shasum -a 256 apache-maven-3.8.1-bin.tar.gz | awk '{ print $1 }')" != "b98a1905eb554d07427b2e5509ff09bd53e2f1dd7a0afa38384968b113abef02" ]; then
164+ echo "Bad hash"
165+ exit 1
166+ fi
167+ tar xvvf apache-maven-3.8.1-bin.tar.gz
168+ export PATH=apache-maven-3.8.1/bin:$PATH
169+ - name : Run Java Tests against built jar
170+ run : |
171+ mvn -DskipTests=true package
172+ mvn install:install-file -Dfile=target/ldk-java-1.0-SNAPSHOT.jar -DgroupId=org.ldk -DartifactId=ldk-java -Dversion=1.0-SNAPSHOT -Dpackaging=jar
173+ cd javatester
174+ mvn package
175+ java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar
176+ cd ..
177+ - name : Check latest headers and release lib are in git
178+ run : |
179+ if [ "${{ matrix.platform }}" = "macos-11" ]; then
180+ git diff --exit-code
181+ fi
0 commit comments