diff --git a/.github/workflows/unstable-cicd.yaml b/.github/workflows/unstable-cicd.yaml index 254e97f..3b32a10 100644 --- a/.github/workflows/unstable-cicd.yaml +++ b/.github/workflows/unstable-cicd.yaml @@ -78,6 +78,11 @@ jobs: pypi_username: ${{secrets.TEST_PYPI_USERNAME}} pypi_password: ${{secrets.TEST_PYPI_PASSWORD}} ADMIN_GITHUB_TOKEN: ${{secrets.ADMIN_GITHUB_TOKEN}} + - + name: 🛏️ Upload Coverage + uses: SonarSource/sonarqube-scan-action@v5 + env: + SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} ... diff --git a/.gitignore b/.gitignore index 85a5307..fe61f0a 100644 --- a/.gitignore +++ b/.gitignore @@ -88,6 +88,7 @@ pip-selfcheck.json # Python testing artifacts .coverage +coverage.xml htmlcov .tox/ diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..b0bdbf5 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,3 @@ +sonar.projectKey=NASA-PDS_data-upload-manager +sonar.organization=nasa-pds +sonar.python.coverage.reportPaths=coverage.xml diff --git a/tox.ini b/tox.ini index 1459922..b9417ce 100644 --- a/tox.ini +++ b/tox.ini @@ -1,24 +1,42 @@ [tox] envlist = py313, docs, lint -isolated_build = True +requires = tox>=4.6 [testenv] -deps = .[dev] -whitelist_externals = pytest -commands = pytest +description = run tests +basepython = python3.13 +package = wheel +extras = dev +usedevelop = true +commands = pytest --cov=src --cov-report=xml {posargs} [testenv:docs] -deps = .[dev] -whitelist_externals = python +description = build docs +extras = dev commands = sphinx-build -b html docs/source docs/build [testenv:lint] -deps = pre-commit -commands= - python -m pre_commit run --color=always {posargs:--all} +description = run linters skip_install = true +deps = pre-commit +commands = python -m pre_commit run --color=always {posargs:--all} -[testenv:dev] -basepython = python3.13 -usedevelop = True -deps = .[dev] +[coverage:run] +source = src +omit = + */tests/* + */test_* + */__pycache__/* + +[coverage:report] +exclude_lines = + pragma: no cover + def __repr__ + if self.debug: + if settings.DEBUG + raise AssertionError + raise NotImplementedError + if 0: + if __name__ == .__main__.: + class .*\bProtocol\): + @(abc\.)?abstractmethod