Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 40 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,52 @@ jobs:
cp src/MLXSharp.Native/runtimes/osx-arm64/native/libmlxsharp.dylib artifacts/native/

- name: Pack MLXSharp library
run: dotnet pack src/MLXSharp/MLXSharp.csproj --configuration Release --output artifacts/packages \
-p:MLXSharpMacNativeBinary=$GITHUB_WORKSPACE/native/build/libmlxsharp.dylib
run: |
set -euo pipefail
: "${GITHUB_WORKSPACE:=${PWD}}"
MAC_NATIVE_BINARY="${GITHUB_WORKSPACE}/native/build/libmlxsharp.dylib"
echo "Packing MLXSharp with native binary: ${MAC_NATIVE_BINARY}"
dotnet pack \
src/MLXSharp/MLXSharp.csproj \
--configuration Release \
--output artifacts/packages \
"/p:MLXSharpMacNativeBinary=${MAC_NATIVE_BINARY}"

- name: Pack MLXSharp.SemanticKernel library
run: dotnet pack src/MLXSharp.SemanticKernel/MLXSharp.SemanticKernel.csproj --configuration Release --output artifacts/packages \
-p:MLXSharpMacNativeBinary=$GITHUB_WORKSPACE/native/build/libmlxsharp.dylib
run: |
set -euo pipefail
: "${GITHUB_WORKSPACE:=${PWD}}"
MAC_NATIVE_BINARY="${GITHUB_WORKSPACE}/native/build/libmlxsharp.dylib"
echo "Packing MLXSharp.SemanticKernel with native binary: ${MAC_NATIVE_BINARY}"
dotnet pack \
src/MLXSharp.SemanticKernel/MLXSharp.SemanticKernel.csproj \
--configuration Release \
--output artifacts/packages \
"/p:MLXSharpMacNativeBinary=${MAC_NATIVE_BINARY}"

- name: Verify package contains native libraries
run: |
echo "Checking package contents..."
if unzip -l artifacts/packages/*.nupkg | grep -q "runtimes/osx-arm64/native/libmlxsharp.dylib"; then
echo "✓ Native library found in package"
else
echo "✗ ERROR: Native library NOT found in package!"
echo "Package contents:"
unzip -l artifacts/packages/*.nupkg
shopt -s nullglob
packages=(artifacts/packages/*.nupkg)
if [ ${#packages[@]} -eq 0 ]; then
echo "✗ ERROR: No packages were produced"
exit 1
fi

missing=0
for package in "${packages[@]}"; do
echo "Inspecting ${package}"
if unzip -l "${package}" | grep -q "runtimes/osx-arm64/native/libmlxsharp.dylib"; then
echo " ✓ Native library found"
else
echo " ✗ Native library NOT found"
unzip -l "${package}"
missing=1
fi
done

if [ $missing -ne 0 ]; then
exit 1
fi

Expand Down
5 changes: 3 additions & 2 deletions src/MLXSharp/MLXSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
</ItemGroup>

<PropertyGroup>
<MLXSharpMacNativeBinary Condition="'$(MLXSharpMacNativeBinary)' == ''">$(MSBuildProjectDirectory)..\..\native\build\libmlxsharp.dylib</MLXSharpMacNativeBinary>
<MLXSharpMacNativeDestination>..\MLXSharp.Native\runtimes\osx-arm64\native\libmlxsharp.dylib</MLXSharpMacNativeDestination>
<MLXProjectRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\'))</MLXProjectRoot>
<MLXSharpMacNativeBinary Condition="'$(MLXSharpMacNativeBinary)' == ''">$([System.IO.Path]::Combine('$(MLXProjectRoot)','native','build','libmlxsharp.dylib'))</MLXSharpMacNativeBinary>
<MLXSharpMacNativeDestination>$([System.IO.Path]::Combine('$(MLXProjectRoot)','src','MLXSharp.Native','runtimes','osx-arm64','native','libmlxsharp.dylib'))</MLXSharpMacNativeDestination>
<MLXSharpSkipMacNativeValidation Condition="'$(MLXSharpSkipMacNativeValidation)' == ''">false</MLXSharpSkipMacNativeValidation>
</PropertyGroup>

Expand Down