diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c71f2de9a7f..9e5064b5c45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,7 @@ env: MPLBACKEND: Agg PYTEST_ADDOPTS: --color=yes GITHUB_PR_NUMBER: ${{ github.event.number }} + SONAR_HOST_URL: https://sonar-cta-dpps.zeuthen.desy.de jobs: lint: @@ -133,15 +134,20 @@ jobs: - name: Tests if: contains(github.event.pull_request.labels.*.name, 'documentation-only') == false run: | - cd $(mktemp -d) pytest -n auto --dist loadscope \ - --cov --cov-report=xml:$GITHUB_WORKSPACE/coverage.xml \ + --cov --cov-report=xml \ --doctest-modules --doctest-glob='*.rst' \ - --ignore=$GITHUB_WORKSPACE/docs/conf.py \ - --pyargs ctapipe $GITHUB_WORKSPACE/docs + --ignore=docs/conf.py \ + src/ctapipe docs ctapipe-info --version + # check code quality and coverage with SonarScanner + - uses: SonarSource/sonarqube-scan-action@v2 + if: contains(matrix.extra-args, 'codecov') && contains(github.event.pull_request.labels.*.name, 'documentation-only') == false + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - uses: codecov/codecov-action@v4 if: contains(matrix.extra-args, 'codecov') && contains(github.event.pull_request.labels.*.name, 'documentation-only') == false with: diff --git a/.gitignore b/.gitignore index cf1f625aaf1..21f73e6756c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ __pycache__ # ignore version cache file (generated automatically when setup.py is run) ctapipe/_version_cache.py +ctapipe/_version.py src/ctapipe/_version.py diff --git a/docs/changes/2214.maintenance.rst b/docs/changes/2214.maintenance.rst new file mode 100644 index 00000000000..77381f94f24 --- /dev/null +++ b/docs/changes/2214.maintenance.rst @@ -0,0 +1 @@ +The CI system now reports to the CTA SonarQube instance for code quality tracking diff --git a/pyproject.toml b/pyproject.toml index fd9417b86a4..e452ce67cc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -151,6 +151,10 @@ norecursedirs = [ "build", ] +[tool.coverage.run] +include = ["src/*"] +relative_files = true + [tool.towncrier] package = "ctapipe" directory = "docs/changes" diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000000..bcc86901d69 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,5 @@ +sonar.projectKey=ctapipe_github_9404f0f6-9294-11ed-bf3b-07aa00bdfe94 +sonar.qualitygate.wait=true +sonar.language=python +sonar.python.coverage.reportPaths=coverage.xml +sonar.python.version=3.9