Build llama-cpp Binaries #1
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 llama-cpp Binaries | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - '.github/workflows/build-llama.yml' | |
| jobs: | |
| build-python-wheel: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install build deps | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc g++ cmake | |
| pip install wheel | |
| - name: Build wheel | |
| env: | |
| CMAKE_ARGS: "-DGGML_BLAS=OFF -DGGML_CUDA=OFF -DGGML_METAL=OFF -DGGML_VULKAN=OFF" | |
| FORCE_CMAKE: "1" | |
| run: | | |
| pip wheel llama-cpp-python --no-deps -w ./wheels/ | |
| - name: Upload wheel artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-wheel | |
| path: ./wheels/*.whl | |
| build-node-binary: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Build node-llama-cpp binary | |
| run: | | |
| npm install node-llama-cpp | |
| npx node-llama-cpp download | |
| - name: Pack binary | |
| run: | | |
| tar -czf node-llama-linux-x64.tar.gz \ | |
| node_modules/node-llama-cpp/build \ | |
| node_modules/node-llama-cpp/bins | |
| - name: Upload node artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: node-binary | |
| path: node-llama-linux-x64.tar.gz | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [build-python-wheel, build-node-binary] | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./artifacts | |
| - name: Show artifacts | |
| run: find ./artifacts -type f | |
| - name: Publish to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: llama-wheel-latest | |
| name: "llama-cpp binaries — Python wheel + Node binary" | |
| make_latest: true | |
| files: | | |
| ./artifacts/python-wheel/*.whl | |
| ./artifacts/node-binary/node-llama-linux-x64.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |