Skip to content

Commit dfd1bf6

Browse files
committed
ci: migrate to shared Docker image for integration tests
1 parent 3dfdf20 commit dfd1bf6

6 files changed

Lines changed: 130 additions & 87 deletions

File tree

.github/workflows/integration_tests.yml

Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,76 @@ on:
66
pull_request:
77
branches: [ main ]
88

9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
actions: read
13+
914
jobs:
10-
integration-tests:
15+
discover-testcases:
1116
runs-on: ubuntu-latest
12-
permissions:
13-
contents: read
14-
pull-requests: write
17+
outputs:
18+
testcases: ${{ steps.discover.outputs.testcases }}
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Discover testcases
24+
id: discover
25+
run: |
26+
# Find all testcase folders (excluding common folders like README, etc.)
27+
testcase_dirs=$(find testcases -maxdepth 1 -type d -name "*-*" | sed 's|testcases/||' | sort)
28+
29+
echo "Found testcase directories:"
30+
echo "$testcase_dirs"
1531
32+
# Convert to JSON array for matrix
33+
testcases_json=$(echo "$testcase_dirs" | jq -R -s -c 'split("\n")[:-1]')
34+
echo "testcases=$testcases_json" >> $GITHUB_OUTPUT
35+
36+
integration-tests:
37+
needs: [discover-testcases]
38+
runs-on: ubuntu-latest
1639
strategy:
40+
fail-fast: false
1741
matrix:
18-
include:
19-
- build-dir: quickstart-agent
20-
- build-dir: simple-hitl-agent
21-
42+
testcase: ${{ fromJson(needs.discover-testcases.outputs.testcases) }}
43+
environment: [alpha, cloud]
44+
use_azure_chat: [true, false]
45+
46+
name: "${{ matrix.testcase }} / ${{ matrix.environment }} / ${{ matrix.use_azure_chat && 'UiPathAzureChatOpenAI' || 'UiPathChat' }}"
47+
2248
steps:
2349
- name: Checkout code
2450
uses: actions/checkout@v4
2551

2652
- name: Set up Docker Buildx
2753
uses: docker/setup-buildx-action@v3
2854

29-
- name: Build Docker image (${{ matrix.build-dir }})
55+
- name: Build Docker image
56+
run: |
57+
echo "Building Docker image for ${{ matrix.testcase }} at $(date)"
58+
docker build -f testcases/Dockerfile \
59+
-t uipath-llamaindex-testbase:latest \
60+
.
61+
echo "Docker image built at $(date)"
62+
63+
- name: Run testcase
64+
env:
65+
CLIENT_ID: ${{ matrix.environment == 'alpha' && secrets.ALPHA_TEST_CLIENT_ID || secrets.CLOUD_TEST_CLIENT_ID }}
66+
CLIENT_SECRET: ${{ matrix.environment == 'alpha' && secrets.ALPHA_TEST_CLIENT_SECRET || secrets.CLOUD_TEST_CLIENT_SECRET }}
67+
BASE_URL: ${{ matrix.environment == 'alpha' && secrets.ALPHA_BASE_URL || secrets.CLOUD_BASE_URL }}
68+
USE_AZURE_CHAT: ${{ matrix.use_azure_chat }}
3069
run: |
31-
docker build -f testcases/${{ matrix.build-dir }}/Dockerfile \
32-
-t ${{ matrix.build-dir }}:test \
33-
--build-arg CLIENT_ID="${{ secrets.ALPHA_TEST_CLIENT_ID }}" \
34-
--build-arg CLIENT_SECRET="${{ secrets.ALPHA_TEST_CLIENT_SECRET }}" \
35-
--build-arg BASE_URL="${{ secrets.ALPHA_BASE_URL }}" \
36-
.
70+
echo "Running testcase: ${{ matrix.testcase }}"
71+
echo "Environment: ${{ matrix.environment }}"
72+
echo "LLM: ${{ matrix.use_azure_chat && 'UiPathAzureChatOpenAI' || 'UiPathChat' }}"
73+
echo "USE_AZURE_CHAT: ${{ matrix.use_azure_chat }}"
74+
75+
docker run --rm \
76+
-e CLIENT_ID="$CLIENT_ID" \
77+
-e CLIENT_SECRET="$CLIENT_SECRET" \
78+
-e BASE_URL="$BASE_URL" \
79+
-e USE_AZURE_CHAT="$USE_AZURE_CHAT" \
80+
uipath-llamaindex-testbase:latest \
81+
bash /app/testcases/${{ matrix.testcase }}/run.sh

testcases/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm
2+
3+
WORKDIR /app
4+
5+
COPY . .
6+
7+
# Install dependencies for all testcases
8+
RUN uv sync
9+
10+
11+
# Set environment variables for runtime
12+
ENV UIPATH_TENANT_ID=${UIPATH_TENANT_ID:-""}
13+
ENV UIPATH_JOB_KEY=8c6a342e-036e-492c-a3d2-99e66f6554ce
14+
15+
CMD ["bash"]

testcases/quickstart-agent/Dockerfile

Lines changed: 0 additions & 35 deletions
This file was deleted.

testcases/quickstart-agent/run.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
cd /app/testcases/quickstart-agent
4+
5+
# Sync dependencies for this specific testcase
6+
echo "Syncing dependencies..."
7+
uv sync
8+
9+
# Authenticate with UiPath
10+
echo "Authenticating with UiPath..."
11+
uv run uipath auth --client-id="$CLIENT_ID" --client-secret="$CLIENT_SECRET" --base-url="$BASE_URL"
12+
13+
# Pack the agent
14+
echo "Packing agent..."
15+
uv run uipath pack
16+
17+
# Run the agent
18+
echo "Running agent..."
19+
echo "Input from input.json file"
20+
uv run uipath run agent --file input.json
21+
22+
# Validate output
23+
echo "Validating output..."
24+
python src/assert.py || { echo "Validation failed!"; exit 1; }
25+
26+
echo "Testcase completed successfully."

testcases/simple-hitl-agent/Dockerfile

Lines changed: 0 additions & 37 deletions
This file was deleted.

testcases/simple-hitl-agent/run.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
cd /app/testcases/simple-hitl-agent
4+
5+
# Sync dependencies for this specific testcase
6+
echo "Syncing dependencies..."
7+
uv sync
8+
9+
# Authenticate with UiPath
10+
echo "Authenticating with UiPath..."
11+
uv run uipath auth --client-id="$CLIENT_ID" --client-secret="$CLIENT_SECRET" --base-url="$BASE_URL"
12+
13+
# Pack the agent
14+
echo "Packing agent..."
15+
uv run uipath pack
16+
17+
# Run the agent
18+
echo "Running agent..."
19+
echo "Input from input.json file"
20+
uv run uipath run agent --file input.json
21+
22+
echo "Resuming agent run with human response..."
23+
uv run uipath run agent --file human_response.json --resume
24+
25+
# Validate output
26+
echo "Validating output..."
27+
python src/assert.py || { echo "Validation failed!"; exit 1; }
28+
29+
echo "Testcase completed successfully."

0 commit comments

Comments
 (0)