Skip to content

Commit

Permalink
Add pipeline for CTAO sonarqube
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Feb 23, 2024
1 parent 3b610d2 commit 32a5b5e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -190,3 +196,4 @@ jobs:
with:
name: docs
path: docs/_build/html

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
1 change: 1 addition & 0 deletions docs/changes/2214.maintenance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The CI system now reports to the CTA SonarQube instance for code quality tracking
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ norecursedirs = [
"auto_examples",
]

[tool.coverage.run]
include = ["src/*"]
relative_files = true

[tool.towncrier]
package = "ctapipe"
directory = "docs/changes"
Expand Down
5 changes: 5 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 32a5b5e

Please sign in to comment.