X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=.github%2Fworkflows%2Fbuild.yml;h=4dea1a4934ec6bc78c563a54beb8d58d6436f40a;hb=HEAD;hp=2afaaa91226c2666eb674f1f9523a10c1b304556;hpb=94ae3f5ecc951f3d527f97ea10a8a4d897e6b696;p=ldk-java diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2afaaa91..962bcbeb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,11 +40,13 @@ jobs: # Note this is a different endpoint, as we need one non-upstream commit! git clone https://github.com/lightningdevkit/rust-lightning cd rust-lightning - git checkout origin/0.0.117-bindings + git checkout origin/0.0.123-bindings cd .. git clone https://github.com/lightningdevkit/ldk-c-bindings cd ldk-c-bindings - git checkout 0.0.117 + git checkout 0.0.123 + cd lightning-c-bindings + cargo update -p memchr --precise "2.5.0" --verbose - name: Rebuild C bindings without STD run: | cd ldk-c-bindings @@ -102,11 +104,173 @@ jobs: git checkout node-net/package.json git diff --exit-code + c_sharp_bindings: + runs-on: ubuntu-latest + # Ubuntu's version of clang doesn't support....anything that should work. + # Ubuntu is an utter trash OS and should generally never be used for anything. + # We also require at least rustc 1.51 (ie https://github.com/rust-lang/rust/pull/79998), + # so we use debian testing + container: debian:bookworm + strategy: + fail-fast: false + steps: + - name: Install required dependencies + run: | + apt-get update + apt-get -y dist-upgrade + apt-get -y install cargo lld llvm git g++ clang curl python3 mono-devel + - name: Checkout source code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Install cbindgen + run: | + git clone https://github.com/eqrion/cbindgen + cd cbindgen/ + git checkout v0.20.0 + cargo update -p indexmap --precise "1.6.2" --verbose + cargo install --locked --path . + - name: Checkout Rust-Lightning and LDK-C-Bindings git + run: | + git config --global safe.directory '*' + git config --global user.email "ldk-ci@example.com" + git config --global user.name "LDK CI" + # Note this is a different endpoint, as we need one non-upstream commit! + git clone https://github.com/lightningdevkit/rust-lightning + cd rust-lightning + git checkout origin/0.0.123-bindings + cd .. + git clone https://github.com/lightningdevkit/ldk-c-bindings + cd ldk-c-bindings + git checkout 0.0.123 + cd lightning-c-bindings + cargo update -p memchr --precise "2.5.0" --verbose + - name: Rebuild C bindings with STD + run: | + cd ldk-c-bindings + git config --global safe.directory "*" + ./genbindings.sh ../rust-lightning true + - name: Build and Test C# Debug Bindings + run: | + ./genbindings.sh ./ldk-c-bindings/ c_sharp true true + 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 + ln -s libldkcsharp_debug_Linux-amd64.so libldkcsharp.so + export ASAN_OPTIONS=detect_leaks=0 + LD_PRELOAD=/usr/lib/llvm-14/lib/clang/14.0.6/lib/linux/libclang_rt.asan-x86_64.so mono test.exe + + c_sharp_determinism: + runs-on: ubuntu-latest + # Ubuntu's version of clang doesn't support....anything that should work. + # Ubuntu is an utter trash OS and should generally never be used for anything. + # We also require dotnet so we use fedora + container: fedora:39 + strategy: + fail-fast: false + steps: + - name: Install required dependencies + run: | + dnf install -y mingw64-gcc git cargo dotnet clang llvm lld faketime rust-std-static-x86_64-pc-windows-gnu which diffutils rust-src + - name: Checkout source code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Install cbindgen + run: | + cargo install cbindgen + - name: Checkout Rust-Lightning and LDK-C-Bindings git + run: | + git config --global safe.directory '*' + git config --global user.email "ldk-ci@example.com" + git config --global user.name "LDK CI" + # Note this is a different endpoint, as we need one non-upstream commit! + git clone https://github.com/lightningdevkit/rust-lightning + cd rust-lightning + git checkout origin/0.0.123-bindings + cd .. + git clone https://github.com/lightningdevkit/ldk-c-bindings + cd ldk-c-bindings + git checkout 0.0.123 + - name: Fetch MacOS SDK + run: | + 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 + tar xvvf Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz + - name: Rebuild C bindings with STD + run: | + export MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers" + cd ldk-c-bindings + export LDK_C_BINDINGS_EXTRA_TARGETS=x86_64-pc-windows-gnu + export LDK_C_BINDINGS_EXTRA_TARGET_CCS=`pwd`/deterministic-build-wrappers/clang-x86_64-windows + export LDK_C_BINDINGS_EXTRA_TARGET_LINK_LTO=true + ./genbindings.sh ../rust-lightning true + - name: Remove checked-in source to ensure its correctly checked-in + run: rm c_sharp/src/org/ldk/enums/*.cs c_sharp/src/org/ldk/impl/*.cs c_sharp/src/org/ldk/structs/*.cs + - name: Build Windows C# Bindings + run: | + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" + LDK_TARGET=x86_64-pc-windows-gnu LDK_TARGET_CPU=sandybridge ./genbindings.sh ./ldk-c-bindings/ c_sharp false false + - name: Build Linux C# Bindings + run: | + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" + ./genbindings.sh ./ldk-c-bindings/ c_sharp false false + - name: Build macOS x86-64 C# Bindings + run: | + export MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" + CC=clang LDK_TARGET=x86_64-apple-darwin LDK_TARGET_CPU=sandybridge ./genbindings.sh ./ldk-c-bindings/ c_sharp false false + - name: Build macOS aarch64 C# Bindings + run: | + export MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" + CC=clang LDK_TARGET=aarch64-apple-darwin LDK_TARGET_CPU=apple-a14 ./genbindings.sh ./ldk-c-bindings/ c_sharp false false + - name: Build Release NUPKG + run: | + cd c_sharp + ./build-release-nupkg.sh + - uses: actions/upload-artifact@v3 + with: + name: org.ldk.nupkg + path: c_sharp/org.ldk.nupkg + - name: Check latest auto-generated code is in git + run: | + # Checkout files that get updated with version information + git checkout c_sharp/packaging_artifacts/package/services/metadata/core-properties/ldk.psmdcp + git checkout c_sharp/packaging_artifacts/org.ldk.nuspec + git diff --exit-code + - name: Checkout latest binaries + shell: bash + run: | + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" + echo "Fetching deterministic binaries for LDK-GC ${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}" + # Gitweb only allows snapshots of folders by providing the object hash, which we have to extract: + 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)" + curl -o bins-snapshot.tgz "https://git.bitcoin.ninja${SNAPSHOT_LINK}" + mkdir -p ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}" + cd ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}" + tar xvvf ../../bins-snapshot.tgz + mv ldk-java-bins-*/* ./ + rm -r ldk-java-bins-* + - name: Compare C# nupkg with built one + shell: bash + run: | + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" + if ! diff ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"org.ldk.nupkg c_sharp/org.ldk.nupkg; then + dnf -y install diffoscope mono-devel + diffoscope ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"org.ldk.nupkg c_sharp/org.ldk.nupkg || echo + exit 1 + fi + - name: Run test against C# release library + shell: bash + run: | + cd c_sharp + ln -s ./packaging_artifacts/runtimes/linux-x64/native/libldkcsharp.so ./ + LD_LIBRARY_PATH=. dotnet run --project tests.csproj + LD_LIBRARY_PATH=. dotnet run --project tests.csproj --configuration Release + java_bindings: runs-on: ubuntu-latest # Ubuntu's version of rustc uses its own LLVM instead of being a real native package. # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS. - container: debian:bullseye + container: debian:bookworm strategy: fail-fast: false steps: @@ -114,7 +278,7 @@ jobs: run: | apt-get update apt-get -y dist-upgrade - apt-get -y install cargo valgrind lld git g++ clang openjdk-11-jdk maven faketime zip unzip llvm curl + apt-get -y install cargo valgrind lld git g++ clang openjdk-17-jdk maven faketime zip unzip llvm curl - name: Checkout source code uses: actions/checkout@v2 with: @@ -134,11 +298,13 @@ jobs: # Note this is a different endpoint, as we need one non-upstream commit! git clone https://github.com/lightningdevkit/rust-lightning cd rust-lightning - git checkout origin/0.0.117-bindings + git checkout origin/0.0.123-bindings cd .. git clone https://github.com/lightningdevkit/ldk-c-bindings cd ldk-c-bindings - git checkout 0.0.117 + git checkout 0.0.123 + cd lightning-c-bindings + cargo update -p memchr --precise "2.5.0" --verbose - name: Pin proc-macro and quote to meet MSRV run: | cd ldk-c-bindings/c-bindings-gen @@ -149,15 +315,15 @@ jobs: cd ldk-c-bindings ./genbindings.sh ../rust-lightning true - name: Build Java 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 + 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 - name: Run Java Tests against Debug Bindings run: | mv liblightningjni_debug_Linux-amd64.so liblightningjni.so export ASAN_OPTIONS=detect_leaks=0 - LD_PRELOAD=/usr/lib/llvm-11/lib/clang/11.0.1/lib/linux/libclang_rt.asan-x86_64.so LD_LIBRARY_PATH=. mvn test + LD_PRELOAD=/usr/lib/llvm-14/lib/clang/14.0.6/lib/linux/libclang_rt.asan-x86_64.so LD_LIBRARY_PATH=. mvn test - name: Build Java 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 + ./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 - name: Check latest headers are in git run: | git checkout pom.xml @@ -167,7 +333,7 @@ jobs: runs-on: ubuntu-latest # Ubuntu's version of rustc uses its own LLVM instead of being a real native package. # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS. - container: debian:bullseye + container: debian:bookworm strategy: fail-fast: false steps: @@ -175,7 +341,7 @@ jobs: run: | apt-get update apt-get -y dist-upgrade - apt-get -y install cargo valgrind lld git g++ clang openjdk-11-jdk maven faketime zip unzip llvm curl + apt-get -y install cargo valgrind lld git g++ clang openjdk-17-jdk maven faketime zip unzip llvm curl - name: Checkout source code uses: actions/checkout@v2 with: @@ -195,11 +361,13 @@ jobs: # Note this is a different endpoint, as we need one non-upstream commit! git clone https://github.com/lightningdevkit/rust-lightning cd rust-lightning - git checkout origin/0.0.117-bindings + git checkout origin/0.0.123-bindings cd .. git clone https://github.com/lightningdevkit/ldk-c-bindings cd ldk-c-bindings - git checkout 0.0.117 + git checkout 0.0.123 + cd lightning-c-bindings + cargo update -p memchr --precise "2.5.0" --verbose - name: Pin proc-macro and quote to meet MSRV run: | cd ldk-c-bindings/c-bindings-gen @@ -232,7 +400,7 @@ jobs: - name: Build Leaktracking Java Release Bindings run: | export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" - ./genbindings.sh ./ldk-c-bindings/ "-I/usr/lib/jvm/java-11-openjdk-amd64/include/ -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux/" leaks false + ./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 - name: Build deterministic release jar run: | ./build-release-jar.sh @@ -242,30 +410,42 @@ jobs: run: | export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/liblightningjni_MacOSX-"{aarch64,x86_64}.nativelib src/main/resources/ + - name: Build Java leaktracking Bindings + run: | + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" + ./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 + mkdir ldk-java-bins/new/ + cp src/main/resources/liblightningjni_Linux-amd64.nativelib ldk-java-bins/new/liblightningjni_Linux-amd64-leaktracking.nativelib - name: Build Java Release Bindings run: | export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" - ./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 + ./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 - name: Build deterministic release jar run: ./build-release-jar.sh + - uses: actions/upload-artifact@v3 + with: + name: ldk-java.jar + path: ldk-java.jar + - uses: actions/upload-artifact@v3 + with: + name: ldk-java-leaktracking.jar + path: ldk-java-leaktracking.jar - name: Check latest library and jars are in bins repo run: | export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" - mkdir ldk-java-bins/new/ cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_Mac*.nativelib ldk-java-bins/new/ cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"LDK-release.aar ldk-java-bins/new/ + cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"org.ldk.nupkg ldk-java-bins/new/ cp src/main/resources/liblightningjni_Linux-amd64.nativelib ldk-java-bins/new/ cp ldk-java-sources.jar ldk-java-bins/new/ cp ldk-java.jar ldk-java-bins/new/ cp ldk-java-leaktracking.jar ldk-java-bins/new/ cp ldk-java-classes.jar ldk-java-bins/new/ - cp ldk-java-javadoc.jar ldk-java-bins/new/ cd ldk-java-bins rm "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/liblightningjs.wasm" # TODO: Test this if ! diff -r "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/" new/; then apt-get -y install diffoscope diffoscope new/ldk-java-sources.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-sources.jar" || echo - diffoscope new/ldk-java-javadoc.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-javadoc.jar" || echo diffoscope new/ldk-java-classes.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-classes.jar" || echo diffoscope new/ldk-java.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java.jar" || echo diffoscope new/ldk-java-leaktracking.jar "${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-leaktracking.jar" || echo @@ -310,11 +490,11 @@ jobs: # Note this is a different endpoint, as we need one non-upstream commit! git clone https://github.com/lightningdevkit/rust-lightning cd rust-lightning - git checkout origin/0.0.117-bindings + git checkout origin/0.0.123-bindings cd .. git clone https://github.com/lightningdevkit/ldk-c-bindings cd ldk-c-bindings - git checkout 0.0.117 + git checkout 0.0.123 - name: Fetch MacOS SDK run: | 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 @@ -403,7 +583,7 @@ jobs: android: runs-on: ubuntu-latest # Frankly, I'm not really sure why debian and ubuntu differ in the results here, they really shouldn't - container: debian:bullseye + container: debian:bookworm strategy: fail-fast: false steps: @@ -411,7 +591,7 @@ jobs: run: | apt-get update apt-get -y dist-upgrade - apt-get -y install git g++ clang faketime zip unzip curl openjdk-11-jdk + apt-get -y install git g++ clang faketime zip unzip curl openjdk-17-jdk curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh chmod +x ./rustup.sh ./rustup.sh -y @@ -447,11 +627,14 @@ jobs: # Note this is a different endpoint, as we need one non-upstream commit! git clone https://github.com/lightningdevkit/rust-lightning cd rust-lightning - git checkout origin/0.0.117-bindings + git checkout origin/0.0.123-bindings cd .. git clone https://github.com/lightningdevkit/ldk-c-bindings cd ldk-c-bindings - git checkout 0.0.117 + git checkout 0.0.123 + cd lightning-c-bindings + . $HOME/.cargo/env + cargo update -p memchr --precise "2.5.0" --verbose - name: Checkout Android AAR binaries and artifacts run: | # Gitweb only allows snapshots of folders by providing the object hash, which we have to extract: @@ -484,6 +667,10 @@ jobs: export ANDROID_TOOLCHAIN="$(pwd)/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64" export PATH="$PATH:$ANDROID_TOOLCHAIN/bin" ./android-build.sh ./rust-lightning ./ldk-c-bindings/ ./ldk-java-bins/android-artifacts + - uses: actions/upload-artifact@v3 + with: + name: LDK-release.aar + path: LDK-release.aar - name: Check latest library and jars are in bins repo run: | export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" @@ -518,13 +705,15 @@ jobs: git config --global user.email "ldk-ci@example.com" git config --global user.name "LDK CI" # Note this is a different endpoint, as we need one non-upstream commit! - git clone https://github.com/rghtningdevkit/ust-lightning + git clone https://github.com/lightningdevkit/rust-lightning cd rust-lightning - git checkout origin/0.0.117-bindings + git checkout origin/0.0.123-bindings cd .. git clone https://github.com/lightningdevkit/ldk-c-bindings cd ldk-c-bindings - git checkout 0.0.117 + git checkout 0.0.123 + cd lightning-c-bindings + cargo update -p memchr --precise "2.5.0" --verbose - name: Rebuild C bindings and check the sample app builds + links run: | cd ldk-c-bindings