Skip to content

fix: auto-resume conversational llamaindex agents #1461

fix: auto-resume conversational llamaindex agents

fix: auto-resume conversational llamaindex agents #1461

name: Test Custom Version
on:
workflow_call:
secrets:
UIPATH_URL:
required: true
UIPATH_CLIENT_ID:
required: true
UIPATH_CLIENT_SECRET:
required: true
pull_request:
types: [opened, synchronize, labeled, unlabeled]
paths:
- 'packages/**'
- '.github/workflows/test-custom-version.yml'
- '.github/scripts/detect_changed_packages.py'
permissions:
contents: read
pull-requests: read
jobs:
detect-changed-packages:
if: contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.detect.outputs.packages }}
count: ${{ steps.detect.outputs.count }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Detect changed packages
id: detect
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: python .github/scripts/detect_changed_packages.py
test-core-dev-version:
name: Test ${{ matrix.package }} - Custom Version
needs: detect-changed-packages
if: contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') && needs.detect-changed-packages.outputs.count > 0
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: packages/${{ matrix.package }}
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.detect-changed-packages.outputs.packages) }}
python-version: ["3.11", "3.12", "3.13"]
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract version from PR
id: extract-version
shell: pwsh
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
$match = [regex]::Match($env:PR_TITLE, '[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+')
if (-not $match.Success) {
Write-Output "No version found in PR title. Please include version in title like: 2.0.65.dev1004030443"
exit 1
}
$version = $match.Value
Write-Output "Extracted version: $version"
"version=$version" | Add-Content -Path $env:GITHUB_OUTPUT
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Modify pyproject.toml for custom UiPath version
shell: pwsh
env:
UIPATH_VERSION: ${{ steps.extract-version.outputs.version }}
run: |
Copy-Item pyproject.toml pyproject.toml.backup
$content = Get-Content pyproject.toml -Raw
$content = $content -replace '"uipath>=[^"]*"', "`"uipath==$env:UIPATH_VERSION`""
if ($content -notmatch '\[tool\.uv\.sources\]') {
$content = $content.TrimEnd() + "`n`n[tool.uv.sources]`nuipath = { index = `"testpypi`" }`n"
} elseif ($content -notmatch 'uipath\s*=\s*\{\s*index\s*=\s*"testpypi"\s*\}') {
$content = $content -replace '(\[tool\.uv\.sources\])', "`$1`nuipath = { index = `"testpypi`" }"
}
Set-Content -Path pyproject.toml -Value $content -NoNewline
Write-Output "Modified pyproject.toml to use UiPath version $env:UIPATH_VERSION from testpypi"
Write-Output "=== Modified pyproject.toml content ==="
Get-Content pyproject.toml
- name: Install dependencies with specific UiPath version
run: uv sync --all-extras --python ${{ matrix.python-version }}
- name: Run all tests
run: uv run pytest
env:
UIPATH_URL: ${{ secrets.UIPATH_URL }}
UIPATH_CLIENT_ID: ${{ secrets.UIPATH_CLIENT_ID }}
UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}
- name: Restore original pyproject.toml
if: always()
shell: pwsh
run: Move-Item -Force pyproject.toml.backup pyproject.toml