Skip to content

Commit 08448dc

Browse files
committed
chore: remove Codecov configuration and integrate SonarQube for code analysis
- Deleted the Codecov configuration file as part of the transition to SonarQube for code quality and coverage analysis. - Updated the to align coverage exclusions with SonarQube settings, ensuring consistency in coverage reporting. - Added a new file to configure SonarQube project settings, including source encoding, exclusions, and test report paths. - Modified the GitHub Actions workflow to replace Codecov upload steps with SonarQube analysis, enhancing CI/CD integration for code quality checks. - Updated README.md to reflect the new SonarQube badges for quality and coverage metrics.
1 parent 3aa016b commit 08448dc

File tree

5 files changed

+77
-78
lines changed

5 files changed

+77
-78
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
pytorch-version: ["2.7.0+cu126"]
1919
exclude:
2020
# Exclude some combinations to reduce CI load: macos doesn't work with CUDA, and ubuntu 3.9 triggers Codecov not available
21-
- os: ubuntu-latest
22-
python-version: "3.9"
21+
# - os: ubuntu-latest
22+
# python-version: "3.9"
2323
- os: macos-latest
2424
python-version: "3.9"
2525
- os: macos-latest
@@ -71,17 +71,13 @@ jobs:
7171
# -n auto \
7272
# -m "unit or gpu"
7373

74-
- name: Upload coverage to Codecov
74+
- name: Analyze code with SonarQube
7575
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' && matrix.pytorch-version == '2.7.0+cu126'
76-
uses: codecov/codecov-action@v5
76+
uses: SonarSource/sonarqube-scan-action@v5
7777
with:
78-
files: coverage.xml
79-
flags: unittests
80-
name: codecov-umbrella
81-
fail_ci_if_error: true
82-
verbose: true
83-
token: ${{ secrets.CODECOV_TOKEN }}
84-
slug: michelin/TorchSOM
78+
token: ${{ secrets.SONAR_TOKEN }}
79+
# organization: michelin
80+
# projectKey: michelin_TorchSOM
8581

8682
- name: Upload test results
8783
uses: actions/upload-artifact@v4

README.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,31 @@
22

33
<div align="center">
44

