|
| 1 | +name: Build llama-cpp Binaries |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + paths: |
| 7 | + - '.github/workflows/build-llama.yml' |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-python-wheel: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - uses: actions/setup-python@v5 |
| 16 | + with: |
| 17 | + python-version: "3.10" |
| 18 | + |
| 19 | + - name: Install build deps |
| 20 | + run: | |
| 21 | + sudo apt-get update |
| 22 | + sudo apt-get install -y gcc g++ cmake |
| 23 | + pip install wheel |
| 24 | +
|
| 25 | + - name: Build wheel |
| 26 | + env: |
| 27 | + CMAKE_ARGS: "-DGGML_BLAS=OFF -DGGML_CUDA=OFF -DGGML_METAL=OFF -DGGML_VULKAN=OFF" |
| 28 | + FORCE_CMAKE: "1" |
| 29 | + run: | |
| 30 | + pip wheel llama-cpp-python --no-deps -w ./wheels/ |
| 31 | +
|
| 32 | + - name: Upload wheel artifact |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: python-wheel |
| 36 | + path: ./wheels/*.whl |
| 37 | + |
| 38 | + build-node-binary: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - uses: actions/setup-node@v4 |
| 44 | + with: |
| 45 | + node-version: "20" |
| 46 | + |
| 47 | + - name: Build node-llama-cpp binary |
| 48 | + run: | |
| 49 | + npm install node-llama-cpp |
| 50 | + npx node-llama-cpp download |
| 51 | +
|
| 52 | + - name: Pack binary |
| 53 | + run: | |
| 54 | + tar -czf node-llama-linux-x64.tar.gz \ |
| 55 | + node_modules/node-llama-cpp/build \ |
| 56 | + node_modules/node-llama-cpp/bins |
| 57 | +
|
| 58 | + - name: Upload node artifact |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: node-binary |
| 62 | + path: node-llama-linux-x64.tar.gz |
| 63 | + |
| 64 | + release: |
| 65 | + runs-on: ubuntu-latest |
| 66 | + needs: [build-python-wheel, build-node-binary] |
| 67 | + permissions: |
| 68 | + contents: write |
| 69 | + steps: |
| 70 | + - name: Download all artifacts |
| 71 | + uses: actions/download-artifact@v4 |
| 72 | + with: |
| 73 | + path: ./artifacts |
| 74 | + |
| 75 | + - name: Show artifacts |
| 76 | + run: find ./artifacts -type f |
| 77 | + |
| 78 | + - name: Publish to GitHub Release |
| 79 | + uses: softprops/action-gh-release@v2 |
| 80 | + with: |
| 81 | + tag_name: llama-wheel-latest |
| 82 | + name: "llama-cpp binaries — Python wheel + Node binary" |
| 83 | + make_latest: true |
| 84 | + files: | |
| 85 | + ./artifacts/python-wheel/*.whl |
| 86 | + ./artifacts/node-binary/node-llama-linux-x64.tar.gz |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments