]> git.bitcoin.ninja Git - ldk-java/commitdiff
[C#] Run tests against release dylib on OSX in CI
authorMatt Corallo <git@bluematt.me>
Thu, 6 Jun 2024 14:06:31 +0000 (14:06 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 7 Jun 2024 02:00:36 +0000 (02:00 +0000)
.github/workflows/build.yml

index 97bf61afe7484775ab68077137ced1c955ecce68..e7740794cce4081db740728b1f4979e115385697 100644 (file)
@@ -266,6 +266,48 @@ jobs:
           LD_LIBRARY_PATH=. dotnet run --project tests.csproj
           LD_LIBRARY_PATH=. dotnet run --project tests.csproj --configuration Release
 
+  osx_c_sharp:
+    strategy:
+      matrix:
+        include:
+          - platform: macos-13
+          - platform: macos-14
+      fail-fast: false
+    runs-on: ${{ matrix.platform }}
+    steps:
+      - name: Checkout source code
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+      - name: Setup .NET
+        uses: actions/setup-dotnet@v4
+        with:
+          dotnet-version: '6.0.x'
+      - name: Checkout latest binaries
+        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="$(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)"
+          wget -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-*/* ./
+          unzip org.ldk.nupkg
+      - name: Run test against C# release library
+        shell: bash
+        run: |
+          export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
+          cd c_sharp
+          if [ "$(uname -m)" = "arm64" ]; then
+            cp "../ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/runtimes/osx-arm64/native/libldkcsharp.dylib" ./libldkcsharp.dylib
+          else
+            cp "../ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/runtimes/osx-x64/native/libldkcsharp.dylib" ./libldkcsharp.dylib
+          fi
+          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.