1- name : uipath - Test LlamaIndex
1+ name : uipath - Test Integrations
22
33on :
44 pull_request :
99 runs-on : ubuntu-latest
1010 permissions :
1111 contents : read
12- if : contains(github.event.pull_request.labels.*.name, 'test:uipath-llamaindex ')
12+ if : contains(github.event.pull_request.labels.*.name, 'test:uipath-integrations ')
1313 steps :
1414 - name : Checkout uipath-python
1515 uses : actions/checkout@v4
@@ -40,14 +40,44 @@ jobs:
4040 name : uipath-wheels
4141 path : packages/*/dist/*.whl
4242
43- test-uipath-llamaindex :
43+ discover-packages :
4444 needs : [build-wheels]
45+ runs-on : ubuntu-latest
46+ permissions :
47+ contents : read
48+ outputs :
49+ packages : ${{ steps.discover.outputs.packages }}
50+ steps :
51+ - name : Checkout uipath-integrations-python
52+ uses : actions/checkout@v4
53+ with :
54+ repository : ' UiPath/uipath-integrations-python'
55+ path : ' uipath-integrations-python'
56+
57+ - name : Discover packages
58+ id : discover
59+ working-directory : uipath-integrations-python
60+ run : |
61+ # Find every package directory under packages/ that has a pyproject.toml
62+ package_dirs=$(find packages -maxdepth 2 -name pyproject.toml -printf '%h\n' | sed 's|^packages/||' | sort)
63+
64+ echo "Found integration packages:"
65+ echo "$package_dirs"
66+
67+ packages_json=$(echo "$package_dirs" | jq -R -s -c 'split("\n")[:-1]')
68+ echo "packages=$packages_json" >> $GITHUB_OUTPUT
69+
70+ test-package :
71+ needs : [build-wheels, discover-packages]
4572 runs-on : ${{ matrix.os }}
4673 strategy :
74+ fail-fast : false
4775 matrix :
76+ package : ${{ fromJson(needs.discover-packages.outputs.packages) }}
4877 python-version : [ "3.11", "3.12", "3.13" ]
4978 os : [ ubuntu-latest, windows-latest ]
5079
80+ name : " ${{ matrix.package }} / py${{ matrix.python-version }} / ${{ matrix.os }}"
5181 permissions :
5282 contents : read
5383
@@ -74,49 +104,76 @@ jobs:
74104
75105 - name : Update uipath packages
76106 shell : bash
77- working-directory : uipath-integrations-python/packages/uipath-llamaindex
107+ working-directory : uipath-integrations-python/packages/${{ matrix.package }}
78108 run : |
79109 uv add ../../../wheels/uipath-core/dist/*.whl --dev
80110 uv add ../../../wheels/uipath-platform/dist/*.whl --dev
81111 uv add ../../../wheels/uipath/dist/*.whl --dev
82112
83- - name : Run uipath-llamaindex tests
84- working-directory : uipath-integrations-python/packages/uipath-llamaindex
113+ - name : Install dependencies and run tests
114+ shell : bash
115+ working-directory : uipath-integrations-python/packages/${{ matrix.package }}
85116 run : |
86117 uv sync
87- uv run pytest
118+ if [ -d tests ]; then
119+ uv run pytest
120+ else
121+ echo "No tests directory found in ${{ matrix.package }}, skipping pytest"
122+ fi
88123
89124 discover-testcases :
125+ needs : [test-package, discover-packages]
90126 runs-on : ubuntu-latest
91127 permissions :
92128 contents : read
93- needs : [test-uipath-llamaindex]
94129 outputs :
95- testcases : ${{ steps.discover.outputs.testcases }}
130+ matrix : ${{ steps.discover.outputs.matrix }}
131+ has_testcases : ${{ steps.discover.outputs.has_testcases }}
96132 steps :
97133 - name : Checkout uipath-integrations-python
98134 uses : actions/checkout@v4
99135 with :
100136 repository : ' UiPath/uipath-integrations-python'
101137 path : ' uipath-integrations-python'
102138
103- - name : Discover testcases
139+ - name : Discover testcases across packages
104140 id : discover
105- working-directory : uipath-integrations-python/packages/uipath-llamaindex
141+ working-directory : uipath-integrations-python
106142 run : |
107- # Find all testcase folders (excluding common folders like README, etc.)
108- testcase_dirs=$(find testcases -maxdepth 1 -type d -name "*-*" | sed 's|testcases/||' | sort)
109-
110- echo "Found testcase directories:"
111- echo "$testcase_dirs"
112-
113- # Convert to JSON array for matrix
114- testcases_json=$(echo "$testcase_dirs" | jq -R -s -c 'split("\n")[:-1]')
115- echo "testcases=$testcases_json" >> $GITHUB_OUTPUT
116-
117- run-uipath-llamaindex-integration-tests :
118- runs-on : ubuntu-latest
143+ # For each package with a testcases/ directory, list its testcase folders
144+ # and emit one matrix entry per (package, testcase) pair.
145+ entries="[]"
146+ for pkg_dir in packages/*/; do
147+ pkg=$(basename "$pkg_dir")
148+ tc_dir="$pkg_dir/testcases"
149+ if [ ! -d "$tc_dir" ]; then
150+ continue
151+ fi
152+ testcases=$(find "$tc_dir" -maxdepth 1 -type d -name "*-*" -printf '%f\n' | sort)
153+ if [ -z "$testcases" ]; then
154+ continue
155+ fi
156+ for tc in $testcases; do
157+ entries=$(echo "$entries" | jq --arg p "$pkg" --arg t "$tc" '. + [{package: $p, testcase: $t}]')
158+ done
159+ done
160+
161+ echo "Discovered testcase matrix:"
162+ echo "$entries" | jq .
163+
164+ count=$(echo "$entries" | jq 'length')
165+ if [ "$count" -eq 0 ]; then
166+ echo "has_testcases=false" >> $GITHUB_OUTPUT
167+ echo "matrix=[]" >> $GITHUB_OUTPUT
168+ else
169+ echo "has_testcases=true" >> $GITHUB_OUTPUT
170+ echo "matrix=$(echo "$entries" | jq -c .)" >> $GITHUB_OUTPUT
171+ fi
172+
173+ run-integration-tests :
119174 needs : [build-wheels, discover-testcases]
175+ if : needs.discover-testcases.outputs.has_testcases == 'true'
176+ runs-on : ubuntu-latest
120177 container :
121178 image : ghcr.io/astral-sh/uv:python3.12-bookworm
122179 env :
@@ -127,10 +184,10 @@ jobs:
127184 strategy :
128185 fail-fast : false
129186 matrix :
130- testcase : ${{ fromJson(needs.discover-testcases.outputs.testcases ) }}
187+ include : ${{ fromJson(needs.discover-testcases.outputs.matrix ) }}
131188 environment : [alpha, staging] # temporary disable [cloud]
132189
133- name : " ${{ matrix.testcase }} / ${{ matrix.environment }}"
190+ name : " ${{ matrix.package }} / ${{ matrix. testcase }} / ${{ matrix.environment }}"
134191
135192 steps :
136193 - name : Download wheels
@@ -147,14 +204,14 @@ jobs:
147204
148205 - name : Update uipath packages
149206 shell : bash
150- working-directory : uipath-integrations-python/packages/uipath-llamaindex
207+ working-directory : uipath-integrations-python/packages/${{ matrix.package }}
151208 run : |
152209 uv add ../../../wheels/uipath-core/dist/*.whl
153210 uv add ../../../wheels/uipath-platform/dist/*.whl
154211 uv add ../../../wheels/uipath/dist/*.whl
155212
156213 - name : Install dependencies
157- working-directory : uipath-integrations-python/packages/uipath-llamaindex
214+ working-directory : uipath-integrations-python/packages/${{ matrix.package }}
158215 run : uv sync
159216
160217 - name : Run testcase
@@ -163,11 +220,11 @@ jobs:
163220 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 }}
164221 BASE_URL : ${{ matrix.environment == 'alpha' && secrets.ALPHA_BASE_URL || matrix.environment == 'staging' && secrets.STAGING_BASE_URL || matrix.environment == 'cloud' && secrets.CLOUD_BASE_URL }}
165222 UV_PYTHON : " 3.12"
166- working-directory : uipath-integrations-python/packages/uipath-llamaindex /testcases/${{ matrix.testcase }}
223+ working-directory : uipath-integrations-python/packages/${{ matrix.package }} /testcases/${{ matrix.testcase }}
167224 run : |
168- echo "Running testcase: ${{ matrix.testcase }}"
225+ echo "Package: ${{ matrix.package }}"
226+ echo "Testcase: ${{ matrix.testcase }}"
169227 echo "Environment: ${{ matrix.environment }}"
170228
171- # Execute the testcase run script directly
172229 bash run.sh
173230 bash ../common/validate_output.sh
0 commit comments