forked from TAO71-AI/llama-cpp-python-JamePeng
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (81 loc) · 2.73 KB
/
Copy pathbuild-wheels-metal.yaml
File metadata and controls
98 lines (81 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Build Wheels (Metal)
on:
workflow_dispatch
permissions:
contents: write
jobs:
build_wheels:
name: Build wheels (Metal macos-26)
runs-on: macos-26
outputs:
version: ${{steps.get_version.outputs.version}}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: "recursive"
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: 'pip'
- name: Install dependencies (MacOS)
run: |
python -m pip install --upgrade pip
python -m pip install uv
RUST_LOG=trace python -m uv pip install -e .[all] --verbose
shell: bash
- name: Get Package Version
id: get_version
shell: bash
run: |
VERSION=$(python -c "import importlib.metadata; print(importlib.metadata.version('llama-cpp-python'))")
echo "Detected version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build wheels
uses: pypa/cibuildwheel@v3.3.1
env:
CIBW_REPAIR_WHEEL_COMMAND: ""
CIBW_ARCHS: "arm64"
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
CIBW_ENVIRONMENT: >
CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=arm64
-DCMAKE_APPLE_SILICON_PROCESSOR=arm64
-DCMAKE_CROSSCOMPILING=on
-DGGML_METAL=on
-DGGML_METAL_USE_BF16=on
-DGGML_METAL_EMBED_LIBRARY=on"
with:
package-dir: .
output-dir: wheelhouse2
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: wheels-metal_${{ matrix.os }}
path: ./wheelhouse2/*.whl
release:
name: Release
needs: [build_wheels]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download artifacts
uses: actions/download-artifact@v7
with:
merge-multiple: true
path: dist2
- name: Get Current Date # Step to get current date for the release tag
id: get-date
run: |
# Get date in YYYYMMDD format using bash date command
currentDate=$(date +%Y%m%d)
# Store the date in environment variable for the release step
echo "BUILD_DATE=$currentDate" >> $GITHUB_ENV
- name: Publish Release via GitHub CLI
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME="v${{ needs.build_wheels.outputs.version }}-Metal-macos-$BUILD_DATE"
echo "Ready to create release with tag: $TAG_NAME"
gh release create "$TAG_NAME" dist2/* --title "$TAG_NAME" --generate-notes