Skip to content

Commit 13384a0

Browse files
committed
Add SonarCloud properties file
1 parent 04d0d1b commit 13384a0

File tree

2 files changed

+34
-29
lines changed

2 files changed

+34
-29
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,37 +45,29 @@ jobs:
4545
name: frontend-build
4646
path: dist/ # or your build output dir
4747

48-
sonar:
49-
name: SonarQube Analysis
50-
runs-on: ubuntu-latest
51-
needs: build-and-test # optional: ensures build/test pass first
48+
sonarcloud:
49+
name: SonarCloud Analysis
50+
runs-on: ubuntu-latest
51+
needs: build-and-test
5252

53-
steps:
54-
- name: Checkout code
55-
uses: actions/checkout@v4
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v4
5656

57-
- name: Setup Node.js
58-
uses: actions/setup-node@v4
59-
with:
60-
node-version: '20' # adjust if needed
57+
- name: Setup Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: '20'
6161

62-
- name: Install dependencies
63-
run: npm ci
62+
- name: Install dependencies
63+
run: npm ci
6464

65-
- name: Run SonarQube Analysis (Frontend)
66-
run: |
67-
npm install -g sonarqube-scanner
68-
SONAR_TOKEN=${{ secrets.SONAR_TOKEN }} npx sonar-scanner
69-
env:
70-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
65+
- name: Run tests with coverage
66+
run: npm test -- --coverage
7167

72-
# - name: Run SonarScanner
73-
# run: |
74-
# npm install -g sonarqube-scanner
75-
# sonar-scanner \
76-
# -Dsonar.projectKey=your_project_key \
77-
# -Dsonar.organization=your_org_key \ # remove this if using self-hosted SonarQube
78-
# -Dsonar.sources=. \
79-
# -Dsonar.exclusions=node_modules/**,dist/**,**/*.spec.ts \
80-
# -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info \
81-
# -Dsonar.login=${{ secrets.SONAR_TOKEN }}
68+
- name: Run SonarCloud scanner
69+
run: |
70+
npm install -g sonarqube-scanner
71+
npx sonar-scanner -Dsonar.login=${{ secrets.SONAR_TOKEN }}
72+
env:
73+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

sonar-project.properties

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Mandatory configuration
2+
sonar.projectKey=vitruvius-modeler
3+
sonar.organization=vitruv-tools
4+
5+
# Source and coverage paths
6+
sonar.sources=src
7+
sonar.exclusions=**/node_modules/**,**/*.test.tsx,**/*.spec.ts,**/*.test.ts
8+
sonar.javascript.lcov.reportPaths=coverage/lcov.info
9+
10+
# Optional metadata
11+
sonar.projectName=Vitruvius Modeler Frontend
12+
sonar.language=ts
13+
sonar.sourceEncoding=UTF-8

0 commit comments

Comments
 (0)