1 name: Continuous Integration Checks
3 on: [push, pull_request]
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
16 - name: Install build utilities and test that clang can build for wasm
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 wasi-libc
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
28 - name: Install cbindgen
30 git clone https://github.com/eqrion/cbindgen
33 cargo update -p indexmap --precise "1.6.2" --verbose
34 cargo install --locked --path .
35 - name: Checkout Rust-Lightning and LDK-C-Bindings git
37 git config --global safe.directory '*'
38 git config --global user.email "ldk-ci@example.com"
39 git config --global user.name "LDK CI"
40 # Note this is a different endpoint, as we need one non-upstream commit!
41 git clone https://github.com/lightningdevkit/rust-lightning
43 git checkout origin/0.0.118-bindings
45 git clone https://github.com/lightningdevkit/ldk-c-bindings
48 cd lightning-c-bindings
49 cargo update -p memchr --precise "2.5.0" --verbose
50 - name: Rebuild C bindings without STD
53 git config --global safe.directory "*"
54 ./genbindings.sh ../rust-lightning false
55 - name: Build and Test TS Debug Bindings for Node
57 # We need FinalizationRegistry and top-level await support, which requires node 14.6/8,
58 # however Debian ships with Node 12
59 # Thus, we install the binary nodejs from nodejs.org and test with that.
60 curl https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz > nodejs.tar.xz
61 tar xvvf nodejs.tar.xz
62 export PATH=$(pwd)/$(echo node-*/bin):$PATH
63 ./genbindings.sh ./ldk-c-bindings/ wasm true false
64 - name: Build and Test TS Release Bindings for Node
66 export PATH=$(pwd)/$(echo node-*/bin):$PATH
67 ./genbindings.sh ./ldk-c-bindings/ wasm false false
68 - name: Install Playwright for Web Tests
70 export HOME=/root/ # Github actions is apparently broken
71 export PATH=$(pwd)/$(echo node-*/bin):$PATH
72 # npx playwright install-deps is broken so we do it manually, see https://github.com/microsoft/playwright/issues/11165
73 apt-get install -y --no-install-recommends fonts-liberation libenchant-2-2 libicu72 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 libwebp7 libwebpdemux2 libwoff1 libxkbcommon0 libxml2 libxslt1.1
74 mkdir -p $HOME/.cache/ms-playwright # `playwright install` is too dumb to create this for us
76 npm i -D playwright@1.37.0-alpha-jul-31-2023
77 npx playwright@1.37.0-alpha-jul-31-2023 install
78 - name: Build and Test TS Debug Bindings for Web
80 export HOME=/root/ # Github actions is apparently broken
81 export PATH=$(pwd)/$(echo node-*/bin):$PATH
82 git config --global safe.directory "*"
83 ./genbindings.sh ./ldk-c-bindings/ wasm true true
85 rm liblightningjs.wasm && ln -s $(pwd)/../liblightningjs_debug.wasm ./liblightningjs.wasm
86 python3 -m http.server &
90 - name: Build and Test TS Release Bindings for Web
92 export HOME=/root/ # Github actions is apparently broken
93 export PATH=$(pwd)/$(echo node-*/bin):$PATH
94 ./genbindings.sh ./ldk-c-bindings/ wasm false true
96 rm liblightningjs.wasm && ln -s $(pwd)/../liblightningjs_release.wasm ./liblightningjs.wasm
97 python3 -m http.server &
101 - name: Check latest TS files are in git
103 git checkout ts/package.json
104 git checkout node-net/package.json
108 runs-on: ubuntu-latest
109 # Ubuntu's version of clang doesn't support....anything that should work.
110 # Ubuntu is an utter trash OS and should generally never be used for anything.
111 # We also require at least rustc 1.51 (ie https://github.com/rust-lang/rust/pull/79998),
112 # so we use debian testing
113 container: debian:bookworm
117 - name: Install required dependencies
120 apt-get -y dist-upgrade
121 apt-get -y install cargo lld llvm git g++ clang curl python3 mono-devel
122 - name: Checkout source code
123 uses: actions/checkout@v2
126 - name: Install cbindgen
128 git clone https://github.com/eqrion/cbindgen
131 cargo update -p indexmap --precise "1.6.2" --verbose
132 cargo install --locked --path .
133 - name: Checkout Rust-Lightning and LDK-C-Bindings git
135 git config --global safe.directory '*'
136 git config --global user.email "ldk-ci@example.com"
137 git config --global user.name "LDK CI"
138 # Note this is a different endpoint, as we need one non-upstream commit!
139 git clone https://github.com/lightningdevkit/rust-lightning
141 git checkout origin/0.0.118-bindings
143 git clone https://github.com/lightningdevkit/ldk-c-bindings
146 cd lightning-c-bindings
147 cargo update -p memchr --precise "2.5.0" --verbose
148 - name: Rebuild C bindings with STD
151 git config --global safe.directory "*"
152 ./genbindings.sh ../rust-lightning true
153 - name: Build and Test C# Debug Bindings
155 ./genbindings.sh ./ldk-c-bindings/ c_sharp true true
156 mono-csc -out:test.exe -langversion:3 -unsafe c_sharp/src/org/ldk/enums/*.cs c_sharp/src/org/ldk/impl/*.cs c_sharp/src/org/ldk/util/*.cs c_sharp/src/org/ldk/structs/*.cs c_sharp/test/src/tests.cs
157 ln -s libldkcsharp_debug_Linux-amd64.so libldkcsharp.so
158 export ASAN_OPTIONS=detect_leaks=0
159 LD_PRELOAD=/usr/lib/llvm-14/lib/clang/14.0.6/lib/linux/libclang_rt.asan-x86_64.so mono test.exe
162 runs-on: ubuntu-latest
163 # Ubuntu's version of clang doesn't support....anything that should work.
164 # Ubuntu is an utter trash OS and should generally never be used for anything.
165 # We also require at least rustc 1.51 (ie https://github.com/rust-lang/rust/pull/79998),
166 # so we use debian testing
167 container: debian:bookworm
171 - name: Install required dependencies
174 apt-get -y dist-upgrade
175 apt-get -y install cargo libstd-rust-dev-windows lld llvm git g++ clang curl gcc-mingw-w64-x86-64-win32 python3 mono-devel zip faketime
176 - name: Checkout source code
177 uses: actions/checkout@v2
180 - name: Install cbindgen
182 git clone https://github.com/eqrion/cbindgen
185 cargo update -p indexmap --precise "1.6.2" --verbose
186 cargo install --locked --path .
187 - name: Checkout Rust-Lightning and LDK-C-Bindings git
189 git config --global safe.directory '*'
190 git config --global user.email "ldk-ci@example.com"
191 git config --global user.name "LDK CI"
192 # Note this is a different endpoint, as we need one non-upstream commit!
193 git clone https://github.com/lightningdevkit/rust-lightning
195 git checkout origin/0.0.118-bindings
197 git clone https://github.com/lightningdevkit/ldk-c-bindings
200 - name: Rebuild C bindings with STD
203 export LDK_C_BINDINGS_EXTRA_TARGETS=x86_64-pc-windows-gnu
204 export LDK_C_BINDINGS_EXTRA_TARGET_CCS=`pwd`/deterministic-build-wrappers/clang-x86_64-windows
205 ./genbindings.sh ../rust-lightning true
206 - name: Remove checked-in source to ensure its correctly checked-in
207 run: rm c_sharp/src/org/ldk/enums/*.cs c_sharp/src/org/ldk/impl/*.cs c_sharp/src/org/ldk/structs/*.cs
208 - name: Build Windows C# Bindings
210 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
211 LDK_TARGET=x86_64-pc-windows-gnu faketime -f "2021-01-01 00:00:00" ./genbindings.sh ./ldk-c-bindings/ c_sharp false false
212 - name: Build Linux C# Bindings
214 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
215 ./genbindings.sh ./ldk-c-bindings/ c_sharp false false
216 - name: Build Release NUPKG
219 ./build-release-nupkg.sh
220 - name: Check latest auto-generated code is in git
222 # Checkout files that get updated with version information
223 git checkout c_sharp/packaging_artifacts/package/services/metadata/core-properties/ldk.psmdcp
224 git checkout c_sharp/packaging_artifacts/org.ldk.nuspec
226 - name: Checkout latest binaries
229 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
230 echo "Fetching deterministic binaries for LDK-GC ${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
231 # Gitweb only allows snapshots of folders by providing the object hash, which we have to extract:
232 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)"
233 curl -o bins-snapshot.tgz "https://git.bitcoin.ninja${SNAPSHOT_LINK}"
234 mkdir -p ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
235 cd ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
236 tar xvvf ../../bins-snapshot.tgz
237 mv ldk-java-bins-*/* ./
238 rm -r ldk-java-bins-*
239 - uses: actions/upload-artifact@v3
242 path: c_sharp/org.ldk.nupkg
243 - name: Compare C# nupkg with built one
246 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
247 if ! diff ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"org.ldk.nupkg c_sharp/org.ldk.nupkg; then
248 apt-get -y install diffoscope
249 diffoscope ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"org.ldk.nupkg c_sharp/org.ldk.nupkg || echo
254 runs-on: ubuntu-latest
255 # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
256 # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
257 container: debian:bookworm
261 - name: Install native Rust toolchain, Valgrind, and build utilitis
264 apt-get -y dist-upgrade
265 apt-get -y install cargo valgrind lld git g++ clang openjdk-17-jdk maven faketime zip unzip llvm curl
266 - name: Checkout source code
267 uses: actions/checkout@v2
270 - name: Install cbindgen
272 git config --global safe.directory '*'
273 git clone https://github.com/eqrion/cbindgen
276 cargo update -p indexmap --precise "1.6.2" --verbose
277 cargo install --locked --path .
278 - name: Checkout Rust-Lightning and LDK-C-Bindings git
280 git config --global user.email "ldk-ci@example.com"
281 git config --global user.name "LDK CI"
282 # Note this is a different endpoint, as we need one non-upstream commit!
283 git clone https://github.com/lightningdevkit/rust-lightning
285 git checkout origin/0.0.118-bindings
287 git clone https://github.com/lightningdevkit/ldk-c-bindings
290 cd lightning-c-bindings
291 cargo update -p memchr --precise "2.5.0" --verbose
292 - name: Pin proc-macro and quote to meet MSRV
294 cd ldk-c-bindings/c-bindings-gen
295 cargo update -p quote --precise "1.0.30" --verbose
296 cargo update -p proc-macro2 --precise "1.0.65" --verbose
297 - name: Rebuild C bindings, and check the sample app builds + links
300 ./genbindings.sh ../rust-lightning true
301 - name: Build Java Debug Bindings
302 run: ./genbindings.sh ./ldk-c-bindings/ "-I/usr/lib/jvm/java-17-openjdk-amd64/include/ -I/usr/lib/jvm/java-17-openjdk-amd64/include/linux/" true false
303 - name: Run Java Tests against Debug Bindings
305 mv liblightningjni_debug_Linux-amd64.so liblightningjni.so
306 export ASAN_OPTIONS=detect_leaks=0
307 LD_PRELOAD=/usr/lib/llvm-14/lib/clang/14.0.6/lib/linux/libclang_rt.asan-x86_64.so LD_LIBRARY_PATH=. mvn test
308 - name: Build Java Release Bindings
310 ./genbindings.sh ./ldk-c-bindings/ "-I/usr/lib/jvm/java-17-openjdk-amd64/include/ -I/usr/lib/jvm/java-17-openjdk-amd64/include/linux/" false false
311 - name: Check latest headers are in git
317 runs-on: ubuntu-latest
318 # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
319 # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
320 container: debian:bookworm
324 - name: Install native Rust toolchain, Valgrind, and build utilitis
327 apt-get -y dist-upgrade
328 apt-get -y install cargo valgrind lld git g++ clang openjdk-17-jdk maven faketime zip unzip llvm curl
329 - name: Checkout source code
330 uses: actions/checkout@v2
333 - name: Install cbindgen
335 git config --global safe.directory '*'
336 git clone https://github.com/eqrion/cbindgen
339 cargo update -p indexmap --precise "1.6.2" --verbose
340 cargo install --locked --path .
341 - name: Checkout Rust-Lightning and LDK-C-Bindings git
343 git config --global user.email "ldk-ci@example.com"
344 git config --global user.name "LDK CI"
345 # Note this is a different endpoint, as we need one non-upstream commit!
346 git clone https://github.com/lightningdevkit/rust-lightning
348 git checkout origin/0.0.118-bindings
350 git clone https://github.com/lightningdevkit/ldk-c-bindings
353 cd lightning-c-bindings
354 cargo update -p memchr --precise "2.5.0" --verbose
355 - name: Pin proc-macro and quote to meet MSRV
357 cd ldk-c-bindings/c-bindings-gen
358 cargo update -p quote --precise "1.0.30" --verbose
359 cargo update -p proc-macro2 --precise "1.0.65" --verbose
360 - name: Rebuild C bindings, and check the sample app builds + links
363 ./genbindings.sh ../rust-lightning true
364 - name: Checkout latest MacOS binaries
367 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
368 echo "Fetching deterministic binaries for LDK-GC ${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
369 # Gitweb only allows snapshots of folders by providing the object hash, which we have to extract:
370 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)"
371 curl -o bins-snapshot.tgz "https://git.bitcoin.ninja${SNAPSHOT_LINK}"
372 mkdir -p ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
373 cd ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
374 tar xvvf ../../bins-snapshot.tgz
375 mv ldk-java-bins-*/* ./
376 rm -r ldk-java-bins-*
378 mkdir -p src/main/resources/
379 - name: Copy latest MacOS leaktracking libs
381 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
382 cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_MacOSX-aarch64-leaktracking.nativelib src/main/resources/liblightningjni_MacOSX-aarch64.nativelib
383 cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_MacOSX-x86_64-leaktracking.nativelib src/main/resources/liblightningjni_MacOSX-x86_64.nativelib
384 - name: Build Leaktracking Java Release Bindings
386 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
387 ./genbindings.sh ./ldk-c-bindings/ "-I/usr/lib/jvm/java-17-openjdk-amd64/include/ -I/usr/lib/jvm/java-17-openjdk-amd64/include/linux/" leaks false
388 - name: Build deterministic release jar
390 ./build-release-jar.sh
391 mv ldk-java.jar ldk-java-leaktracking.jar
392 - name: Copy latest MacOS libs
395 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
396 cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/liblightningjni_MacOSX-"{aarch64,x86_64}.nativelib src/main/resources/
397 - name: Build Java leaktracking Bindings
399 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
400 ./genbindings.sh ./ldk-c-bindings/ "-I/usr/lib/jvm/java-17-openjdk-amd64/include/ -I/usr/lib/jvm/java-17-openjdk-amd64/include/linux/" leaks false
401 mkdir ldk-java-bins/new/
402 cp src/main/resources/liblightningjni_Linux-amd64.nativelib ldk-java-bins/new/liblightningjni_Linux-amd64-leaktracking.nativelib
403 - name: Build Java Release Bindings
405 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
406 ./genbindings.sh ./ldk-c-bindings/ "-I/usr/lib/jvm/java-17-openjdk-amd64/include/ -I/usr/lib/jvm/java-17-openjdk-amd64/include/linux/" false false
407 - name: Build deterministic release jar
408 run: ./build-release-jar.sh
409 - name: Check latest library and jars are in bins repo
411 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
412 cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_Mac*.nativelib ldk-java-bins/new/
413 cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"LDK-release.aar ldk-java-bins/new/
414 cp src/main/resources/liblightningjni_Linux-amd64.nativelib ldk-java-bins/new/
415 cp ldk-java-sources.jar ldk-java-bins/new/
416 cp ldk-java.jar ldk-java-bins/new/
417 cp ldk-java-leaktracking.jar ldk-java-bins/new/
418 cp ldk-java-classes.jar ldk-java-bins/new/
420 rm "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/liblightningjs.wasm" # TODO: Test this
421 if ! diff -r "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/" new/; then
422 apt-get -y install diffoscope
423 diffoscope new/ldk-java-sources.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-sources.jar" || echo
424 diffoscope new/ldk-java-classes.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-classes.jar" || echo
425 diffoscope new/ldk-java.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java.jar" || echo
426 diffoscope new/ldk-java-leaktracking.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-leaktracking.jar" || echo
429 - name: Run Java Tests against built release jar
431 mvn install:install-file -Dfile=ldk-java.jar -DgroupId=org.lightningdevkit -DartifactId=ldk-java -Dversion=1.0-SNAPSHOT -Dpackaging=jar
434 java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar
437 runs-on: ubuntu-latest
438 # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
439 # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
440 container: debian:bookworm
444 - name: Install native Rust toolchain, Valgrind, and build utilitis
447 apt-get -y dist-upgrade
448 apt-get -y install cargo valgrind openjdk-17-jdk lld git g++ clang llvm curl rust-src
449 - name: Checkout source code
450 uses: actions/checkout@v2
453 - name: Install cbindgen
455 git config --global safe.directory '*'
456 git clone https://github.com/eqrion/cbindgen
459 cargo update -p indexmap --precise "1.6.2" --verbose
460 cargo install --locked --path .
461 - name: Checkout Rust-Lightning and LDK-C-Bindings git
463 git config --global user.email "ldk-ci@example.com"
464 git config --global user.name "LDK CI"
465 # Note this is a different endpoint, as we need one non-upstream commit!
466 git clone https://github.com/lightningdevkit/rust-lightning
468 git checkout origin/0.0.118-bindings
470 git clone https://github.com/lightningdevkit/ldk-c-bindings
473 - name: Fetch MacOS SDK
475 curl -o Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz https://bitcoincore.org/depends-sources/sdks/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
476 tar xvvf Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
477 - name: Rebuild C bindings, and check the sample app builds + links
479 # rust-src doesn't distribute the rustlib Cargo.lock, but an empty
480 # file seems to suffice to make `-Zbuild-std` happy.
481 touch /usr/lib/rustlib/src/rust/Cargo.lock
482 export MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers"
484 ./genbindings.sh ../rust-lightning true
485 - name: Fetch MacOS OpenJDK 18 for x86_64
487 curl -o openjdk-18.0.1.1_macos-x64_bin.tar.gz https://download.java.net/java/GA/jdk18.0.1.1/65ae32619e2f40f3a9af3af1851d6e19/2/GPL/openjdk-18.0.1.1_macos-x64_bin.tar.gz
488 if [ "$(shasum -a 256 openjdk-18.0.1.1_macos-x64_bin.tar.gz | awk '{ print $1 }')" != "f02d17ec5a387555f8489abc352d973b6c10364409b597046025938e2266d72a" ]; then
494 tar xvvf ../openjdk-18.0.1.1_macos-x64_bin.tar.gz
495 - name: Fetch MacOS OpenJDK 18 for aarch64
497 curl -o openjdk-18.0.1.1_macos-aarch64_bin.tar.gz https://download.java.net/java/GA/jdk18.0.1.1/65ae32619e2f40f3a9af3af1851d6e19/2/GPL/openjdk-18.0.1.1_macos-aarch64_bin.tar.gz
498 if [ "$(shasum -a 256 openjdk-18.0.1.1_macos-aarch64_bin.tar.gz | awk '{ print $1 }')" != "29773ad68063bdad7fbaeb762cd873d3f243e86de380d3ac5335cdb929371fb5" ]; then
504 tar xvvf ../openjdk-18.0.1.1_macos-aarch64_bin.tar.gz
505 - name: Build MacOS aarch64 Java leaktracking Release Bindings
507 MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers"
508 JAVA_HOME=jdk-aarch64/jdk-18.0.1.1.jdk/Contents/Home
509 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
510 CC=clang LDK_TARGET=aarch64-apple-darwin LDK_TARGET_CPU=apple-a14 ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$MACOS_SDK" leaks false
511 mv src/main/resources/liblightningjni_MacOSX-aarch64.nativelib src/main/resources/liblightningjni_MacOSX-aarch64-leaktracking.nativelib
512 - name: Build MacOS x86_64 Java leaktracking Release Bindings
514 MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers"
515 JAVA_HOME=jdk-x86_64/jdk-18.0.1.1.jdk/Contents/Home
516 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
517 CC=clang LDK_TARGET=x86_64-apple-darwin LDK_TARGET_CPU=sandybridge ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$MACOS_SDK" leaks false
518 mv src/main/resources/liblightningjni_MacOSX-x86_64.nativelib src/main/resources/liblightningjni_MacOSX-x86_64-leaktracking.nativelib
519 - name: Build MacOS aarch64 Java Release Bindings
521 MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers"
522 JAVA_HOME=jdk-aarch64/jdk-18.0.1.1.jdk/Contents/Home
523 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
524 CC=clang LDK_TARGET=aarch64-apple-darwin LDK_TARGET_CPU=apple-a14 ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$MACOS_SDK" false false
525 - name: Build MacOS x86_64 Java Release Bindings
527 MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers"
528 JAVA_HOME=jdk-x86_64/jdk-18.0.1.1.jdk/Contents/Home
529 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
530 CC=clang LDK_TARGET=x86_64-apple-darwin LDK_TARGET_CPU=sandybridge ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$MACOS_SDK" false false
531 - name: Checkout latest binaries
533 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
534 echo "Fetching deterministic binaries for LDK-GC ${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
535 # Gitweb only allows snapshots of folders by providing the object hash, which we have to extract:
536 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)"
537 curl -o bins-snapshot.tgz "https://git.bitcoin.ninja${SNAPSHOT_LINK}"
538 mkdir -p ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
539 cd ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
540 tar xvvf ../../bins-snapshot.tgz
541 mv ldk-java-bins-*/* ./
542 rm -r ldk-java-bins-*
544 - name: Check latest MacOS libraries are in the bins repo
547 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
548 for F in liblightningjni_MacOSX-{x86_64,aarch64}{,-leaktracking}.nativelib; do
549 if ! diff "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/$F" "src/main/resources/$F"; then
550 apt-get -y install diffoscope
551 # Sadly these binaries are still non-deterministic, but only due
552 # to a few-byte tag, thus we use diffoscope to ensure there
553 # aren't any "real" differences and move on.
554 diffoscope "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/$F" "src/main/resources/$F" || echo
559 runs-on: ubuntu-latest
560 # Frankly, I'm not really sure why debian and ubuntu differ in the results here, they really shouldn't
561 container: debian:bookworm
565 - name: Install rust targets
568 apt-get -y dist-upgrade
569 apt-get -y install git g++ clang faketime zip unzip curl openjdk-17-jdk
570 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
574 # Temporarily use 1.67.1 to fix https://github.com/rust-lang/rust/issues/108943
575 rustup install 1.67.1
576 rustup default 1.67.1
577 rustup target add armv7-linux-androideabi
578 rustup target add aarch64-linux-android
579 rustup target add i686-linux-android
580 rustup target add x86_64-linux-android
581 - name: Checkout source code
582 uses: actions/checkout@v2
585 - name: Install android NDK compilers
587 git config --global safe.directory '*'
588 curl https://dl.google.com/android/repository/android-ndk-r22b-linux-x86_64.zip > android-ndk-r22b-linux-x86_64.zip
589 if [ "$(sha256sum android-ndk-r22b-linux-x86_64.zip | awk '{ print $1 }')" != "ac3a0421e76f71dd330d0cd55f9d99b9ac864c4c034fc67e0d671d022d4e806b" ]; then
593 unzip android-ndk-r22b-linux-x86_64.zip
594 - name: Install cbindgen
597 cargo install cbindgen
598 - name: Checkout Rust-Lightning and LDK-C-Bindings git
600 git config --global user.email "ldk-ci@example.com"
601 git config --global user.name "LDK CI"
602 # Note this is a different endpoint, as we need one non-upstream commit!
603 git clone https://github.com/lightningdevkit/rust-lightning
605 git checkout origin/0.0.118-bindings
607 git clone https://github.com/lightningdevkit/ldk-c-bindings
610 cd lightning-c-bindings
612 cargo update -p memchr --precise "2.5.0" --verbose
613 - name: Checkout Android AAR binaries and artifacts
615 # Gitweb only allows snapshots of folders by providing the object hash, which we have to extract:
616 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
617 echo "Fetching deterministic binaries for LDK-GC ${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
618 RELEASE_PAGE="https://git.bitcoin.ninja/index.cgi?p=ldk-java-bins;a=tree;f=${LDK_GARBAGECOLLECTED_GIT_OVERRIDE};hb=refs/heads/main"
619 SNAPSHOT_LINK="$(curl "$RELEASE_PAGE" | grep snapshot | grep -o 'href="[a-zA-Z0-9/?\.=;\-]*"' | sed 's/href="//' | tr -d '"' | grep snapshot)"
620 curl -o bins-snapshot.tgz "https://git.bitcoin.ninja${SNAPSHOT_LINK}"
622 ANDROID_PAGE="https://git.bitcoin.ninja/index.cgi?p=ldk-java-bins;a=tree;f=android-artifacts;hb=refs/heads/main"
623 SNAPSHOT_LINK="$(curl "$ANDROID_PAGE" | grep snapshot | grep -o 'href="[a-zA-Z0-9/?\.=;\-]*"' | sed 's/href="//' | tr -d '"' | grep snapshot)"
624 curl -o android-snapshot.tgz "https://git.bitcoin.ninja${SNAPSHOT_LINK}"
626 mkdir -p ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
627 cd ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
628 tar xvvf ../../bins-snapshot.tgz
629 mv ldk-java-bins-*/* ./
630 rm -r ldk-java-bins-*
632 mkdir -p ../android-artifacts
633 cd ../android-artifacts
634 tar xvvf ../../android-snapshot.tgz
635 mv ldk-java-bins-*/* ./
636 rm -r ldk-java-bins-*
637 - name: Build Android aar
640 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
641 cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-classes.jar" ./
642 export ANDROID_TOOLCHAIN="$(pwd)/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64"
643 export PATH="$PATH:$ANDROID_TOOLCHAIN/bin"
644 ./android-build.sh ./rust-lightning ./ldk-c-bindings/ ./ldk-java-bins/android-artifacts
645 - name: Check latest library and jars are in bins repo
647 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
648 if ! diff LDK-release.aar "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"LDK-release.aar; then
649 apt-get -y install diffoscope
650 diffoscope LDK-release.aar "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/LDK-release.aar"
662 runs-on: ${{ matrix.platform }}
664 - name: Install Rust components
666 rustup target install aarch64-apple-darwin
667 rustup component add rust-src
668 - name: Checkout source code
669 uses: actions/checkout@v2
672 - name: Install cbindgen
673 run: cargo install cbindgen
674 - name: Checkout Rust-Lightning and LDK-C-Bindings git
676 git config --global user.email "ldk-ci@example.com"
677 git config --global user.name "LDK CI"
678 # Note this is a different endpoint, as we need one non-upstream commit!
679 git clone https://github.com/rghtningdevkit/ust-lightning
681 git checkout origin/0.0.118-bindings
683 git clone https://github.com/lightningdevkit/ldk-c-bindings
686 cd lightning-c-bindings
687 cargo update -p memchr --precise "2.5.0" --verbose
688 - name: Rebuild C bindings and check the sample app builds + links
691 CC=clang ./genbindings.sh ../rust-lightning true
692 - name: Fetch OpenJDK 18
694 if [ "$(uname -m)" = "arm64" ]; then
695 wget -O openjdk-18.0.1.1_macos-aarch64_bin.tar.gz https://download.java.net/java/GA/jdk18.0.1.1/65ae32619e2f40f3a9af3af1851d6e19/2/GPL/openjdk-18.0.1.1_macos-aarch64_bin.tar.gz
696 if [ "$(shasum -a 256 openjdk-18.0.1.1_macos-aarch64_bin.tar.gz | awk '{ print $1 }')" != "29773ad68063bdad7fbaeb762cd873d3f243e86de380d3ac5335cdb929371fb5" ]; then
700 tar xvvf openjdk-18.0.1.1_macos-aarch64_bin.tar.gz
702 wget -O openjdk-18.0.1.1_macos-x64_bin.tar.gz https://download.java.net/java/GA/jdk18.0.1.1/65ae32619e2f40f3a9af3af1851d6e19/2/GPL/openjdk-18.0.1.1_macos-x64_bin.tar.gz
703 if [ "$(shasum -a 256 openjdk-18.0.1.1_macos-x64_bin.tar.gz | awk '{ print $1 }')" != "f02d17ec5a387555f8489abc352d973b6c10364409b597046025938e2266d72a" ]; then
707 tar xvvf openjdk-18.0.1.1_macos-x64_bin.tar.gz
709 - name: Checkout latest Linux binaries
711 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
712 echo "Fetching deterministic binaries for LDK-GC ${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
713 # Gitweb only allows snapshots of folders by providing the object hash, which we have to extract:
714 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)"
715 wget -O bins-snapshot.tgz "https://git.bitcoin.ninja${SNAPSHOT_LINK}"
716 mkdir -p ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
717 cd ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}"
718 tar xvvf ../../bins-snapshot.tgz
719 mv ldk-java-bins-*/* ./
721 mkdir -p src/main/resources/
722 cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/liblightningjni_Linux-"* src/main/resources/
723 - name: Build Java Release Bindings
725 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
726 export JAVA_HOME=`pwd`/jdk-18.0.1.1.jdk/Contents/Home
727 export PATH=$JAVA_HOME/bin:$PATH
728 ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$(xcrun --show-sdk-path)" false false
730 if [ "${{ matrix.platform }}" = "macos-11" ]; then
731 export CC="clang --target=aarch64-apple-darwin"
732 export LDK_TARGET=aarch64-apple-darwin
733 export LDK_TARGET_CPU=apple-a14
734 ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$(xcrun --show-sdk-path)" false false
735 cat src/main/resources/liblightningjni_MacOSX-aarch64.nativelib > /dev/null
738 - name: Fetch Maven 3.8.4
740 # We don't bother using the upstream mirrors as they remove prior
741 # releases aggressively, causing spurious CI failures when we don't
742 # care about the version used.
743 wget -O apache-maven-3.8.4-bin.tar.gz https://bitcoin.ninja/apache-maven-3.8.4-bin.tar.gz
744 if [ "$(shasum -a 256 apache-maven-3.8.4-bin.tar.gz | awk '{ print $1 }')" != "2cdc9c519427bb20fdc25bef5a9063b790e4abd930e7b14b4e9f4863d6f9f13c" ]; then
748 tar xvvf apache-maven-3.8.4-bin.tar.gz
749 export PATH=apache-maven-3.8.4/bin:$PATH
750 - name: Run Java Tests against built jar
752 export JAVA_HOME=`pwd`/jdk-18.0.1.1.jdk/Contents/Home
753 export PATH=$JAVA_HOME/bin:$PATH
754 mvn -DskipTests=true package
755 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
756 JAR_VERSION=${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}
757 mvn install:install-file -Dfile=target/ldk-java-${JAR_VERSION}.jar -DgroupId=org.lightningdevkit -DartifactId=ldk-java -Dversion=1.0-SNAPSHOT -Dpackaging=jar
760 java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar
761 - name: Run Java Tests against release bins
763 export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
764 export JAVA_HOME=`pwd`/jdk-18.0.1.1.jdk/Contents/Home
765 export PATH=$JAVA_HOME/bin:$PATH
766 cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java.jar" ./
767 mvn install:install-file -Dfile=ldk-java.jar -DgroupId=org.lightningdevkit -DartifactId=ldk-java -Dversion=1.0-SNAPSHOT -Dpackaging=jar
771 java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar