Skip to content

Commit 7431b9c

Browse files
committed
Add SonarQube CI workflow and project configs
Introduces a GitHub Actions workflow for SonarQube analysis on both backend and frontend. Adds SonarQube configuration files for backend and frontend projects to enable code quality and coverage reporting. Removes unnecessary .DS_Store files from various directories.
1 parent 0699059 commit 7431b9c

8 files changed

Lines changed: 108 additions & 0 deletions

File tree

.DS_Store

8 KB
Binary file not shown.

.github/workflows/sonarqube.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: SonarQube Analysis
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- develop
7+
- 'feature/**'
8+
pull_request:
9+
types: [opened, synchronize, reopened]
10+
11+
jobs:
12+
sonarqube-backend:
13+
name: SonarQube Backend Analysis
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
19+
20+
- name: SonarQube Scan - Backend
21+
uses: SonarSource/sonarqube-scan-action@v2
22+
env:
23+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }}
24+
SONAR_HOST_URL: https://sonarcloud.io
25+
with:
26+
projectBaseDir: .
27+
args: >
28+
-Dsonar.projectKey=omics-datascience_multiomix-backend
29+
-Dsonar.organization=omics-datascience
30+
31+
sonarqube-frontend:
32+
name: SonarQube Frontend Analysis
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v3
36+
with:
37+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
38+
39+
- name: Set up Node.js
40+
uses: actions/setup-node@v3
41+
with:
42+
node-version: '20.x'
43+
44+
- name: Install dependencies
45+
run: npm --prefix src/frontend/static/frontend install
46+
47+
- name: Run linter and type checks
48+
run: npm --prefix src/frontend/static/frontend run check-all
49+
50+
- name: SonarQube Scan - Frontend
51+
uses: SonarSource/sonarqube-scan-action@v2
52+
env:
53+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_FRONTEND }}
54+
SONAR_HOST_URL: https://sonarcloud.io
55+
with:
56+
projectBaseDir: src/frontend/static/frontend
57+
args: >
58+
-Dsonar.projectKey=omics-datascience_multiomix-frontend
59+
-Dsonar.organization=omics-datascience

sonar-project.properties

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Backend Project Configuration
2+
sonar.projectKey=omics-datascience_multiomix-backend
3+
sonar.organization=omics-datascience
4+
5+
# This is the name and version displayed in the SonarQube UI.
6+
sonar.projectName=Multiomix Backend
7+
sonar.projectVersion=1.0
8+
9+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
10+
sonar.sources=src
11+
12+
# Exclude frontend, tests, migrations, and other non-backend code
13+
sonar.exclusions=**/node_modules/**,**/frontend/static/frontend/**,**/migrations/**,**/tests/**,**/__pycache__/**,**/venv/**,**/*.pyc
14+
15+
# Test files
16+
sonar.tests=src
17+
sonar.test.inclusions=**/tests/**,**/*_test.py,**/test_*.py
18+
19+
# Python specific settings
20+
sonar.python.version=3.7,3.8,3.9,3.10,3.11
21+
22+
# Coverage reports (if you generate them)
23+
# sonar.python.coverage.reportPaths=src/.coverage
24+
25+
# Encoding of the source code. Default is default system encoding
26+
sonar.sourceEncoding=UTF-8

src/.DS_Store

6 KB
Binary file not shown.

src/frontend/.DS_Store

6 KB
Binary file not shown.

src/frontend/static/.DS_Store

6 KB
Binary file not shown.
6 KB
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Frontend Project Configuration
2+
sonar.projectKey=omics-datascience_multiomix-frontend
3+
sonar.organization=omics-datascience
4+
5+
# This is the name and version displayed in the SonarQube UI.
6+
sonar.projectName=Multiomix Frontend
7+
sonar.projectVersion=1.0
8+
9+
# Path is relative to the sonar-project.properties file
10+
sonar.sources=src
11+
12+
# Exclude node_modules, build output, and test files from analysis
13+
sonar.exclusions=**/node_modules/**,**/dist/**,**/coverage/**,**/*.test.ts,**/*.test.tsx,**/*.spec.ts,**/*.spec.tsx
14+
15+
# Test files
16+
sonar.tests=src
17+
sonar.test.inclusions=**/*.test.ts,**/*.test.tsx,**/*.spec.ts,**/*.spec.tsx
18+
19+
# TypeScript/JavaScript specific
20+
sonar.javascript.lcov.reportPaths=coverage/lcov.info
21+
22+
# Encoding of the source code
23+
sonar.sourceEncoding=UTF-8

0 commit comments

Comments
 (0)