Build llama-cpp Binaries #2
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: Install build tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc g++ cmake make | |
| - name: Install node-llama-cpp | |
| run: npm install node-llama-cpp | |
| - name: Download llama.cpp source and build | |
| run: | | |
| npx node-llama-cpp source download | |
| npx node-llama-cpp source build --no-gpu | |
| - name: Pack binary | |
| run: | | |
| tar -czf node-llama-linux-x64.tar.gz \ | |
| node_modules/node-llama-cpp/build | |
| - 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: 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 }} |