@@ -3,12 +3,14 @@ name: Test
33on :
44 workflow_call :
55 secrets :
6- UIPATH_URL :
7- required : true
8- UIPATH_CLIENT_ID :
9- required : true
10- UIPATH_CLIENT_SECRET :
11- required : true
6+ UIPATH_URL :
7+ required : true
8+ UIPATH_CLIENT_ID :
9+ required : true
10+ UIPATH_CLIENT_SECRET :
11+ required : true
12+ SONAR_TOKEN :
13+ required : false
1214
1315jobs :
1416 test :
@@ -41,19 +43,66 @@ jobs:
4143 if : " !contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')"
4244 uses : actions/setup-python@v5
4345 with :
44- python-version-file : " .python-version"
46+ python-version : ${{ matrix .python-version }}
4547
4648 - name : Install dependencies
4749 if : " !contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')"
48- run : uv sync --all-extras
50+ run : uv sync --all-extras --python ${{ matrix.python-version }}
4951
5052 - name : Run tests
51- if : " !contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')"
52- run : uv run pytest
53+ if : " !contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') && !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13')"
54+ run : uv run --python ${{ matrix.python-version }} pytest
55+ env :
56+ UIPATH_URL : ${{ secrets.UIPATH_URL }}
57+ UIPATH_CLIENT_ID : ${{ secrets.UIPATH_CLIENT_ID }}
58+ UIPATH_CLIENT_SECRET : ${{ secrets.UIPATH_CLIENT_SECRET }}
59+
60+ - name : Run tests with coverage
61+ if : " !contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'"
62+ run : uv run --python ${{ matrix.python-version }} pytest --cov-report=xml --cov-report=html --tb=short
5363 env :
5464 UIPATH_URL : ${{ secrets.UIPATH_URL }}
5565 UIPATH_CLIENT_ID : ${{ secrets.UIPATH_CLIENT_ID }}
5666 UIPATH_CLIENT_SECRET : ${{ secrets.UIPATH_CLIENT_SECRET }}
5767
68+ - name : Upload coverage HTML report
69+ if : " !contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && always()"
70+ uses : actions/upload-artifact@v4
71+ with :
72+ name : coverage-html-report
73+ path : htmlcov/
74+ retention-days : 30
75+
76+ - name : Upload coverage XML report
77+ if : " !contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && always()"
78+ uses : actions/upload-artifact@v4
79+ with :
80+ name : coverage-xml-report
81+ path : coverage.xml
82+ retention-days : 30
83+
5884 continue-on-error : true
5985
86+ sonarcloud :
87+ name : SonarCloud
88+ needs : test
89+ runs-on : ubuntu-latest
90+ if : always() && needs.test.result != 'failure'
91+ permissions :
92+ contents : read
93+ steps :
94+ - name : Checkout
95+ uses : actions/checkout@v4
96+ with :
97+ fetch-depth : 0
98+
99+ - name : Download coverage
100+ uses : actions/download-artifact@v4
101+ continue-on-error : true
102+ with :
103+ name : coverage-xml-report
104+
105+ - name : SonarCloud Scan
106+ uses : SonarSource/sonarqube-scan-action@2f77a1ec69fb1d595b06f35ab27e97605bdef703 # v5
107+ env :
108+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
0 commit comments