Build Wheels (Metal) #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Wheels (Metal) | |
| on: | |
| workflow_dispatch | |
| permissions: | |
| contents: write | |
| jobs: | |
| build_wheels: | |
| name: Build wheels (Metal macos) | |
| runs-on: macos-latest | |
| 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 llama_cpp; print(llama_cpp.__version__)") | |
| 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=off | |
| -DGGML_METAL_SHADER_DEBUG=on" | |
| with: | |
| package-dir: . | |
| output-dir: wheelhouse2 | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-metal_${{ matrix.os }} | |
| path: ./wheelhouse2/*.whl | |
| release: | |
| name: Release | |
| needs: [build_wheels] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| 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 | |
| uses: softprops/action-gh-release@v2.2.2 | |
| with: | |
| files: dist2/* | |
| tag_name: v${{ needs.build_wheels.outputs.version }}-Metal-macos-${{ env.BUILD_DATE }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |