-
Notifications
You must be signed in to change notification settings - Fork 28
366 lines (314 loc) · 13.8 KB
/
Copy pathtest-packages.yml
File metadata and controls
366 lines (314 loc) · 13.8 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
name: Test Packages
on:
workflow_call:
secrets:
SONAR_TOKEN:
required: false
env:
SAFE_CHAIN_MINIMUM_PACKAGE_AGE_EXCLUSIONS: uipath-runtime
permissions:
contents: read
jobs:
detect-changed-packages:
runs-on: uipath-ubuntu-latest
outputs:
packages: ${{ steps.detect.outputs.packages }}
count: ${{ steps.detect.outputs.count }}
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.11"
- name: Detect changed packages
id: detect
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: python .github/scripts/detect_changed_packages.py
test-uipath-core:
name: Test (uipath-core, ${{ matrix.python-version }}, ${{ matrix.os }})
needs: detect-changed-packages
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: [uipath-ubuntu-latest, uipath-windows-latest]
steps:
- name: Check if package changed
id: check
shell: bash
run: |
if echo '${{ needs.detect-changed-packages.outputs.packages }}' | jq -e 'index("uipath-core")' > /dev/null; then
echo "skip=false" >> $GITHUB_OUTPUT
else
echo "skip=true" >> $GITHUB_OUTPUT
fi
- name: Skip
if: steps.check.outputs.skip == 'true'
shell: bash
run: echo "Skipping - no changes to uipath-core"
- name: Checkout
if: steps.check.outputs.skip != 'true'
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Setup uv
if: steps.check.outputs.skip != 'true'
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
- name: Setup Python
if: steps.check.outputs.skip != 'true'
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: steps.check.outputs.skip != 'true'
working-directory: packages/uipath-core
run: uv sync --all-extras --python ${{ matrix.python-version }}
- name: Run tests
if: steps.check.outputs.skip != 'true' && !(matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13')
working-directory: packages/uipath-core
run: uv run pytest
- name: Run tests with coverage
if: steps.check.outputs.skip != 'true' && matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13'
working-directory: packages/uipath-core
run: uv run pytest --cov-report=xml --cov-report=html --tb=short
- name: Upload coverage HTML report
if: steps.check.outputs.skip != 'true' && matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13' && always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-html-uipath-core
path: packages/uipath-core/htmlcov/
retention-days: 30
- name: Upload coverage XML report
if: steps.check.outputs.skip != 'true' && matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13' && always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-xml-uipath-core
path: packages/uipath-core/coverage.xml
retention-days: 30
test-uipath-platform:
name: Test (uipath-platform, ${{ matrix.python-version }}, ${{ matrix.os }})
needs: detect-changed-packages
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: [uipath-ubuntu-latest, uipath-windows-latest]
steps:
- name: Check if package changed
id: check
shell: bash
run: |
if echo '${{ needs.detect-changed-packages.outputs.packages }}' | jq -e 'index("uipath-platform")' > /dev/null; then
echo "skip=false" >> $GITHUB_OUTPUT
else
echo "skip=true" >> $GITHUB_OUTPUT
fi
- name: Skip
if: steps.check.outputs.skip == 'true'
shell: bash
run: echo "Skipping - no changes to uipath-platform"
- name: Checkout
if: steps.check.outputs.skip != 'true'
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Setup uv
if: steps.check.outputs.skip != 'true'
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
- name: Setup Python
if: steps.check.outputs.skip != 'true'
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: steps.check.outputs.skip != 'true'
working-directory: packages/uipath-platform
run: uv sync --all-extras --python ${{ matrix.python-version }}
- name: Run tests
if: steps.check.outputs.skip != 'true' && !(matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13')
working-directory: packages/uipath-platform
run: uv run pytest
- name: Run tests with coverage
if: steps.check.outputs.skip != 'true' && matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13'
working-directory: packages/uipath-platform
run: uv run pytest --cov-report=xml --cov-report=html --tb=short
- name: Upload coverage HTML report
if: steps.check.outputs.skip != 'true' && matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13' && always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-html-uipath-platform
path: packages/uipath-platform/htmlcov/
retention-days: 30
- name: Upload coverage XML report
if: steps.check.outputs.skip != 'true' && matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13' && always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-xml-uipath-platform
path: packages/uipath-platform/coverage.xml
retention-days: 30
e2e-uipath-platform:
name: E2E (uipath-platform, memory)
needs: detect-changed-packages
runs-on: uipath-ubuntu-latest
steps:
- name: Check if package changed
id: check
shell: bash
run: |
if echo '${{ needs.detect-changed-packages.outputs.packages }}' | jq -e 'index("uipath-platform")' > /dev/null; then
echo "skip=false" >> $GITHUB_OUTPUT
else
echo "skip=true" >> $GITHUB_OUTPUT
fi
- name: Skip
if: steps.check.outputs.skip == 'true'
shell: bash
run: echo "Skipping - no changes to uipath-platform"
- name: Checkout
if: steps.check.outputs.skip != 'true'
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Setup uv
if: steps.check.outputs.skip != 'true'
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
- name: Setup Python
if: steps.check.outputs.skip != 'true'
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.11"
- name: Install dependencies
if: steps.check.outputs.skip != 'true'
working-directory: packages/uipath-platform
run: uv sync --all-extras --python 3.11
- name: Run E2E memory tests
if: steps.check.outputs.skip != 'true'
working-directory: packages/uipath-platform
env:
UIPATH_URL: ${{ secrets.ALPHA_BASE_URL }}
UIPATH_CLIENT_ID: ${{ secrets.ALPHA_TEST_CLIENT_ID }}
UIPATH_CLIENT_SECRET: ${{ secrets.ALPHA_TEST_CLIENT_SECRET }}
UIPATH_FOLDER_KEY: ${{ secrets.UIPATH_MEMORY_FOLDER }}
run: uv run pytest tests/services/test_memory_service_e2e.py -m e2e -v --no-cov
test-uipath:
name: Test (uipath, ${{ matrix.python-version }}, ${{ matrix.os }})
needs: detect-changed-packages
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: [uipath-ubuntu-latest, uipath-windows-latest]
steps:
- name: Check if package changed
id: check
shell: bash
run: |
if echo '${{ needs.detect-changed-packages.outputs.packages }}' | jq -e 'index("uipath")' > /dev/null; then
echo "skip=false" >> $GITHUB_OUTPUT
else
echo "skip=true" >> $GITHUB_OUTPUT
fi
- name: Skip
if: steps.check.outputs.skip == 'true'
shell: bash
run: echo "Skipping - no changes to uipath"
- name: Checkout
if: steps.check.outputs.skip != 'true'
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Setup uv
if: steps.check.outputs.skip != 'true'
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
- name: Setup Python
if: steps.check.outputs.skip != 'true'
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: steps.check.outputs.skip != 'true'
working-directory: packages/uipath
run: uv sync --all-extras --python ${{ matrix.python-version }}
- name: Run tests
if: steps.check.outputs.skip != 'true' && !(matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13')
working-directory: packages/uipath
run: uv run pytest
- name: Run tests with coverage
if: steps.check.outputs.skip != 'true' && matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13'
working-directory: packages/uipath
run: uv run pytest --cov-report=xml --cov-report=html --tb=short
- name: Upload coverage HTML report
if: steps.check.outputs.skip != 'true' && matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13' && always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-html-uipath
path: packages/uipath/htmlcov/
retention-days: 30
- name: Upload coverage XML report
if: steps.check.outputs.skip != 'true' && matrix.os == 'uipath-ubuntu-latest' && matrix.python-version == '3.13' && always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-xml-uipath
path: packages/uipath/coverage.xml
retention-days: 30
continue-on-error: true
sonarcloud:
name: SonarCloud
needs: [test-uipath-core, test-uipath-platform, test-uipath]
runs-on: uipath-ubuntu-latest
if: always() && needs.test-uipath-core.result != 'failure' && needs.test-uipath-platform.result != 'failure' && needs.test-uipath.result != 'failure'
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
fetch-depth: 0
- name: Download uipath-core coverage
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
continue-on-error: true
with:
name: coverage-xml-uipath-core
path: packages/uipath-core
- name: Download uipath-platform coverage
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
continue-on-error: true
with:
name: coverage-xml-uipath-platform
path: packages/uipath-platform
- name: Download uipath coverage
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
continue-on-error: true
with:
name: coverage-xml-uipath
path: packages/uipath
- name: Rewrite coverage XML <source> to repo-relative paths
run: |
sed -i 's|<source>src</source>|<source>packages/uipath-core/src</source>|g' packages/uipath-core/coverage.xml || true
sed -i 's|<source>src</source>|<source>packages/uipath-platform/src</source>|g' packages/uipath-platform/coverage.xml || true
sed -i 's|<source>src</source>|<source>packages/uipath/src</source>|g' packages/uipath/coverage.xml || true
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@2f77a1ec69fb1d595b06f35ab27e97605bdef703 # v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
test-gate:
name: Test
needs: [test-uipath-core, test-uipath-platform, test-uipath, e2e-uipath-platform]
runs-on: uipath-ubuntu-latest
if: always()
steps:
- name: Check test results
run: |
if [[ "${{ needs.test-uipath-core.result }}" == "failure" || \
"${{ needs.test-uipath-platform.result }}" == "failure" || \
"${{ needs.test-uipath.result }}" == "failure" ]]; then
echo "Tests failed"
exit 1
fi
# E2E tests are informational — log but don't block
if [[ "${{ needs.e2e-uipath-platform.result }}" == "failure" ]]; then
echo "⚠️ E2E memory tests failed (non-blocking)"
fi
echo "All tests passed"