chore(llama): upgrade llama.cpp to b9835 #11
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: CD Llama CPU Libs | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| paths: | |
| - "docker/Dockerfile.llama-cpu" | |
| workflow_dispatch: | |
| inputs: | |
| source_ref: | |
| description: "Existing branch, tag, or commit SHA to build llama-cpu-libs from" | |
| required: true | |
| default: "main" | |
| type: string | |
| image_tag: | |
| description: "Docker tag to publish. Defaults to source_ref (sanitized for Docker tag rules)" | |
| required: false | |
| default: "" | |
| type: string | |
| env: | |
| DOCKERHUB_USERNAME: timothyswt | |
| jobs: | |
| meta: | |
| name: Resolve llama-cpu-libs tag | |
| runs-on: ubuntu-latest | |
| outputs: | |
| checkout_ref: ${{ steps.meta.outputs.checkout_ref }} | |
| docker_repo: ${{ steps.meta.outputs.docker_repo }} | |
| llama_version: ${{ steps.meta.outputs.llama_version }} | |
| llama_cpu_image: ${{ steps.meta.outputs.llama_cpu_image }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && inputs.source_ref || github.ref }} | |
| - id: meta | |
| run: | | |
| sanitize_tag() { | |
| local raw="$1" | |
| raw="${raw#refs/heads/}" | |
| raw="${raw#refs/tags/}" | |
| raw="${raw#refs/}" | |
| raw="${raw//\//-}" | |
| raw="$(printf '%s' "$raw" | tr -c '[:alnum:]._-' '-')" | |
| raw="${raw#-}" | |
| raw="${raw%-}" | |
| if [ -z "$raw" ]; then | |
| raw="latest" | |
| fi | |
| printf '%s' "$raw" | |
| } | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| CHECKOUT_REF="${{ inputs.source_ref }}" | |
| if [ -n "${{ inputs.image_tag }}" ]; then | |
| VERSION_INPUT="${{ inputs.image_tag }}" | |
| else | |
| VERSION_INPUT="${{ inputs.source_ref }}" | |
| fi | |
| else | |
| CHECKOUT_REF="${GITHUB_REF}" | |
| VERSION_INPUT="${GITHUB_REF_NAME}" | |
| fi | |
| VERSION_TAG="$(sanitize_tag "$VERSION_INPUT")" | |
| LLAMA_VERSION="$(sed -n 's/^LLAMA_VERSION ?= //p' Makefile | head -n1)" | |
| if [ -z "$LLAMA_VERSION" ]; then | |
| echo "Failed to determine LLAMA_VERSION from Makefile" >&2 | |
| exit 1 | |
| fi | |
| if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then | |
| VERSION_TAG="${LLAMA_VERSION}" | |
| fi | |
| echo "checkout_ref=${CHECKOUT_REF}" >> "$GITHUB_OUTPUT" | |
| echo "docker_repo=${DOCKERHUB_USERNAME}" >> "$GITHUB_OUTPUT" | |
| echo "llama_version=${LLAMA_VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "llama_cpu_image=${DOCKERHUB_USERNAME}/llama-cpu-libs:${VERSION_TAG}" >> "$GITHUB_OUTPUT" | |
| build-llama-cpu-libs: | |
| name: Build and Push ${{ needs.meta.outputs.llama_cpu_image }} | |
| runs-on: ubuntu-latest | |
| needs: meta | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ needs.meta.outputs.checkout_ref }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| username: ${{ env.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_PAT }} | |
| - name: Verify Docker Hub auth | |
| run: | | |
| docker info 2>/dev/null | grep -i "^ Username:" || (echo "::error::Docker Hub login did not produce an authenticated session"; exit 1) | |
| - name: Build and push CPU prerequisite image | |
| uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 | |
| with: | |
| context: . | |
| file: docker/Dockerfile.llama-cpu | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| provenance: false | |
| tags: ${{ needs.meta.outputs.llama_cpu_image }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |