|
| 1 | +name: Build Wheels |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - "*" |
| 8 | + |
| 9 | +jobs: |
| 10 | + build_macos_wheels: |
| 11 | + name: Build wheels on ${{matrix.os}}-${{matrix.arch}} |
| 12 | + runs-on: ${{matrix.os}} |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + include: |
| 17 | + - {os: macos-13, arch: x86_64, build: "*"} |
| 18 | + - {os: macos-14, arch: arm64, build: "*"} |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + submodules: "recursive" |
| 24 | + |
| 25 | + - name: Build wheels |
| 26 | + uses: pypa/cibuildwheel@v2.17.0 |
| 27 | + if: matrix.arch == 'arm64' |
| 28 | + env: |
| 29 | + CIBW_ARCHS: ${{ matrix.arch }} |
| 30 | + CIBW_BUILD: ${{ matrix.build }} |
| 31 | + CIBW_BUILD_FRONTEND: build |
| 32 | + CIBW_ENVIRONMENT_MACOS: CMAKE_ARGS='-DLLAMA_METAL=on' DYLD_LIBRARY_PATH="$(pwd)/llama_cpp" |
| 33 | + with: |
| 34 | + config-file: ./pyproject.toml |
| 35 | + |
| 36 | + - name: Build wheels |
| 37 | + uses: pypa/cibuildwheel@v2.17.0 |
| 38 | + if: matrix.arch == 'x86_64' |
| 39 | + env: |
| 40 | + CIBW_ARCHS: ${{ matrix.arch }} |
| 41 | + CIBW_BUILD: ${{ matrix.build }} |
| 42 | + CIBW_BUILD_FRONTEND: build |
| 43 | + CIBW_ENVIRONMENT_MACOS: CMAKE_ARGS='-DLLAMA_METAL=off' DYLD_LIBRARY_PATH="$(pwd)/llama_cpp" |
| 44 | + with: |
| 45 | + config-file: ./pyproject.toml |
| 46 | + |
| 47 | + |
| 48 | + - uses: actions/upload-artifact@v4 |
| 49 | + with: |
| 50 | + name: cibw-wheels-${{matrix.os}}-${{matrix.arch}}-${{strategy.job-index}} |
| 51 | + path: ./wheelhouse/*.whl |
| 52 | + |
| 53 | + |
| 54 | + build_linux_wheels: |
| 55 | + name: Build wheels on ${{matrix.os}}-${{matrix.arch}} |
| 56 | + runs-on: ${{matrix.os}} |
| 57 | + strategy: |
| 58 | + fail-fast: true |
| 59 | + matrix: |
| 60 | + include: |
| 61 | + - {os: ubuntu-latest, arch: x86_64, build: "*"} |
| 62 | + - {os: ubuntu-latest, arch: aarch64, build: "*[61]-manylinux_aarch64"} |
| 63 | + - {os: ubuntu-latest, arch: aarch64, build: "*[72]-manylinux_aarch64"} |
| 64 | + - {os: ubuntu-latest, arch: aarch64, build: "*[83]-manylinux_aarch64"} |
| 65 | + - {os: ubuntu-latest, arch: aarch64, build: "*[94]-manylinux_aarch64"} |
| 66 | + - {os: ubuntu-latest, arch: aarch64, build: "*[05]-manylinux_aarch64"} |
| 67 | + |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v4 |
| 70 | + with: |
| 71 | + submodules: "recursive" |
| 72 | + |
| 73 | + - name: Set up QEMU |
| 74 | + if: matrix.arch == 'aarch64' |
| 75 | + uses: docker/setup-qemu-action@v3 |
| 76 | + with: |
| 77 | + platforms: arm64 |
| 78 | + |
| 79 | + - name: Build wheels |
| 80 | + uses: pypa/cibuildwheel@v2.17.0 |
| 81 | + env: |
| 82 | + CIBW_ARCHS: ${{ matrix.arch }} |
| 83 | + CIBW_BUILD: ${{ matrix.build }} |
| 84 | + CIBW_BUILD_FRONTEND: build |
| 85 | + CIBW_SKIP: '*-musllinux*' |
| 86 | + with: |
| 87 | + config-file: ./pyproject.toml |
| 88 | + |
| 89 | + |
| 90 | + - uses: actions/upload-artifact@v4 |
| 91 | + with: |
| 92 | + name: cibw-wheels-${{matrix.os}}-${{matrix.arch}}-${{strategy.job-index}} |
| 93 | + path: ./wheelhouse/*.whl |
| 94 | + |
| 95 | + |
| 96 | + build_sdist: |
| 97 | + name: Build source distribution |
| 98 | + runs-on: ubuntu-latest |
| 99 | + |
| 100 | + steps: |
| 101 | + - uses: actions/checkout@v4 |
| 102 | + with: |
| 103 | + submodules: "recursive" |
| 104 | + |
| 105 | + - name: Build sdist |
| 106 | + run: pipx run build --sdist |
| 107 | + |
| 108 | + - uses: actions/upload-artifact@v4 |
| 109 | + with: |
| 110 | + name: cibw-sdist |
| 111 | + path: dist/*.tar.gz |
0 commit comments