Skip to content

Commit e873ab2

Browse files
feat: add github actions for testing
1 parent 1abc6a1 commit e873ab2

3 files changed

Lines changed: 314 additions & 1 deletion

File tree

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
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.10", "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-python
23+
uses: actions/checkout@v4
24+
with:
25+
path: 'uipath-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-python package
36+
run: |
37+
cd uipath-python
38+
uv build
39+
40+
- name: Checkout uipath-langchain-python
41+
uses: actions/checkout@v4
42+
with:
43+
repository: 'UiPath/uipath-langchain-python'
44+
path: 'uipath-langchain-python'
45+
46+
- name: Update uipath-python version
47+
shell: bash
48+
run: |
49+
cd uipath-langchain-python
50+
uv add ../uipath-python/dist/*.whl --dev
51+
52+
- name: Run uipath-langchain tests
53+
run: |
54+
cd uipath-langchain-python
55+
uv sync
56+
uv run pytest
57+
58+
run-uipath-langchain-integration-tests:
59+
runs-on: ubuntu-latest
60+
needs: [test-uipath-langchain]
61+
permissions:
62+
contents: read
63+
steps:
64+
65+
- name: Checkout uipath-python
66+
uses: actions/checkout@v4
67+
with:
68+
path: 'uipath-python'
69+
70+
- name: Setup uv
71+
uses: astral-sh/setup-uv@v5
72+
73+
- name: Build uipath-python package
74+
run: |
75+
cd uipath-python
76+
uv build
77+
78+
- name: Checkout uipath-langchain-python
79+
uses: actions/checkout@v4
80+
with:
81+
repository: 'UiPath/uipath-langchain-python'
82+
path: 'uipath-langchain-python'
83+
84+
- name: Copy wheel to uipath-langchain
85+
run: |
86+
mkdir -p uipath-langchain-python/wheels
87+
cp uipath-python/dist/*.whl uipath-langchain-python/wheels/
88+
89+
- name: Update uipath-python version
90+
shell: bash
91+
run: |
92+
cd uipath-langchain-python
93+
WHL=$(ls wheels/*.whl | head -n1)
94+
WHL_NAME=$(basename "$WHL")
95+
echo "Using wheel: $WHL_NAME"
96+
sed -i "s|uipath>=.*|uipath @ file:///app/wheels/$WHL_NAME\",|" pyproject.toml
97+
98+
if ! grep -q '\[tool.hatch.metadata\]' pyproject.toml; then
99+
echo -e '\n[tool.hatch.metadata]\nallow-direct-references = true' >> pyproject.toml
100+
fi
101+
102+
- name: Discover testcases
103+
id: discover
104+
run: |
105+
cd uipath-langchain-python
106+
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+
- name: Set up Docker Buildx
118+
uses: docker/setup-buildx-action@v3
119+
120+
- name: Build Docker image
121+
run: |
122+
cd uipath-langchain-python
123+
echo "Building Docker image at $(date)"
124+
docker build -f testcases/Dockerfile \
125+
-t uipath-langchain-testbase:latest .
126+
echo "Docker image built at $(date)"
127+
128+
- name: Run integration tests
129+
env:
130+
TESTCASES: ${{ steps.discover.outputs.testcases }}
131+
ALPHA_TEST_CLIENT_ID: ${{ secrets.ALPHA_TEST_CLIENT_ID }}
132+
ALPHA_TEST_CLIENT_SECRET: ${{ secrets.ALPHA_TEST_CLIENT_SECRET }}
133+
ALPHA_BASE_URL: ${{ secrets.ALPHA_BASE_URL }}
134+
CLOUD_TEST_CLIENT_ID: ${{ secrets.CLOUD_TEST_CLIENT_ID }}
135+
CLOUD_TEST_CLIENT_SECRET: ${{ secrets.CLOUD_TEST_CLIENT_SECRET }}
136+
CLOUD_BASE_URL: ${{ secrets.CLOUD_BASE_URL }}
137+
run: |
138+
cd uipath-langchain-python
139+
140+
testcases=$(echo $TESTCASES | jq -c '.')
141+
142+
environments=("alpha" "cloud")
143+
use_azure_chat_options=("true" "false")
144+
145+
for testcase in $(echo "$testcases" | jq -r '.[]'); do
146+
for environment in "${environments[@]}"; do
147+
for use_azure_chat in "${use_azure_chat_options[@]}"; do
148+
echo "Running testcase: $testcase"
149+
echo "Environment: $environment"
150+
echo "LLM: $( [ $use_azure_chat == "true" ] && echo "UiPathAzureChatOpenAI" || echo "UiPathChat" )"
151+
echo "USE_AZURE_CHAT: $use_azure_chat"
152+
153+
if [ "$environment" == "alpha" ]; then
154+
CLIENT_ID=$ALPHA_TEST_CLIENT_ID
155+
CLIENT_SECRET=$ALPHA_TEST_CLIENT_SECRET
156+
BASE_URL=$ALPHA_BASE_URL
157+
else
158+
CLIENT_ID=$CLOUD_TEST_CLIENT_ID
159+
CLIENT_SECRET=$CLOUD_TEST_CLIENT_SECRET
160+
BASE_URL=$CLOUD_BASE_URL
161+
fi
162+
163+
docker run --rm \
164+
-e CLIENT_ID="$CLIENT_ID" \
165+
-e CLIENT_SECRET="$CLIENT_SECRET" \
166+
-e BASE_URL="$BASE_URL" \
167+
-e USE_AZURE_CHAT="$use_azure_chat" \
168+
uipath-langchain-testbase:latest \
169+
bash "/app/testcases/$testcase/run.sh"
170+
done
171+
done
172+
done
173+
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Test UiPath LlamaIndex
2+
3+
on:
4+
pull_request:
5+
types: [ opened, synchronize, reopened, labeled ]
6+
7+
jobs:
8+
test-uipath-llamaindex:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
python-version: [ "3.10", "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-llamaindex label
19+
if: contains(github.event.pull_request.labels.*.name, 'test:uipath-llamaindex')
20+
21+
steps:
22+
- name: Checkout uipath-python
23+
uses: actions/checkout@v4
24+
with:
25+
path: 'uipath-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-python package
36+
run: |
37+
cd uipath-python
38+
uv build
39+
40+
- name: Checkout uipath-llamaindex-python
41+
uses: actions/checkout@v4
42+
with:
43+
repository: 'UiPath/uipath-llamaindex-python'
44+
path: 'uipath-llamaindex-python'
45+
46+
- name: Update uipath-python version
47+
shell: bash
48+
run: |
49+
cd uipath-llamaindex-python
50+
uv add ../uipath-python/dist/*.whl --dev
51+
52+
- name: Run uipath-llamaindex tests
53+
run: |
54+
cd uipath-llamaindex-python
55+
uv sync
56+
uv run pytest
57+
58+
run-uipath-llama-index-integration-tests:
59+
runs-on: ubuntu-latest
60+
needs: test-uipath-llamaindex
61+
permissions:
62+
contents: read
63+
steps:
64+
65+
- name: Checkout uipath-python
66+
uses: actions/checkout@v4
67+
with:
68+
path: 'uipath-python'
69+
70+
- name: Setup uv
71+
uses: astral-sh/setup-uv@v5
72+
73+
- name: Build uipath-python package
74+
run: |
75+
cd uipath-python
76+
uv build
77+
78+
- name: Checkout uipath-llamaindex-python
79+
uses: actions/checkout@v4
80+
with:
81+
repository: 'UiPath/uipath-llamaindex-python'
82+
path: 'uipath-llamaindex-python'
83+
84+
- name: Copy wheel file to uipath-llamaindex-python
85+
run: |
86+
mkdir -p uipath-llamaindex-python/wheels
87+
cp uipath-python/dist/*.whl uipath-llamaindex-python/wheels/
88+
89+
- name: Update uipath-python version
90+
shell: bash
91+
run: |
92+
cd uipath-llamaindex-python
93+
WHL=$(ls wheels/*.whl | head -n1)
94+
WHL_NAME=$(basename "$WHL")
95+
echo "Using wheel: $WHL_NAME"
96+
sed -i "s|uipath>=.*|uipath @ file:///app/wheels/$WHL_NAME\",|" pyproject.toml
97+
98+
if ! grep -q '\[tool.hatch.metadata\]' pyproject.toml; then
99+
echo -e '\n[tool.hatch.metadata]\nallow-direct-references = true' >> pyproject.toml
100+
fi
101+
102+
- name: Discover testcases
103+
id: discover
104+
run: |
105+
cd uipath-llamaindex-python
106+
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+
- name: Set up Docker Buildx
118+
uses: docker/setup-buildx-action@v3
119+
120+
- name: Build Docker image and run integration tests
121+
env:
122+
TESTCASES: ${{ steps.discover.outputs.testcases }}
123+
ALPHA_TEST_CLIENT_ID: ${{ secrets.ALPHA_TEST_CLIENT_ID }}
124+
ALPHA_TEST_CLIENT_SECRET: ${{ secrets.ALPHA_TEST_CLIENT_SECRET }}
125+
ALPHA_BASE_URL: ${{ secrets.ALPHA_BASE_URL }}
126+
run: |
127+
cd uipath-llamaindex-python
128+
129+
testcases=$(echo $TESTCASES | jq -c '.')
130+
131+
for testcase in $(echo "$testcases" | jq -r '.[]'); do
132+
echo "Running testcase: $testcase"
133+
134+
docker build -f testcases/$testcase/Dockerfile \
135+
-t $testcase:test \
136+
--build-arg CLIENT_ID="$ALPHA_TEST_CLIENT_ID" \
137+
--build-arg CLIENT_SECRET="$ALPHA_TEST_CLIENT_SECRET" \
138+
--build-arg BASE_URL="$ALPHA_BASE_URL" \
139+
.
140+
done

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath"
3-
version = "2.1.70"
3+
version = "2.1.720"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.10"

0 commit comments

Comments
 (0)