Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ jobs:

test:
uses: ./.github/workflows/test.yml
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
49 changes: 48 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Test

on:
workflow_call
workflow_call:
secrets:
SONAR_TOKEN:
required: false

jobs:
test:
Expand Down Expand Up @@ -31,7 +34,51 @@ jobs:
run: uv sync --all-extras

- name: Run tests
if: "!(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13')"
run: uv run pytest

- name: Run tests with coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
run: uv run pytest --cov-report=xml --cov-report=html --tb=short

- name: Upload coverage HTML report
if: 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: 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

continue-on-error: true

sonarcloud:
name: SonarCloud
needs: test
runs-on: ubuntu-latest
if: always() && needs.test.result != 'failure'
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download coverage
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: coverage-xml-report

- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@2f77a1ec69fb1d595b06f35ab27e97605bdef703 # v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
21 changes: 18 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,26 @@ addopts = "-ra -q --cov=src/uipath --cov-report=term-missing"
asyncio_default_fixture_loop_scope = "function"
asyncio_mode = "auto"

[tool.coverage.run]
source = ["src/uipath"]
relative_files = true
omit = [
"*/tests/*",
"*/__pycache__/*",
"*/site-packages/*",
"*/conftest.py",
]

[tool.coverage.report]
show_missing = true

[tool.coverage.run]
source = ["src"]
precision = 2
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise NotImplementedError",
"if TYPE_CHECKING:",
"@(abc\\.)?abstractmethod",
]

[[tool.uv.index]]
name = "testpypi"
Expand Down
13 changes: 13 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sonar.projectKey=UiPath_uipath-runtime-python
sonar.organization=ui
sonar.host.url=https://sonarcloud.io

sonar.sources=src/uipath
sonar.tests=tests

sonar.python.version=3.11,3.12,3.13
sonar.python.coverage.reportPaths=coverage.xml

sonar.exclusions=**/samples/**,**/testcases/**

sonar.sourceEncoding=UTF-8
Loading