Skip to content

Commit d63199b

Browse files
committed
bots
1 parent e1abe8e commit d63199b

File tree

12 files changed

+952
-236
lines changed

12 files changed

+952
-236
lines changed

.github/workflows/ci.yml

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@ jobs:
1717
- name: Install CMake
1818
run: brew install cmake
1919

20+
- name: Setup Python for HuggingFace
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.11'
24+
25+
- name: Install HuggingFace CLI
26+
run: pip install huggingface_hub
27+
28+
- name: Download test model from HuggingFace
29+
run: |
30+
mkdir -p models
31+
huggingface-cli download mlx-community/Qwen1.5-0.5B-Chat-4bit --local-dir models/Qwen1.5-0.5B-Chat-4bit
32+
echo "Model files:"
33+
ls -la models/Qwen1.5-0.5B-Chat-4bit/
34+
2035
- name: Build native stub library
2136
run: |
2237
cmake -S native -B native/build -DCMAKE_BUILD_TYPE=Release
@@ -47,6 +62,8 @@ jobs:
4762
4863
- name: Run tests
4964
run: dotnet test MLXSharp.sln --configuration Release --no-build --logger "trx;LogFileName=TestResults.trx" --results-directory artifacts/test-results
65+
env:
66+
MLXSHARP_MODEL_PATH: ${{ github.workspace }}/models/Qwen1.5-0.5B-Chat-4bit
5067

5168
- name: Prepare artifact folders
5269
run: |
@@ -55,9 +72,12 @@ jobs:
5572
mkdir -p artifacts/native
5673
cp src/MLXSharp.Native/runtimes/osx-arm64/native/libmlxsharp.dylib artifacts/native/
5774
58-
- name: Pack library
75+
- name: Pack MLXSharp library
5976
run: dotnet pack src/MLXSharp/MLXSharp.csproj --configuration Release --no-build --output artifacts/packages
6077

78+
- name: Pack MLXSharp.SemanticKernel library
79+
run: dotnet pack src/MLXSharp.SemanticKernel/MLXSharp.SemanticKernel.csproj --configuration Release --no-build --output artifacts/packages
80+
6181
- name: Verify package contains native libraries
6282
run: |
6383
echo "Checking package contents..."
@@ -88,3 +108,89 @@ jobs:
88108
with:
89109
name: test-results
90110
path: artifacts/test-results
111+
112+
release:
113+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
114+
needs: build-test
115+
runs-on: ubuntu-latest
116+
permissions:
117+
contents: write
118+
steps:
119+
- name: Checkout repository
120+
uses: actions/checkout@v4
121+
122+
- name: Extract version from Directory.Build.props
123+
id: version
124+
run: |
125+
VERSION=$(grep -oP '<Version>\K[^<]+' Directory.Build.props)
126+
echo "version=$VERSION" >> $GITHUB_OUTPUT
127+
echo "Extracted version: $VERSION"
128+
129+
# - name: Check if tag exists
130+
# id: check_tag
131+
# run: |
132+
# if git ls-remote --tags origin | grep -q "refs/tags/v${{ steps.version.outputs.version }}"; then
133+
# echo "exists=true" >> $GITHUB_OUTPUT
134+
# echo "Tag v${{ steps.version.outputs.version }} already exists"
135+
# else
136+
# echo "exists=false" >> $GITHUB_OUTPUT
137+
# echo "Tag v${{ steps.version.outputs.version }} does not exist"
138+
# fi
139+
140+
# - name: Download package artifacts
141+
# if: steps.check_tag.outputs.exists == 'false'
142+
# uses: actions/download-artifact@v4
143+
# with:
144+
# name: packages
145+
# path: artifacts/packages
146+
147+
# - name: Publish to NuGet
148+
# if: steps.check_tag.outputs.exists == 'false'
149+
# run: |
150+
# for package in artifacts/packages/*.nupkg; do
151+
# echo "Publishing $package..."
152+
# dotnet nuget push "$package" \
153+
# --api-key ${{ secrets.NUGET_API_KEY }} \
154+
# --source https://api.nuget.org/v3/index.json \
155+
# --skip-duplicate || true
156+
# done
157+
158+
# - name: Create Git tag
159+
# if: steps.check_tag.outputs.exists == 'false'
160+
# run: |
161+
# git config user.name "github-actions[bot]"
162+
# git config user.email "github-actions[bot]@users.noreply.github.com"
163+
# git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
164+
# git push origin "v${{ steps.version.outputs.version }}"
165+
166+
# - name: Generate release notes
167+
# if: steps.check_tag.outputs.exists == 'false'
168+
# id: release_notes
169+
# run: |
170+
# PREVIOUS_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1) 2>/dev/null || echo "")
171+
# if [ -z "$PREVIOUS_TAG" ]; then
172+
# COMMITS=$(git log --pretty=format:"- %s (%h)" --reverse)
173+
# else
174+
# COMMITS=$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:"- %s (%h)" --reverse)
175+
# fi
176+
177+
# echo "## What's Changed" > release_notes.md
178+
# echo "" >> release_notes.md
179+
# echo "$COMMITS" >> release_notes.md
180+
# echo "" >> release_notes.md
181+
# echo "## NuGet Packages" >> release_notes.md
182+
# echo "- [MLXSharp v${{ steps.version.outputs.version }}](https://www.nuget.org/packages/MLXSharp/${{ steps.version.outputs.version }})" >> release_notes.md
183+
# echo "- [MLXSharp.SemanticKernel v${{ steps.version.outputs.version }}](https://www.nuget.org/packages/MLXSharp.SemanticKernel/${{ steps.version.outputs.version }})" >> release_notes.md
184+
185+
# cat release_notes.md
186+
187+
# - name: Create GitHub Release
188+
# if: steps.check_tag.outputs.exists == 'false'
189+
# uses: softprops/action-gh-release@v1
190+
# with:
191+
# tag_name: v${{ steps.version.outputs.version }}
192+
# name: Release v${{ steps.version.outputs.version }}
193+
# body_path: release_notes.md
194+
# files: artifacts/packages/*
195+
# env:
196+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)