-
Notifications
You must be signed in to change notification settings - Fork 9
131 lines (113 loc) · 4.78 KB
/
integration_tests.yml
File metadata and controls
131 lines (113 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Integration testing
on:
push:
branches: [ main, develop ]
paths:
- 'packages/**'
- '.github/workflows/integration_tests.yml'
- '.github/scripts/detect_changed_packages.py'
pull_request:
branches: [ main ]
paths:
- 'packages/**'
- '.github/workflows/integration_tests.yml'
- '.github/scripts/detect_changed_packages.py'
permissions:
contents: read
pull-requests: write
actions: read
jobs:
detect-changed-packages:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.detect.outputs.packages }}
count: ${{ steps.detect.outputs.count }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Detect changed packages
id: detect
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.event.after }}
run: python .github/scripts/detect_changed_packages.py
discover-testcases:
needs: detect-changed-packages
if: needs.detect-changed-packages.outputs.count > 0
runs-on: ubuntu-latest
outputs:
testcases: ${{ steps.discover.outputs.testcases }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Discover testcases for changed packages
id: discover
run: |
# Get list of packages to check
PACKAGES='${{ needs.detect-changed-packages.outputs.packages }}'
# Find all testcases in changed packages only
testcases_array="[]"
for package_name in $(echo "$PACKAGES" | jq -r '.[]'); do
testcases_dir="packages/$package_name/testcases"
if [ -d "$testcases_dir" ]; then
echo "Discovering testcases in $package_name"
# Find all testcase folders in this package
for testcase_dir in "$testcases_dir"/*; do
if [ -d "$testcase_dir" ]; then
testcase_name=$(basename "$testcase_dir")
# Skip 'common' directory if it exists
if [ "$testcase_name" != "common" ]; then
echo " Found: $testcase_name"
testcases_array=$(echo "$testcases_array" | jq -c ". += [{\"package\": \"$package_name\", \"testcase\": \"$testcase_name\"}]")
fi
fi
done
fi
done
echo "Testcases matrix: $testcases_array"
echo "testcases=$testcases_array" >> $GITHUB_OUTPUT
integration-tests:
needs: [detect-changed-packages, discover-testcases]
if: needs.discover-testcases.outputs.testcases != '[]'
runs-on: ubuntu-latest
timeout-minutes: 10
container:
image: ghcr.io/astral-sh/uv:python3.12-bookworm
env:
UIPATH_JOB_KEY: "3a03d5cb-fa21-4021-894d-a8e2eda0afe0"
UIPATH_TRACING_ENABLED: false
defaults:
run:
working-directory: packages/${{ matrix.testcase-info.package }}
strategy:
fail-fast: false
matrix:
testcase-info: ${{ fromJson(needs.discover-testcases.outputs.testcases) }}
environment: [alpha, cloud, staging]
name: "${{ matrix.testcase-info.package }}/${{ matrix.testcase-info.testcase }} / ${{ matrix.environment }}"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Dependencies
run: uv sync
- name: Run testcase
env:
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 }}
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 }}
BASE_URL: ${{ matrix.environment == 'alpha' && secrets.ALPHA_BASE_URL || matrix.environment == 'staging' && secrets.STAGING_BASE_URL || matrix.environment == 'cloud' && secrets.CLOUD_BASE_URL }}
working-directory: packages/${{ matrix.testcase-info.package }}/testcases/${{ matrix.testcase-info.testcase }}
run: |
echo "Running testcase: ${{ matrix.testcase-info.testcase }}"
echo "Package: ${{ matrix.testcase-info.package }}"
echo "Environment: ${{ matrix.environment }}"
echo "Working directory: $(pwd)"
# Execute the testcase run script directly
bash run.sh
bash ../common/validate_output.sh