diff --git a/.github/actions/setup-runner/action.yml b/.github/actions/setup-runner/action.yml index 905d6b73a..14963580c 100644 --- a/.github/actions/setup-runner/action.yml +++ b/.github/actions/setup-runner/action.yml @@ -21,6 +21,32 @@ runs: - 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 @@ -28,15 +54,18 @@ runs: uv pip install faiss-cpu # Install llama-stack-client-python based on the client-version input - 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 + # 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" diff --git a/.github/actions/setup-test-environment/action.yml b/.github/actions/setup-test-environment/action.yml index 992b25803..7b306fef5 100644 --- a/.github/actions/setup-test-environment/action.yml +++ b/.github/actions/setup-test-environment/action.yml @@ -42,29 +42,7 @@ runs: - name: Build Llama Stack shell: bash run: | - # Install llama-stack-client-python based on the client-version input - if [ "${{ inputs.client-version }}" = "latest" ]; then - # Check if PR is targeting a release branch - TARGET_BRANCH="${{ github.base_ref }}" - - if [[ "$TARGET_BRANCH" =~ ^release-[0-9]+\.[0-9]+\.x$ ]]; then - echo "PR targets release branch: $TARGET_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 "$TARGET_BRANCH" > /dev/null 2>&1; then - echo "Installing llama-stack-client-python from matching branch: $TARGET_BRANCH" - uv pip install --force-reinstall git+https://github.com/llamastack/llama-stack-client-python.git@$TARGET_BRANCH - else - echo "::error::Branch $TARGET_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 - # For main branch, client is already installed by setup-runner - fi - # For published version, client is already installed by setup-runner - + # Client is already installed by setup-runner (handles both main and release branches) echo "Building Llama Stack" LLAMA_STACK_DIR=. \ diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 695a4f9e2..e0c20bbc4 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -130,6 +130,33 @@ jobs: exit 1 fi + - name: Install client from release branch if needed + 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 + 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 + - name: Sync dev + type_checking dependencies run: uv sync --group dev --group type_checking