mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
CI was failing on release branches because uv sync tried to resolve
llama-stack-client>=0.3.1rc1 from PyPI, but RC versions only exist on
test.pypi. The dependency resolution would fail before we could install
the client from git.
Solution: On release-X.Y.x branches, pre-install llama-stack-client
from the matching git branch before running uv sync. This satisfies
the RC version requirement in pyproject.toml and allows dependency
resolution to succeed.
Changes:
- setup-runner: Pre-install client from git on release branches
- pre-commit: Add same pre-install logic before uv sync
- setup-test-environment: Remove duplicate logic (now in setup-runner)
Example failure: 5415478835
72 lines
3.1 KiB
YAML
72 lines
3.1 KiB
YAML
name: Setup runner
|
|
description: Prepare a runner for the tests (install uv, python, project dependencies, etc.)
|
|
inputs:
|
|
python-version:
|
|
description: The Python version to use
|
|
required: false
|
|
default: "3.12"
|
|
client-version:
|
|
description: The llama-stack-client-python version to test against (latest or published)
|
|
required: false
|
|
default: "latest"
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
|
|
with:
|
|
python-version: ${{ inputs.python-version }}
|
|
version: 0.7.6
|
|
|
|
- name: Install dependencies
|
|
shell: bash
|
|
run: |
|
|
# Determine the branch we're working with
|
|
# For PRs: use base_ref (target branch)
|
|
# For pushes: use ref (current branch)
|
|
BRANCH="${{ github.base_ref || github.ref }}"
|
|
BRANCH="${BRANCH#refs/heads/}" # Strip refs/heads/ prefix
|
|
|
|
echo "Working with branch: $BRANCH"
|
|
|
|
# If on a release branch, install from matching release branch BEFORE uv sync
|
|
# This allows uv sync to resolve dependencies that reference unreleased RC versions
|
|
# We always do this on release branches regardless of client-version to satisfy pyproject.toml
|
|
if [[ "$BRANCH" =~ ^release-[0-9]+\.[0-9]+\.x$ ]]; then
|
|
echo "Detected release branch: $BRANCH"
|
|
echo "Checking if matching branch exists in llama-stack-client-python..."
|
|
|
|
# Check if the branch exists in the client repo
|
|
if git ls-remote --exit-code --heads https://github.com/llamastack/llama-stack-client-python.git "$BRANCH" > /dev/null 2>&1; then
|
|
echo "Installing llama-stack-client-python from matching branch: $BRANCH"
|
|
uv pip install git+https://github.com/llamastack/llama-stack-client-python.git@$BRANCH
|
|
else
|
|
echo "::error::Branch $BRANCH not found in llama-stack-client-python repository"
|
|
echo "::error::Please create the matching release branch in llama-stack-client-python before testing"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "Updating project dependencies via uv sync"
|
|
uv sync --all-groups
|
|
|
|
echo "Installing ad-hoc dependencies"
|
|
uv pip install faiss-cpu
|
|
|
|
# Install llama-stack-client-python based on the client-version input
|
|
# Only applies to non-release branches (on release branches, we already installed from git above)
|
|
if [[ ! "$BRANCH" =~ ^release-[0-9]+\.[0-9]+\.x$ ]]; then
|
|
if [ "${{ inputs.client-version }}" = "latest" ]; then
|
|
echo "Installing latest llama-stack-client-python from main branch"
|
|
uv pip install git+https://github.com/llamastack/llama-stack-client-python.git@main
|
|
elif [ "${{ inputs.client-version }}" = "published" ]; then
|
|
echo "Installing published llama-stack-client-python from PyPI"
|
|
uv pip install llama-stack-client
|
|
else
|
|
echo "Invalid client-version: ${{ inputs.client-version }}"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "Installed llama packages"
|
|
uv pip list | grep llama
|