name: Build llama-ai Turnkey Bundle on: schedule: - cron: '0 4 * * *' # Nightly at 4:00 AM UTC workflow_dispatch: inputs: llama_ai_version: description: 'llama-ai branch or tag' required: false default: 'main' cachyllama_version: description: 'CachyLLama branch or tag' required: false default: 'master' create_release: description: 'Create a GitHub release' required: false default: true type: boolean pull_request: paths: - '.github/workflows/build-llama-ai-bundle.yml' jobs: build-bundle-linux: runs-on: ubuntu-22.04 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install dependencies & Vulkan SDK run: | wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/lunarg.gpg sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list sudo apt-get update sudo apt-get install -y cmake ninja-build build-essential vulkan-sdk - name: Clone llama-ai repository run: | git clone --depth 1 --branch "${{ github.event.inputs.llama_ai_version || 'main' }}" https://github.com/fewtarius/llama-ai.git llama-ai-dist cd llama-ai-dist git submodule update --init --recursive || true - name: Clone and Build CachyLLama (Vulkan Backend) run: | git clone --depth 1 --branch "${{ github.event.inputs.cachyllama_version || 'master' }}" https://github.com/fewtarius/CachyLLama.git CachyLLama cd CachyLLama cmake -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DGGML_VULKAN=ON \ -DGGML_CPU=ON \ -DGGML_NATIVE=OFF \ -DCMAKE_INSTALL_RPATH='$ORIGIN' \ -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ -DLLAMA_BUILD_EXAMPLES=OFF \ -DLLAMA_BUILD_TESTS=OFF \ -DLLAMA_BUILD_TOOLS=ON \ -DLLAMA_BUILD_SERVER=ON cmake --build build --config Release -j $(nproc) - name: Assemble Linux Bundle run: | mkdir -p llama-ai-dist/src/cachy-llama-vulkan/build/bin cp -r CachyLLama/build/bin/* llama-ai-dist/src/cachy-llama-vulkan/build/bin/ # Create root bin/ symlinks or copies if needed mkdir -p llama-ai-dist/bin cp -r CachyLLama/build/bin/* llama-ai-dist/bin/ chmod +x llama-ai-dist/llama-run.sh chmod +x llama-ai-dist/scripts/*.sh || true - name: Test Linux Bundle Executables run: | export LD_LIBRARY_PATH="$(pwd)/llama-ai-dist/bin:${LD_LIBRARY_PATH:-}" ./llama-ai-dist/bin/llama-cli --help | head -n 10 ./llama-ai-dist/llama-run.sh --help || true echo "Linux bundle verification successful!" - name: Package Linux Bundle run: | tar -czvf llama-ai-linux-x64-bundle.tar.gz -C llama-ai-dist . - name: Upload Linux Bundle Artifact uses: actions/upload-artifact@v4 with: name: llama-ai-linux-x64-bundle.tar.gz path: llama-ai-linux-x64-bundle.tar.gz release: needs: [build-bundle-linux] runs-on: ubuntu-22.04 permissions: contents: write if: | always() && github.event_name != 'pull_request' && (github.event_name == 'schedule' || github.event.inputs.create_release == 'true' || github.event.inputs.create_release == null) steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Download all bundle artifacts uses: actions/download-artifact@v4 with: path: ./bundle-artifacts - name: Determine tag name id: tag uses: ./.github/actions/get-tag-name with: github_token: ${{ secrets.GITHUB_TOKEN }} prefix: 'b' - name: Package bundles for release run: | mkdir -p ./release-bundles TAG="${{ steps.tag.outputs.tag }}" if [ -f "./bundle-artifacts/llama-ai-linux-x64-bundle.tar.gz/llama-ai-linux-x64-bundle.tar.gz" ]; then cp ./bundle-artifacts/llama-ai-linux-x64-bundle.tar.gz/llama-ai-linux-x64-bundle.tar.gz "./release-bundles/llama-ai-${TAG}-linux-x64.tar.gz" fi ls -la ./release-bundles/ - name: Publish GitHub Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | TAG="${{ steps.tag.outputs.tag }}" if gh release view "llama-ai-$TAG" >/dev/null 2>&1; then echo "Release llama-ai-$TAG already exists. Uploading/updating release assets with --clobber..." gh release upload "llama-ai-$TAG" ./release-bundles/* --clobber else echo "Creating new release llama-ai-$TAG..." gh release create "llama-ai-$TAG" \ --title "llama-ai $TAG Turnkey Bundle" \ --notes "Turnkey distribution bundle for llama-ai with pre-compiled CachyLLama binaries, solver, and runner scripts." \ ./release-bundles/* fi