a7cd7bbd2c5a2e2fd98220b3c89532280c0101e8
[ldk-java] / .github / workflows / build.yml
1 name: Continuous Integration Checks
2
3 on: [push, pull_request]
4
5 jobs:
6   wasm_bindings:
7     runs-on: ubuntu-latest
8     # Ubuntu's version of clang doesn't support....anything that should work.
9     # Ubuntu is an utter trash OS and should generally never be used for anything.
10     # We also require at least rustc 1.51 (ie https://github.com/rust-lang/rust/pull/79998),
11     # so we use debian testing
12     container: debian:bookworm
13     strategy:
14       fail-fast: false
15     steps:
16       - name: Install build utilities and test that clang can build for wasm
17         run: |
18           apt-get update
19           apt-get -y dist-upgrade
20           apt-get -y install cargo libstd-rust-dev-wasm32 lld git g++ clang curl node-typescript npm python3
21           echo "int main() {}" > genbindings_wasm_test_file.c
22           clang -nostdlib -o /dev/null --target=wasm32-wasi -Wl,--no-entry genbindings_wasm_test_file.c
23           rm genbindings_wasm_test_file.c
24       - name: Checkout source code
25         uses: actions/checkout@v2
26         with:
27           fetch-depth: 0
28       - name: Install cbindgen
29         run: cargo install --force cbindgen
30       - name: Checkout Rust-Lightning and LDK-C-Bindings git
31         run: |
32           git config --global user.email "ldk-ci@example.com"
33           git config --global user.name "LDK CI"
34           # Note this is a different endpoint, as we need one non-upstream commit!
35           git clone https://git.bitcoin.ninja/rust-lightning
36           cd rust-lightning
37           git checkout origin/2021-03-java-bindings-base
38           cd ..
39           git clone https://github.com/lightningdevkit/ldk-c-bindings
40           cd ldk-c-bindings
41           git checkout 0.0.104
42       - name: Rebuild C bindings without STD
43         run: |
44           cd ldk-c-bindings
45           ./genbindings.sh ../rust-lightning false
46       - name: Build and Test TS Debug Bindings for Node
47         run: |
48           # We need FinalizationRegistry and top-level await support, which requires node 14.6/8,
49           # however Debian ships with Node 12
50           # Thus, we install the binary nodejs from nodejs.org and test with that.
51           curl https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz > nodejs.tar.xz
52           tar xvvf nodejs.tar.xz
53           export PATH=$(pwd)/$(echo node-*/bin):$PATH
54           ./genbindings.sh ./ldk-c-bindings/ wasm true false
55       - name: Build and Test TS Release Bindings for Node
56         run: |
57           export PATH=$(pwd)/$(echo node-*/bin):$PATH
58           ./genbindings.sh ./ldk-c-bindings/ wasm false false
59       - name: Install Playwright for Web Tests
60         run: |
61           export HOME=/root/ # Github actions is apparently broken
62           export PATH=$(pwd)/$(echo node-*/bin):$PATH
63           # npx playwright install-deps is broken so we do it manually, see https://github.com/microsoft/playwright/issues/11165
64           apt-get install -y --no-install-recommends fonts-liberation libenchant-2-2 libicu67 libjpeg62-turbo libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libdbus-1-3 libdrm2 libegl1 libgbm1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxrandr2 libxshmfence1 xvfb fonts-noto-color-emoji fonts-unifont libfontconfig libfreetype6 xfonts-scalable fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf ffmpeg libcairo-gobject2 libdbus-glib-1-2 libfontconfig1 libgdk-pixbuf2.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libxcb-shm0 libxcursor1 libxi6 libxrender1 libxt6 gstreamer1.0-libav gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good libepoxy0 libevdev2 libgl1 libgles2 libgstreamer-gl1.0-0 libgstreamer1.0-0 libharfbuzz-icu0 libharfbuzz0b libhyphen0 libnotify4 libopenjp2-7 libopus0 libpng16-16 libsecret-1-0 libsoup2.4-1 libwayland-client0 libwayland-egl1 libwayland-server0 libwebp6 libwebpdemux2 libwoff1 libxkbcommon0 libxml2 libxslt1.1
65           mkdir -p $HOME/.cache/ms-playwright # `playwright install` is too dumb to create this for us
66           chmod -R 777 $HOME/
67           npm i -D playwright
68           npx playwright install
69       - name: Build and Test TS Debug Bindings for Web
70         run: |
71           export HOME=/root/ # Github actions is apparently broken
72           export PATH=$(pwd)/$(echo node-*/bin):$PATH
73           ./genbindings.sh ./ldk-c-bindings/ wasm true true
74           cd ts
75           rm liblightningjs.wasm && ln -s $(pwd)/../liblightningjs_debug.wasm ./liblightningjs.wasm
76           python3 -m http.server &
77           node test/browser.mjs
78       - name: Build and Test TS Release Bindings for Web
79         run: |
80           export HOME=/root/ # Github actions is apparently broken
81           export PATH=$(pwd)/$(echo node-*/bin):$PATH
82           ./genbindings.sh ./ldk-c-bindings/ wasm false true
83           cd ts
84           rm liblightningjs.wasm && ln -s $(pwd)/../liblightningjs_release.wasm ./liblightningjs.wasm
85           node test/browser.mjs
86       - name: Check latest TS files are in git
87         run: |
88           git diff --exit-code
89
90   java_bindings:
91     runs-on: ubuntu-latest
92     # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
93     # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
94     container: debian:bullseye
95     strategy:
96       fail-fast: false
97     steps:
98       - name: Install native Rust toolchain, Valgrind, and build utilitis
99         run: |
100           apt-get update
101           apt-get -y dist-upgrade
102           apt-get -y install cargo valgrind lld git g++ clang openjdk-11-jdk maven faketime zip unzip llvm curl
103       - name: Checkout source code
104         uses: actions/checkout@v2
105         with:
106           fetch-depth: 0
107       - name: Install cbindgen
108         run: cargo install --force cbindgen
109       - name: Checkout Rust-Lightning and LDK-C-Bindings git
110         run: |
111           git config --global user.email "ldk-ci@example.com"
112           git config --global user.name "LDK CI"
113           # Note this is a different endpoint, as we need one non-upstream commit!
114           git clone https://git.bitcoin.ninja/rust-lightning
115           cd rust-lightning
116           git checkout origin/2021-03-java-bindings-base
117           cd ..
118           git clone https://github.com/lightningdevkit/ldk-c-bindings
119           cd ldk-c-bindings
120           git checkout 0.0.104
121       - name: Rebuild C bindings, and check the sample app builds + links
122         run: |
123           cd ldk-c-bindings
124           ./genbindings.sh ../rust-lightning true
125       - name: Build Java Debug Bindings
126         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
127       - name: Run Java Tests against Debug Bindings
128         run: |
129           mv liblightningjni_debug_Linux-amd64.so liblightningjni.so
130           export ASAN_OPTIONS=detect_leaks=0
131           LD_PRELOAD=/usr/lib/llvm-11/lib/clang/11.0.1/lib/linux/libclang_rt.asan-x86_64.so LD_LIBRARY_PATH=. mvn test
132       - name: Build Java Release Bindings
133         run: |
134           ./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
135       - name: Check latest headers are in git
136         run: |
137           git checkout pom.xml
138           git diff --exit-code
139
140   java_determinism:
141     runs-on: ubuntu-latest
142     # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
143     # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
144     container: debian:bullseye
145     strategy:
146       fail-fast: false
147     steps:
148       - name: Install native Rust toolchain, Valgrind, and build utilitis
149         run: |
150           apt-get update
151           apt-get -y dist-upgrade
152           apt-get -y install cargo valgrind lld git g++ clang openjdk-11-jdk maven faketime zip unzip llvm curl
153       - name: Checkout source code
154         uses: actions/checkout@v2
155         with:
156           fetch-depth: 0
157       - name: Install cbindgen
158         run: cargo install --force cbindgen
159       - name: Checkout Rust-Lightning and LDK-C-Bindings git
160         run: |
161           git config --global user.email "ldk-ci@example.com"
162           git config --global user.name "LDK CI"
163           # Note this is a different endpoint, as we need one non-upstream commit!
164           git clone https://git.bitcoin.ninja/rust-lightning
165           cd rust-lightning
166           git checkout origin/2021-03-java-bindings-base
167           cd ..
168           git clone https://github.com/lightningdevkit/ldk-c-bindings
169           cd ldk-c-bindings
170           git checkout 0.0.104
171       - name: Rebuild C bindings, and check the sample app builds + links
172         run: |
173           cd ldk-c-bindings
174           ./genbindings.sh ../rust-lightning true
175       - name: Checkout latest MacOS binaries
176         run: |
177           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
178           echo "Fetching deterministic binaries for LDK-GC ${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
179           # Gitweb only allows snapshots of folders by providing the object hash, which we have to extract:
180           SNAPSHOT_LINK="$(curl "https://git.bitcoin.ninja/index.cgi?p=ldk-java-bins;a=tree;f=${LDK_GARBAGECOLLECTED_GIT_OVERRIDE};hb=refs/heads/main" | grep snapshot | grep -o 'href="[a-zA-Z0-9/?\.=;\-]*"' | sed 's/href="//' | tr -d '"' | grep snapshot)"
181           curl -o bins-snapshot.tgz "https://git.bitcoin.ninja${SNAPSHOT_LINK}"
182           mkdir -p ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
183           cd ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
184           tar xvvf ../../bins-snapshot.tgz
185           mv ldk-java-bins-*/* ./
186           rm -r ldk-java-bins-*
187           cd ../..
188           mkdir -p src/main/resources/
189           cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/liblightningjni_MacOSX-"* src/main/resources/
190       - name: Build Java Release Bindings
191         run: |
192           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
193           ./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
194       - name: Build deterministic release jar
195         run: ./build-release-jar.sh
196       - name: Check latest library and jars are in bins repo
197         run: |
198           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
199           mkdir ldk-java-bins/new/
200           cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_Mac*.nativelib ldk-java-bins/new/
201           cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"LDK-release.aar ldk-java-bins/new/
202           # ldk-java-leaktracking is only for debug purposes and we don't bother with determinism
203           cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"ldk-java-leaktracking.jar ldk-java-bins/new/
204           cp src/main/resources/liblightningjni_Linux-amd64.nativelib ldk-java-bins/new/
205           cp ldk-java-sources.jar ldk-java-bins/new/
206           cp ldk-java.jar ldk-java-bins/new/
207           cp ldk-java-classes.jar ldk-java-bins/new/
208           cp ldk-java-javadoc.jar ldk-java-bins/new/
209           cd ldk-java-bins
210           if ! diff -r "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/" new/; then
211             apt-get -y install diffoscope
212             diffoscope new/ldk-java-sources.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-sources.jar" || echo
213             diffoscope new/ldk-java-javadoc.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-javadoc.jar" || echo
214             diffoscope new/ldk-java-classes.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-classes.jar" || echo
215             diffoscope new/ldk-java.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java.jar" || echo
216             exit 1
217           fi
218       - name: Run Java Tests against built release jar
219         run: |
220           mvn install:install-file -Dfile=ldk-java.jar -DgroupId=org.lightningdevkit -DartifactId=ldk-java -Dversion=1.0-SNAPSHOT -Dpackaging=jar
221           cd javatester
222           mvn package
223           java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar
224           cd ..
225
226   android:
227     runs-on: ubuntu-latest
228     # Frankly, I'm not really sure why debian and ubuntu differ in the results here, they really shouldn't
229     container: debian:bullseye
230     strategy:
231       fail-fast: false
232     steps:
233       - name: Install rust targets
234         run: |
235           apt-get update
236           apt-get -y dist-upgrade
237           apt-get -y install git g++ clang faketime zip unzip curl openjdk-11-jdk
238           curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
239           chmod +x ./rustup.sh
240           ./rustup.sh -y
241           . $HOME/.cargo/env
242           rustup target add armv7-linux-androideabi
243           rustup target add aarch64-linux-android
244           rustup target add i686-linux-android
245           rustup target add x86_64-linux-android
246       - name: Checkout source code
247         uses: actions/checkout@v2
248         with:
249           fetch-depth: 0
250       - name: Install android NDK compilers
251         run: |
252           curl https://dl.google.com/android/repository/android-ndk-r22b-linux-x86_64.zip > android-ndk-r22b-linux-x86_64.zip
253           if [ "$(sha256sum android-ndk-r22b-linux-x86_64.zip | awk '{ print $1 }')" != "ac3a0421e76f71dd330d0cd55f9d99b9ac864c4c034fc67e0d671d022d4e806b" ]; then
254             echo "Bad hash"
255             exit 1
256           fi
257           unzip android-ndk-r22b-linux-x86_64.zip
258       - name: Install cbindgen
259         run: |
260           . $HOME/.cargo/env
261           cargo install --force cbindgen
262       - name: Checkout Rust-Lightning and LDK-C-Bindings git
263         run: |
264           git config --global user.email "ldk-ci@example.com"
265           git config --global user.name "LDK CI"
266           # Note this is a different endpoint, as we need one non-upstream commit!
267           git clone https://git.bitcoin.ninja/rust-lightning
268           cd rust-lightning
269           git checkout origin/2021-03-java-bindings-base
270           cd ..
271           git clone https://github.com/lightningdevkit/ldk-c-bindings
272           cd ldk-c-bindings
273           git checkout 0.0.104
274       - name: Checkout Android AAR binaries and artifacts
275         run: |
276           # Gitweb only allows snapshots of folders by providing the object hash, which we have to extract:
277           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
278           echo "Fetching deterministic binaries for LDK-GC ${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
279           RELEASE_PAGE="https://git.bitcoin.ninja/index.cgi?p=ldk-java-bins;a=tree;f=${LDK_GARBAGECOLLECTED_GIT_OVERRIDE};hb=refs/heads/main"
280           SNAPSHOT_LINK="$(curl "$RELEASE_PAGE" | grep snapshot | grep -o 'href="[a-zA-Z0-9/?\.=;\-]*"' | sed 's/href="//' | tr -d '"' | grep snapshot)"
281           curl -o bins-snapshot.tgz "https://git.bitcoin.ninja${SNAPSHOT_LINK}"
282
283           ANDROID_PAGE="https://git.bitcoin.ninja/index.cgi?p=ldk-java-bins;a=tree;f=android-artifacts;hb=refs/heads/main"
284           SNAPSHOT_LINK="$(curl "$ANDROID_PAGE" | grep snapshot | grep -o 'href="[a-zA-Z0-9/?\.=;\-]*"' | sed 's/href="//' | tr -d '"' | grep snapshot)"
285           curl -o android-snapshot.tgz "https://git.bitcoin.ninja${SNAPSHOT_LINK}"
286
287           mkdir -p ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
288           cd ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
289           tar xvvf ../../bins-snapshot.tgz
290           mv ldk-java-bins-*/* ./
291           rm -r ldk-java-bins-*
292
293           mkdir -p ../android-artifacts
294           cd ../android-artifacts
295           tar xvvf ../../android-snapshot.tgz
296           mv ldk-java-bins-*/* ./
297           rm -r ldk-java-bins-*
298       - name: Build Android aar
299         run: |
300           . $HOME/.cargo/env
301           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
302           cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-classes.jar" ./
303           export ANDROID_TOOLCHAIN="$(pwd)/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64"
304           export PATH="$PATH:$ANDROID_TOOLCHAIN/bin"
305           ./android-build.sh ./rust-lightning ./ldk-c-bindings/ ./ldk-java-bins/android-artifacts
306       - name: Check latest library and jars are in bins repo
307         run: |
308           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
309           if ! diff LDK-release.aar "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"LDK-release.aar; then
310             apt-get -y install diffoscope
311             diffoscope LDK-release.aar "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/LDK-release.aar"
312             exit 1
313           fi
314
315   osx:
316     strategy:
317       matrix:
318         include:
319           - platform: macos-10.15
320           - platform: macos-11
321       fail-fast: false
322     runs-on: ${{ matrix.platform }}
323     steps:
324       - name: Install other Rust platforms
325         run: rustup target install aarch64-apple-darwin
326       - name: Fetch upstream LLVM/clang snapshot
327         run: |
328           wget -O clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz
329           if [ "$(shasum -a 256 clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz | awk '{ print $1 }')" != "d051234eca1db1f5e4bc08c64937c879c7098900f7a0370f3ceb7544816a8b09" ]; then
330             echo "Bad hash"
331             exit 1
332           fi
333       - name: Unpack upstream LLVM+clang and use it by default
334         run: |
335           tar xvvf clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz
336       - name: Checkout source code
337         uses: actions/checkout@v2
338         with:
339           fetch-depth: 0
340       - name: Install cbindgen
341         run: cargo install --force cbindgen
342       - name: Checkout Rust-Lightning and LDK-C-Bindings git
343         run: |
344           git config --global user.email "ldk-ci@example.com"
345           git config --global user.name "LDK CI"
346           # Note this is a different endpoint, as we need one non-upstream commit!
347           git clone https://git.bitcoin.ninja/rust-lightning
348           cd rust-lightning
349           git checkout origin/2021-03-java-bindings-base
350           cd ..
351           git clone https://github.com/lightningdevkit/ldk-c-bindings
352           cd ldk-c-bindings
353           git checkout 0.0.104
354       - name: Rebuild C bindings with upstream clang, and check the sample app builds + links
355         run: |
356           cd ldk-c-bindings
357           export PATH=`pwd`/clang+llvm-13.0.0-x86_64-apple-darwin/bin:$PATH
358           CC=clang ./genbindings.sh ../rust-lightning true
359           cd ..
360       - name: Fetch OpenJDK 16
361         run: |
362           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
363           if [ "$(shasum -a 256 openjdk-16.0.1_osx-x64_bin.tar.gz | awk '{ print $1 }')" != "6098f839954439d4916444757c542c1b8778a32461706812d41cc8bbefce7f2f" ]; then
364             echo "Bad hash"
365             exit 1
366           fi
367           tar xvvf openjdk-16.0.1_osx-x64_bin.tar.gz
368       - name: Checkout latest Linux binaries
369         run: |
370           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
371           echo "Fetching deterministic binaries for LDK-GC ${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
372           # Gitweb only allows snapshots of folders by providing the object hash, which we have to extract:
373           SNAPSHOT_LINK="$(wget -O /dev/stdout "https://git.bitcoin.ninja/index.cgi?p=ldk-java-bins;a=tree;f=${LDK_GARBAGECOLLECTED_GIT_OVERRIDE};hb=refs/heads/main" | grep snapshot | grep -o 'href="[a-zA-Z0-9/?\.=;\-]*"' | sed 's/href="//' | tr -d '"' | grep snapshot)"
374           wget -O bins-snapshot.tgz "https://git.bitcoin.ninja${SNAPSHOT_LINK}"
375           mkdir -p ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
376           cd ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
377           tar xvvf ../../bins-snapshot.tgz
378           mv ldk-java-bins-*/* ./
379           cd ../..
380           mkdir -p src/main/resources/
381           cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/liblightningjni_Linux-"* src/main/resources/
382       - name: Build Java Release Bindings
383         run: |
384           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
385           export JAVA_HOME=`pwd`/jdk-16.0.1.jdk/Contents/Home
386           export PATH=$JAVA_HOME/bin:$PATH
387           export PATH=`pwd`/clang+llvm-13.0.0-x86_64-apple-darwin/bin:$PATH
388           ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$(xcrun --show-sdk-path)" false false
389           if [ "${{ matrix.platform }}" = "macos-11" ]; then
390             export CC="clang --target=aarch64-apple-darwin"
391             export LDK_TARGET=aarch64-apple-darwin
392             export LDK_TARGET_CPU=apple-a14
393             ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$(xcrun --show-sdk-path)" false false
394             cat src/main/resources/liblightningjni_MacOSX-aarch64.nativelib > /dev/null
395           fi
396       - name: Fetch Maven 3.8.4
397         run: |
398           # We don't bother using the upstream mirrors as they remove prior
399           # releases aggressively, causing spurious CI failures when we don't
400           # care about the version used.
401           wget -O apache-maven-3.8.4-bin.tar.gz https://bitcoin.ninja/apache-maven-3.8.4-bin.tar.gz
402           if [ "$(shasum -a 256 apache-maven-3.8.4-bin.tar.gz | awk '{ print $1 }')" != "2cdc9c519427bb20fdc25bef5a9063b790e4abd930e7b14b4e9f4863d6f9f13c" ]; then
403             echo "Bad hash"
404             exit 1
405           fi
406           tar xvvf apache-maven-3.8.4-bin.tar.gz
407           export PATH=apache-maven-3.8.4/bin:$PATH
408       - name: Run Java Tests against built jar
409         run: |
410           export JAVA_HOME=`pwd`/jdk-16.0.1.jdk/Contents/Home
411           export PATH=$JAVA_HOME/bin:$PATH
412           mvn -DskipTests=true package
413           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
414           JAR_VERSION=${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}
415           mvn install:install-file -Dfile=target/ldk-java-${JAR_VERSION}.jar -DgroupId=org.lightningdevkit -DartifactId=ldk-java -Dversion=1.0-SNAPSHOT -Dpackaging=jar
416           cd javatester
417           mvn -q -B package
418           java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar
419           cd ..
420       - name: Check latest release libs are in git
421         run: |
422           if [ "${{ matrix.platform }}" = "macos-11" ]; then
423             export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
424             # Sadly, OSX binaries are not currently deterministic, more debugging is needed.
425             diff "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_MacOSX-x86_64.nativelib src/main/resources/liblightningjni_MacOSX-x86_64.nativelib || echo
426             diff "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_MacOSX-aarch64.nativelib src/main/resources/liblightningjni_MacOSX-aarch64.nativelib || echo
427           fi
428       - name: Run Java Tests against release bins
429         run: |
430           if [ "${{ matrix.platform }}" != "macos-11" ]; then
431             export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
432             export JAVA_HOME=`pwd`/jdk-16.0.1.jdk/Contents/Home
433             export PATH=$JAVA_HOME/bin:$PATH
434             cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_MacOSX-{x86_64,aarch64}.nativelib src/main/resources/
435             mvn clean
436             mvn -q -B -DskipTests=true package
437             JAR_VERSION=${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}
438             mvn install:install-file -Dfile=target/ldk-java-${JAR_VERSION}.jar -DgroupId=org.lightningdevkit -DartifactId=ldk-java -Dversion=1.0-SNAPSHOT -Dpackaging=jar
439             cd javatester
440             mvn -q -B package
441             java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar
442             cd ..
443           fi