From 726616cc827293fc4a1f9ef8ada4d49ad939d6e9 Mon Sep 17 00:00:00 2001 From: Ayush Thakur Date: Wed, 26 Aug 2026 13:11:57 +0530 Subject: [PATCH] feat(ci): build the linux-arm64 native for the .NET and JVM bindings The chat_xdk_dotnet cdylib ships for osx-arm64, osx-x64, linux-x64 and win-x64, so the JVM and .NET bindings cannot run on 64-bit ARM Linux -- AWS Graviton, Ampere, and ARM CI runners. On Linux/aarch64 detectRid() returns null, no bundled native is extracted, and the load falls through to a system lookup that finds nothing. The Python job already builds aarch64-unknown-linux-gnu on ubuntu-24.04-arm, so the target and the runner are already proven here. Since dotnet-build also feeds the java job, one matrix entry covers both bindings. - add the linux-arm64 entry to the dotnet-build matrix - stage it alongside the other RIDs for both the nupkg and the jar - require it in the jar verification list - return linux-arm64 from detectRid() on Linux/ARM --- .github/workflows/release.yml | 9 +++++++-- .../src/main/java/com/x/chatxdk/NativeLoader.java | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97034d3..9a283e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -429,6 +429,10 @@ jobs: rust_target: x86_64-unknown-linux-gnu rid: linux-x64 lib: libchat_xdk_dotnet.so + - runs_on: ubuntu-24.04-arm + rust_target: aarch64-unknown-linux-gnu + rid: linux-arm64 + lib: libchat_xdk_dotnet.so - runs_on: windows-latest rust_target: x86_64-pc-windows-msvc rid: win-x64 @@ -489,7 +493,7 @@ jobs: run: | set -euo pipefail base=crates/dotnet/dotnet/ChatXdk/runtimes - for rid in osx-arm64 osx-x64 linux-x64 win-x64; do + for rid in osx-arm64 osx-x64 linux-x64 linux-arm64 win-x64; do mkdir -p "$base/$rid/native" cp artifacts/dotnet-native-$rid/* "$base/$rid/native/" done @@ -542,7 +546,7 @@ jobs: run: | set -euo pipefail base=crates/jvm/java/chatxdk/src/main/resources/native - for rid in osx-arm64 osx-x64 linux-x64 win-x64; do + for rid in osx-arm64 osx-x64 linux-x64 linux-arm64 win-x64; do mkdir -p "$base/$rid" cp artifacts/dotnet-native-"$rid"/* "$base/$rid/" done @@ -560,6 +564,7 @@ jobs: native/osx-arm64/libchat_xdk_dotnet.dylib \ native/osx-x64/libchat_xdk_dotnet.dylib \ native/linux-x64/libchat_xdk_dotnet.so \ + native/linux-arm64/libchat_xdk_dotnet.so \ native/win-x64/chat_xdk_dotnet.dll \ META-INF/LICENSE \ META-INF/THIRD_PARTY_NOTICES.md; do diff --git a/crates/jvm/java/chatxdk/src/main/java/com/x/chatxdk/NativeLoader.java b/crates/jvm/java/chatxdk/src/main/java/com/x/chatxdk/NativeLoader.java index 4bc6d3b..d5eed33 100644 --- a/crates/jvm/java/chatxdk/src/main/java/com/x/chatxdk/NativeLoader.java +++ b/crates/jvm/java/chatxdk/src/main/java/com/x/chatxdk/NativeLoader.java @@ -61,7 +61,7 @@ private static Path extractBundledLibrary() throws IOException { return out; } - /** RID labels aligned with the .NET / CI matrix: osx-arm64, osx-x64, linux-x64, win-x64. */ + /** RID labels aligned with the .NET / CI matrix: osx-arm64, osx-x64, linux-x64, linux-arm64, win-x64. */ static String detectRid() { String os = System.getProperty("os.name", "").toLowerCase(Locale.ROOT); String arch = System.getProperty("os.arch", "").toLowerCase(Locale.ROOT); @@ -76,6 +76,9 @@ static String detectRid() { return "osx-x64"; } } else if (os.contains("linux")) { + if (arm) { + return "linux-arm64"; + } if (x64) { return "linux-x64"; }