Skip to content

Commit 7ce616d

Browse files
committed
ci: add staging support and update integration test workflow
1 parent 3dfdf20 commit 7ce616d

7 files changed

Lines changed: 217 additions & 95 deletions

File tree

.github/workflows/integration_tests.yml

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,66 @@ 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)
1528
29+
echo "Found testcase directories:"
30+
echo "$testcase_dirs"
31+
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
39+
container:
40+
image: ghcr.io/astral-sh/uv:python3.12-bookworm
41+
env:
42+
UIPATH_JOB_KEY: "3a03d5cb-fa21-4021-894d-a8e2eda0afe0"
1643
strategy:
44+
fail-fast: false
1745
matrix:
18-
include:
19-
- build-dir: quickstart-agent
20-
- build-dir: simple-hitl-agent
21-
46+
testcase: ${{ fromJson(needs.discover-testcases.outputs.testcases) }}
47+
environment: [alpha, staging, cloud]
48+
49+
name: "${{ matrix.testcase }} / ${{ matrix.environment }}"
50+
2251
steps:
2352
- name: Checkout code
2453
uses: actions/checkout@v4
2554

26-
- name: Set up Docker Buildx
27-
uses: docker/setup-buildx-action@v3
55+
- name: Install Dependencies
56+
run: uv sync
2857

29-
- name: Build Docker image (${{ matrix.build-dir }})
58+
- name: Run testcase
59+
env:
60+
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 }}
61+
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 }}
62+
BASE_URL: ${{ matrix.environment == 'alpha' && secrets.ALPHA_BASE_URL || matrix.environment == 'staging' && secrets.STAGING_BASE_URL || matrix.environment == 'cloud' && secrets.CLOUD_BASE_URL }}
63+
working-directory: testcases/${{ matrix.testcase }}
3064
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-
.
65+
echo "Running testcase: ${{ matrix.testcase }}"
66+
echo "Environment: ${{ matrix.environment }}"
67+
echo "Working directory: $(pwd)"
68+
69+
# Execute the testcase run script directly
70+
bash run.sh
71+
bash ../common/validate_output.sh
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
# Common utility to print UiPath output file
4+
# Usage: source /app/testcases/common/validate_output.sh
5+
6+
debug_print_uipath_output() {
7+
echo "Printing output file..."
8+
if [ -f "__uipath/output.json" ]; then
9+
echo "=== OUTPUT FILE CONTENT ==="
10+
cat __uipath/output.json
11+
echo "=== END OUTPUT FILE CONTENT ==="
12+
else
13+
echo "ERROR: __uipath/output.json not found!"
14+
echo "Checking directory contents:"
15+
ls -la
16+
if [ -d "__uipath" ]; then
17+
echo "Contents of __uipath directory:"
18+
ls -la __uipath/
19+
else
20+
echo "__uipath directory does not exist!"
21+
fi
22+
fi
23+
}
24+
25+
validate_output() {
26+
echo "Printing output file for validation..."
27+
debug_print_uipath_output
28+
29+
echo "Validating output..."
30+
python src/assert.py || { echo "Validation failed!"; exit 1; }
31+
32+
echo "Testcase completed successfully."
33+
}
34+
35+
validate_output

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+
# Initialize the project
14+
echo "Initializing the project..."
15+
uv run uipath init
16+
17+
# Pack the agent
18+
echo "Packing agent..."
19+
uv run uipath pack
20+
21+
# Run the agent
22+
echo "Running agent..."
23+
echo "Input from input.json file"
24+
uv run uipath run agent --file input.json
25+
26+
echo "Testcase completed successfully."

testcases/quickstart-agent/uv.lock

Lines changed: 75 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testcases/simple-hitl-agent/Dockerfile

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

0 commit comments

Comments
 (0)