[Java] Drop legacy glibc support in release builds
[ldk-java] / .github / workflows / build.yml
index f0c611ee726ab1f70b7a34bfcc77d7558aca8f34..32895fcd0a483f7c8cd6e6393af805bfa766de7b 100644 (file)
@@ -38,13 +38,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://git.bitcoin.ninja/rust-lightning
+          git clone https://github.com/lightningdevkit/rust-lightning
           cd rust-lightning
-          git checkout origin/2023-04-0.0.115-java-bindings
+          git checkout origin/0.0.118-bindings
           cd ..
           git clone https://github.com/lightningdevkit/ldk-c-bindings
           cd ldk-c-bindings
-          git checkout 0.0.115
+          git checkout 0.0.118
+          cd lightning-c-bindings
+          cargo update -p memchr --precise "2.5.0" --verbose
       - name: Rebuild C bindings without STD
         run: |
           cd ldk-c-bindings
@@ -71,8 +73,8 @@ jobs:
           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
           mkdir -p $HOME/.cache/ms-playwright # `playwright install` is too dumb to create this for us
           chmod -R 777 $HOME/
-          npm i -D playwright
-          npx playwright install
+          npm i -D playwright@1.37.0-alpha-jul-31-2023
+          npx playwright@1.37.0-alpha-jul-31-2023 install
       - name: Build and Test TS Debug Bindings for Web
         run: |
           export HOME=/root/ # Github actions is apparently broken
@@ -106,7 +108,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:
@@ -114,7 +116,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:
@@ -132,27 +134,34 @@ 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://git.bitcoin.ninja/rust-lightning
+          git clone https://github.com/lightningdevkit/rust-lightning
           cd rust-lightning
-          git checkout origin/2023-04-0.0.115-java-bindings
+          git checkout origin/0.0.118-bindings
           cd ..
           git clone https://github.com/lightningdevkit/ldk-c-bindings
           cd ldk-c-bindings
-          git checkout 0.0.115
+          git checkout 0.0.118
+          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
+          cargo update -p quote --precise "1.0.30" --verbose
+          cargo update -p proc-macro2 --precise "1.0.65" --verbose
       - name: Rebuild C bindings, and check the sample app builds + links
         run: |
           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
@@ -162,7 +171,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:
@@ -170,7 +179,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:
@@ -188,13 +197,20 @@ 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://git.bitcoin.ninja/rust-lightning
+          git clone https://github.com/lightningdevkit/rust-lightning
           cd rust-lightning
-          git checkout origin/2023-04-0.0.115-java-bindings
+          git checkout origin/0.0.118-bindings
           cd ..
           git clone https://github.com/lightningdevkit/ldk-c-bindings
           cd ldk-c-bindings
-          git checkout 0.0.115
+          git checkout 0.0.118
+          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
+          cargo update -p quote --precise "1.0.30" --verbose
+          cargo update -p proc-macro2 --precise "1.0.65" --verbose
       - name: Rebuild C bindings, and check the sample app builds + links
         run: |
           cd ldk-c-bindings
@@ -222,7 +238,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
@@ -235,7 +251,7 @@ jobs:
       - 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
       - name: Check latest library and jars are in bins repo
@@ -251,6 +267,7 @@ jobs:
           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
@@ -297,13 +314,13 @@ 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://git.bitcoin.ninja/rust-lightning
+          git clone https://github.com/lightningdevkit/rust-lightning
           cd rust-lightning
-          git checkout origin/2023-04-0.0.115-java-bindings
+          git checkout origin/0.0.118-bindings
           cd ..
           git clone https://github.com/lightningdevkit/ldk-c-bindings
           cd ldk-c-bindings
-          git checkout 0.0.115
+          git checkout 0.0.118
       - 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
@@ -392,7 +409,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:
@@ -400,7 +417,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
@@ -434,13 +451,16 @@ 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://git.bitcoin.ninja/rust-lightning
+          git clone https://github.com/lightningdevkit/rust-lightning
           cd rust-lightning
-          git checkout origin/2023-04-0.0.115-java-bindings
+          git checkout origin/0.0.118-bindings
           cd ..
           git clone https://github.com/lightningdevkit/ldk-c-bindings
           cd ldk-c-bindings
-          git checkout 0.0.115
+          git checkout 0.0.118
+          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:
@@ -492,23 +512,14 @@ jobs:
       fail-fast: false
     runs-on: ${{ matrix.platform }}
     steps:
-      - name: Install other Rust platforms
-        run: rustup target install aarch64-apple-darwin
+      - name: Install Rust components
+        run: |
+          rustup target install aarch64-apple-darwin
+          rustup component add rust-src
       - name: Checkout source code
         uses: actions/checkout@v2
         with:
           fetch-depth: 0
-      - name: Fetch upstream LLVM/clang snapshot
-        run: |
-          git config --global safe.directory '*'
-          wget -O clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz
-          if [ "$(shasum -a 256 clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz | awk '{ print $1 }')" != "d16b6d536364c5bec6583d12dd7e6cf841b9f508c4430d9ee886726bd9983f1c" ]; then
-            echo "Bad hash"
-            exit 1
-          fi
-      - name: Unpack upstream LLVM+clang and use it by default
-        run: |
-          tar xvvf clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz
       - name: Install cbindgen
         run: cargo install cbindgen
       - name: Checkout Rust-Lightning and LDK-C-Bindings git
@@ -516,20 +527,18 @@ 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://git.bitcoin.ninja/rust-lightning
+          git clone https://github.com/rghtningdevkit/ust-lightning
           cd rust-lightning
-          git checkout origin/2023-04-0.0.115-java-bindings
+          git checkout origin/0.0.118-bindings
           cd ..
           git clone https://github.com/lightningdevkit/ldk-c-bindings
           cd ldk-c-bindings
-          git checkout 0.0.115
-      - name: Rebuild C bindings with upstream clang, and check the sample app builds + links
+          git checkout 0.0.118
+          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: |
-          export PATH=`pwd`/clang+llvm-15.0.7-x86_64-apple-darwin21.0/bin:$PATH
           cd ldk-c-bindings
-          export CC=clang
-          export CC_x86_64_apple_darwin=clang
-          export CC_aarch64_apple_darwin=clang
           CC=clang ./genbindings.sh ../rust-lightning true
       - name: Fetch OpenJDK 18
         run: |
@@ -567,7 +576,6 @@ jobs:
           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
           export JAVA_HOME=`pwd`/jdk-18.0.1.1.jdk/Contents/Home
           export PATH=$JAVA_HOME/bin:$PATH
-          export PATH=`pwd`/clang+llvm-15.0.7-x86_64-apple-darwin21.0/bin:$PATH
           ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$(xcrun --show-sdk-path)" false false
 
           if [ "${{ matrix.platform }}" = "macos-11" ]; then
@@ -578,7 +586,6 @@ jobs:
             cat src/main/resources/liblightningjni_MacOSX-aarch64.nativelib > /dev/null
 
           fi
-
       - name: Fetch Maven 3.8.4
         run: |
           # We don't bother using the upstream mirrors as they remove prior