|
| 1 | +name: Test UiPath Langchain |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [ opened, synchronize, reopened, labeled ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + test-uipath-langchain: |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + python-version: [ "3.11", "3.12", "3.13" ] |
| 13 | + os: [ ubuntu-latest, windows-latest ] |
| 14 | + |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | + # Only run if PR has the test:uipath-langchain label |
| 19 | + if: contains(github.event.pull_request.labels.*.name, 'test:uipath-langchain') |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout uipath-runtime-python |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + path: 'uipath-runtime-python' |
| 26 | + |
| 27 | + - name: Setup uv |
| 28 | + uses: astral-sh/setup-uv@v5 |
| 29 | + |
| 30 | + - name: Setup Python |
| 31 | + uses: actions/setup-python@v5 |
| 32 | + with: |
| 33 | + python-version: ${{ matrix.python-version }} |
| 34 | + |
| 35 | + - name: Build uipath-runtime package |
| 36 | + working-directory: uipath-runtime-python |
| 37 | + run: uv build |
| 38 | + |
| 39 | + - name: Checkout uipath-langchain-python |
| 40 | + uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + repository: 'UiPath/uipath-langchain-python' |
| 43 | + path: 'uipath-langchain-python' |
| 44 | + |
| 45 | + - name: Update uipath-runtime version |
| 46 | + shell: bash |
| 47 | + working-directory: uipath-langchain-python |
| 48 | + run: uv add ../uipath-runtime-python/dist/*.whl --dev |
| 49 | + |
| 50 | + - name: Run uipath-langchain tests |
| 51 | + working-directory: uipath-langchain-python |
| 52 | + run: | |
| 53 | + uv sync --all-extras |
| 54 | + uv run pytest |
| 55 | +
|
| 56 | + discover-testcases: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + permissions: |
| 59 | + contents: read |
| 60 | + needs: [test-uipath-langchain] |
| 61 | + outputs: |
| 62 | + testcases: ${{ steps.discover.outputs.testcases }} |
| 63 | + steps: |
| 64 | + - name: Checkout uipath-langchain-python |
| 65 | + uses: actions/checkout@v4 |
| 66 | + with: |
| 67 | + repository: 'UiPath/uipath-langchain-python' |
| 68 | + path: 'uipath-langchain-python' |
| 69 | + |
| 70 | + - name: Discover testcases |
| 71 | + id: discover |
| 72 | + working-directory: uipath-langchain-python |
| 73 | + run: | |
| 74 | + # Find all testcase folders (excluding common folders like README, etc.) |
| 75 | + testcase_dirs=$(find testcases -maxdepth 1 -type d -name "*-*" | sed 's|testcases/||' | sort) |
| 76 | +
|
| 77 | + echo "Found testcase directories:" |
| 78 | + echo "$testcase_dirs" |
| 79 | +
|
| 80 | + # Convert to JSON array for matrix |
| 81 | + testcases_json=$(echo "$testcase_dirs" | jq -R -s -c 'split("\n")[:-1]') |
| 82 | + echo "testcases=$testcases_json" >> $GITHUB_OUTPUT |
| 83 | +
|
| 84 | + run-uipath-langchain-integration-tests: |
| 85 | + runs-on: ubuntu-latest |
| 86 | + needs: [discover-testcases] |
| 87 | + container: |
| 88 | + image: ghcr.io/astral-sh/uv:python3.12-bookworm |
| 89 | + env: |
| 90 | + UIPATH_JOB_KEY: "3a03d5cb-fa21-4021-894d-a8e2eda0afe0" |
| 91 | + permissions: |
| 92 | + contents: read |
| 93 | + strategy: |
| 94 | + fail-fast: false |
| 95 | + matrix: |
| 96 | + testcase: ${{ fromJson(needs.discover-testcases.outputs.testcases) }} |
| 97 | + environment: [alpha, staging] # temporary disable [cloud] |
| 98 | + use_azure_chat: [true, false] |
| 99 | + |
| 100 | + name: "${{ matrix.testcase }} / ${{ matrix.environment }} / ${{ matrix.use_azure_chat && 'UiPathAzureChatOpenAI' || 'UiPathChat' }}" |
| 101 | + |
| 102 | + steps: |
| 103 | + - name: Checkout uipath-runtime-python |
| 104 | + uses: actions/checkout@v4 |
| 105 | + with: |
| 106 | + path: 'uipath-runtime-python' |
| 107 | + |
| 108 | + - name: Build uipath-runtime package |
| 109 | + working-directory: uipath-runtime-python |
| 110 | + run: uv build |
| 111 | + |
| 112 | + - name: Checkout uipath-langchain-python |
| 113 | + uses: actions/checkout@v4 |
| 114 | + with: |
| 115 | + repository: 'UiPath/uipath-langchain-python' |
| 116 | + path: 'uipath-langchain-python' |
| 117 | + |
| 118 | + - name: Update uipath-runtime version |
| 119 | + shell: bash |
| 120 | + working-directory: uipath-langchain-python |
| 121 | + run: uv add ../uipath-runtime-python/dist/*.whl --dev |
| 122 | + |
| 123 | + - name: Install dependencies |
| 124 | + working-directory: uipath-langchain-python |
| 125 | + run: uv sync |
| 126 | + |
| 127 | + - name: Run testcase |
| 128 | + env: |
| 129 | + CLIENT_ID: ${{ matrix.environment == 'alpha' && secrets.ALPHA_TEST_CLIENT_ID || matrix.environment == 'staging' && secrets.STAGING_TEST_CLIENT_ID || matrix.environment == 'cloud' && secrets.CLOUD_TEST_CLIENT_ID }} |
| 130 | + CLIENT_SECRET: ${{ matrix.environment == 'alpha' && secrets.ALPHA_TEST_CLIENT_SECRET || matrix.environment == 'staging' && secrets.STAGING_TEST_CLIENT_SECRET || matrix.environment == 'cloud' && secrets.CLOUD_TEST_CLIENT_SECRET }} |
| 131 | + BASE_URL: ${{ matrix.environment == 'alpha' && secrets.ALPHA_BASE_URL || matrix.environment == 'staging' && secrets.STAGING_BASE_URL || matrix.environment == 'cloud' && secrets.CLOUD_BASE_URL }} |
| 132 | + USE_AZURE_CHAT: ${{ matrix.use_azure_chat }} |
| 133 | + UV_PYTHON: "3.12" |
| 134 | + working-directory: uipath-langchain-python/testcases/${{ matrix.testcase }} |
| 135 | + run: | |
| 136 | + echo "Running testcase: ${{ matrix.testcase }}" |
| 137 | + echo "Environment: ${{ matrix.environment }}" |
| 138 | + echo "LLM: ${{ matrix.use_azure_chat && 'UiPathAzureChatOpenAI' || 'UiPathChat' }}" |
| 139 | + echo "USE_AZURE_CHAT: ${{ matrix.use_azure_chat }}" |
| 140 | +
|
| 141 | + # Execute the testcase run script directly |
| 142 | + bash run.sh |
| 143 | + bash ../common/validate_output.sh |
| 144 | +
|
0 commit comments