mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-26 22:19:49 +00:00
184 lines
6.6 KiB
YAML
184 lines
6.6 KiB
YAML
name: Test Llama Stack Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'llama_stack/cli/stack/build.py'
|
|
- 'llama_stack/cli/stack/_build.py'
|
|
- 'llama_stack/distribution/build.*'
|
|
- 'llama_stack/distribution/*.sh'
|
|
- '.github/workflows/providers-build.yml'
|
|
- 'llama_stack/templates/**'
|
|
pull_request:
|
|
paths:
|
|
- 'llama_stack/cli/stack/build.py'
|
|
- 'llama_stack/cli/stack/_build.py'
|
|
- 'llama_stack/distribution/build.*'
|
|
- 'llama_stack/distribution/*.sh'
|
|
- '.github/workflows/providers-build.yml'
|
|
- 'llama_stack/templates/**'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
generate-matrix:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
templates: ${{ steps.set-matrix.outputs.templates }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Generate Template List
|
|
id: set-matrix
|
|
run: |
|
|
templates=$(ls llama_stack/templates/*/*build.yaml | grep -v "experimental-post-training" | awk -F'/' '{print $(NF-1)}' | jq -R -s -c 'split("\n")[:-1]')
|
|
echo "templates=$templates" >> "$GITHUB_OUTPUT"
|
|
|
|
build:
|
|
needs: generate-matrix
|
|
runs-on: ubuntu-latest
|
|
# strategy:
|
|
# matrix:
|
|
# template: ${{ fromJson(needs.generate-matrix.outputs.templates) }}
|
|
# image-type: [venv, container]
|
|
# fail-fast: false # We want to run all jobs even if some fail
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup-runner
|
|
with:
|
|
install-ollama: false
|
|
|
|
# - name: Print dependencies in the image
|
|
# if: matrix.image-type == 'venv'
|
|
# run: |
|
|
# uv pip list
|
|
|
|
# - name: Run Llama Stack Build - VENV
|
|
# if: matrix.image-type == 'venv'
|
|
# run: |
|
|
# uv sync --no-default-groups --extra ${{ matrix.template }}
|
|
|
|
- name: Run Llama Stack Build - VENV - meta-reference-gpu-distro
|
|
# if: matrix.image-type == 'venv'
|
|
run: |
|
|
uv sync --no-default-groups --extra meta-reference-gpu-distro
|
|
|
|
- name: Setup tmate session
|
|
if: ${{ failure() }}
|
|
uses: mxschmitt/action-tmate@v3
|
|
|
|
# # TODO
|
|
# - name: Run Llama Stack Build - CONTAINER
|
|
# if: matrix.image-type == 'container'
|
|
# run: |
|
|
# # TODO: use llama_stack/templates/Containerfile when we have a new release!
|
|
# cat << 'EOF' > Containerfile
|
|
# FROM registry.access.redhat.com/ubi9
|
|
# WORKDIR /app
|
|
# ARG TEMPLATE
|
|
|
|
# RUN dnf -y update \
|
|
# && dnf install -y python3.11 python3.11-pip python3.11-wheel python3.11-setuptools python3.11-devel gcc make \
|
|
# && ln -s /bin/pip3.11 /bin/pip \
|
|
# && ln -s /bin/python3.11 /bin/python \
|
|
# && dnf clean all
|
|
|
|
# RUN mkdir -p /.llama/providers.d /.cache
|
|
# COPY . /app/llama-stack
|
|
# RUN cd llama-stack && pip install --no-cache .[${TEMPLATE}]
|
|
# RUN chmod -R g+rw /app /.llama /.cache
|
|
# ENTRYPOINT ["python", "-m", "llama_stack.distribution.server.server", "--config", "/app/llama-stack/templates/${TEMPLATE}/run.yaml"]
|
|
# EOF
|
|
# docker build --build-arg TEMPLATE=${{ matrix.template }} -f Containerfile -t ${{ matrix.template }} .
|
|
|
|
# - name: Print dependencies in the image
|
|
# if: matrix.image-type == 'venv'
|
|
# run: |
|
|
# uv pip list
|
|
|
|
build-single-provider:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup-runner
|
|
|
|
- name: Build a single provider
|
|
run: |
|
|
USE_COPY_NOT_MOUNT=true LLAMA_STACK_DIR=. uv run llama stack build --image-type venv --image-name test --providers inference=remote::ollama
|
|
|
|
build-custom-container-distribution:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup-runner
|
|
|
|
- name: Build a single provider
|
|
run: |
|
|
yq -i '.image_type = "container"' llama_stack/templates/starter/build.yaml
|
|
yq -i '.image_name = "test"' llama_stack/templates/starter/build.yaml
|
|
USE_COPY_NOT_MOUNT=true LLAMA_STACK_DIR=. uv run llama stack build --config llama_stack/templates/starter/build.yaml
|
|
|
|
- name: Inspect the container image entrypoint
|
|
run: |
|
|
IMAGE_ID=$(docker images --format "{{.Repository}}:{{.Tag}}" | head -n 1)
|
|
entrypoint=$(docker inspect --format '{{ .Config.Entrypoint }}' $IMAGE_ID)
|
|
echo "Entrypoint: $entrypoint"
|
|
if [ "$entrypoint" != "[python -m llama_stack.distribution.server.server --config /app/run.yaml]" ]; then
|
|
echo "Entrypoint is not correct"
|
|
exit 1
|
|
fi
|
|
|
|
build-ubi9-container-distribution:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup-runner
|
|
|
|
- name: Pin template to UBI9 base
|
|
run: |
|
|
yq -i '
|
|
.image_type = "container" |
|
|
.image_name = "ubi9-test" |
|
|
.distribution_spec.container_image = "registry.access.redhat.com/ubi9:latest"
|
|
' llama_stack/templates/starter/build.yaml
|
|
|
|
- name: Build dev container (UBI9)
|
|
env:
|
|
USE_COPY_NOT_MOUNT: "true"
|
|
LLAMA_STACK_DIR: "."
|
|
run: |
|
|
uv run llama stack build --config llama_stack/templates/starter/build.yaml
|
|
|
|
- name: Inspect UBI9 image
|
|
run: |
|
|
IMAGE_ID=$(docker images --format "{{.Repository}}:{{.Tag}}" | head -n 1)
|
|
entrypoint=$(docker inspect --format '{{ .Config.Entrypoint }}' $IMAGE_ID)
|
|
echo "Entrypoint: $entrypoint"
|
|
if [ "$entrypoint" != "[python -m llama_stack.distribution.server.server --config /app/run.yaml]" ]; then
|
|
echo "Entrypoint is not correct"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Checking /etc/os-release in $IMAGE_ID"
|
|
docker run --rm --entrypoint sh "$IMAGE_ID" -c \
|
|
'source /etc/os-release && echo "$ID"' \
|
|
| grep -qE '^(rhel|ubi)$' \
|
|
|| { echo "Base image is not UBI 9!"; exit 1; }
|