5-
[![PyPI version](https://img.shields.io/pypi/v/torchsom.svg)](https://pypi.org/project/torchsom/)
6-
[![Python versions](https://img.shields.io/pypi/pyversions/torchsom.svg)](https://pypi.org/project/torchsom/)
5+
<!-- Global Package information -->
6+
[![PyPI version](https://img.shields.io/pypi/v/torchsom.svg?color=blue)](https://pypi.org/project/torchsom/)
7+
[![Python versions](https://img.shields.io/pypi/pyversions/torchsom.svg?color=blue)](https://pypi.org/project/torchsom/)
78
[![PyTorch versions](https://img.shields.io/badge/PyTorch-2.7-EE4C2C.svg)](https://pytorch.org/)
9+
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/license/apache-2-0)
810

11+
<!-- Sonar Qube badges -->
12+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
13+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=coverage)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
14+
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
15+
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
16+
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
17+
18+
<!-- [![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-light.svg)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM) -->
19+
20+
<!-- GitHub Workflows -->
921
[![Tests](https://github.com/michelin/TorchSOM/workflows/Tests/badge.svg)](https://github.com/michelin/TorchSOM/actions/workflows/test.yml)
1022
[![Code Quality](https://github.com/michelin/TorchSOM/workflows/Code%20Quality/badge.svg)](https://github.com/michelin/TorchSOM/actions/workflows/code-quality.yml)
11-
<!-- [![Security](https://github.com/michelin/TorchSOM/workflows/Security%20Scanning/badge.svg)](https://github.com/michelin/TorchSOM/actions/workflows/security.yml)
12-
[![codecov](https://codecov.io/gh/michelin/TorchSOM/branch/main/graph/badge.svg)](https://codecov.io/gh/michelin/TorchSOM) -->
13-
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
14-
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
15-
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-red.svg)](https://opensource.org/license/apache-2-0)
23+
[![Downloads](https://static.pepy.tech/badge/torchsom)](https://pepy.tech/project/torchsom)
24+
<!-- [![Security](https://github.com/michelin/TorchSOM/workflows/Security%20Scanning/badge.svg)](https://github.com/michelin/TorchSOM/actions/workflows/security.yml) -->
1625

17-
<!-- [![Downloads](https://static.pepy.tech/badge/torchsom)](https://pepy.tech/project/torchsom) -->
26+
<!-- Code Style and Tools -->
27+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
28+
[![Imports: isort](https://img.shields.io/badge/imports-isort-6c757d.svg?color=blue)](https://pycqa.github.io/isort/)
29+
[![Ruff](https://img.shields.io/badge/linter-ruff-6c757d.svg?color=blue)](https://github.com/astral-sh/ruff)
1830

1931
<p align="center">
2032
<img src="assets/logo.jpg" alt="TorchSOM_logo" width="400"/>
@@ -27,6 +39,8 @@
2739
| [📊 Examples](notebooks/)
2840
| [🤝 Contributing](CONTRIBUTING.md)
2941

42+
**⭐ If you find [`torchsom`](https://github.com/michelin/TorchSOM) valuable, please consider starring this repository ⭐**
43+
3044
</div>
3145

3246
---
@@ -39,8 +53,6 @@ Whether you are a researcher or practitioner, TorchSOM empowers you to efficient
3953

4054
TorchSOM is the official implementation accompanying the paper: [TorchSOM: A Scalable PyTorch-Compatible Library for Self-Organizing Maps](update_link), presented at @CONFERENCE, @DATE.
4155

42-
**⭐ If you find TorchSOM valuable, please consider starring this repository ⭐**
43-
4456
### ⚡ Key Advantages
4557

4658
| Feature | [TorchSOM](https://github.com/michelin/TorchSOM) | [MiniSom](https://github.com/JustGlowing/minisom) | [SOMPY](https://github.com/sevamoo/SOMPY) | [SOMToolbox](https://github.com/ilarinieminen/SOM-Toolbox) |

codecov.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

pyproject.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,18 @@ timeout = 300
186186
source = ["torchsom"]
187187
# Files to exclude from coverage stats
188188
omit = [
189+
"tests/**", # Exclude all test files
190+
"docs/**", # Exclude documentation
191+
"notebooks/**", # Exclude Jupyter notebooks
189192
"torchsom/core/base_som.py", # Exclude base SOM implementation
190-
"torchsom/core/growing/*", # Exclude growing SOM implementation
191-
"torchsom/core/hierarchical/*", # Exclude hierarchical SOM implementation
192-
"torchsom/visualization/*", # Exclude visualization utilities
193+
"torchsom/core/growing/**", # Exclude growing SOM implementation
194+
"torchsom/core/hierarchical/**", # Exclude hierarchical SOM implementation
195+
"torchsom/visualization/**", # Exclude visualization utilities
193196
"torchsom/logger.py", # Exclude logging utilities
194197
"torchsom/version.py", # Exclude version info file
195-
"*/tests/*", # Exclude tests themselves
196-
"*/conftest.py", # Exclude pytest config
197-
"*/__init__.py", # Exclude package init files
198-
"*/setup.py", # Exclude setup scripts
198+
"**/conftest.py", # Exclude pytest config
199+
"**/__init__.py", # Exclude package init files
200+
"**/setup.py", # Exclude setup scripts
199201
]
200202
# Measure branch coverage in addition to line coverage
201203
branch = true

sonar-project.properties

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Project identification
2+
sonar.organization=michelin
3+
sonar.projectKey=michelin_TorchSOM
4+
sonar.projectName=TorchSOM
5+
sonar.projectVersion=1.0
6+
7+
# Source encoding
8+
sonar.sourceEncoding=UTF-8
9+
10+
# Where the source code is
11+
sonar.sources=torchsom
12+
13+
# Exclusions (aligned with pyproject.toml coverage omit patterns)
14+
sonar.exclusions=\
15+
tests/**,\
16+
docs/**,\
17+
notebooks/**,\
18+
torchsom/core/base_som.py,\
19+
torchsom/core/growing/**,\
20+
torchsom/core/hierarchical/**,\
21+
torchsom/visualization/**,\
22+
torchsom/logger.py,\
23+
torchsom/version.py,\
24+
**/conftest.py,\
25+
**/__init__.py,\
26+
**/setup.py
27+
28+
# Test sources
29+
sonar.tests=tests
30+
31+
# Coverage report path (generated by pytest --cov-report=xml)
32+
sonar.python.coverage.reportPaths=coverage.xml
33+
34+
# Test execution report path (generated by pytest --junit-xml)
35+
sonar.testExecutionReportPaths=junit.xml
36+
37+
# Optional: Limit analysis to Python only
38+
sonar.language=py
39+
sonar.python.version=3.9,3.10,3.11

0 commit comments

Comments
 (0)