-
Notifications
You must be signed in to change notification settings - Fork 33
91 lines (77 loc) · 3.55 KB
/
test.yml
File metadata and controls
91 lines (77 loc) · 3.55 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
name: Test
on:
workflow_call:
secrets:
UIPATH_URL:
required: true
UIPATH_CLIENT_ID:
required: true
UIPATH_CLIENT_SECRET:
required: true
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: [ubuntu-latest, windows-latest]
permissions:
contents: read
pull-requests: write
steps:
# NOTE: Conditions are duplicated on each step instead of using job-level conditionals
# because GitHub expects ALL matrix combinations to report back when using matrix strategies.
# If we use job-level conditionals, matrix jobs won't run at all, leaving them in "pending"
# state and blocking PR merging. Step-level conditionals allow all matrix jobs to start
# and complete successfully, even when steps are skipped.
- name: Checkout
if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')"
uses: actions/checkout@v4
- name: Setup uv
if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')"
uses: astral-sh/setup-uv@v5
- name: Setup Python
if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')"
run: uv sync --all-extras --python ${{ matrix.python-version }}
- name: Run tests
if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') && !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13')"
run: uv run pytest
env:
UIPATH_URL: ${{ secrets.UIPATH_URL }}
UIPATH_CLIENT_ID: ${{ secrets.UIPATH_CLIENT_ID }}
UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}
- name: Run tests with coverage
if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'"
run: uv run pytest --cov-report=xml --cov-report=html --tb=short
env:
UIPATH_URL: ${{ secrets.UIPATH_URL }}
UIPATH_CLIENT_ID: ${{ secrets.UIPATH_CLIENT_ID }}
UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}
- name: Upload coverage HTML report
if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && always()"
uses: actions/upload-artifact@v4
with:
name: coverage-html-report
path: htmlcov/
retention-days: 30
- name: Upload coverage XML report
if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && always()"
uses: actions/upload-artifact@v4
with:
name: coverage-xml-report
path: coverage.xml
retention-days: 30
- name: Coverage PR comment
if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && github.event_name == 'pull_request'"
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}
MINIMUM_GREEN: 90
MINIMUM_ORANGE: 80
continue-on-error: true