@@ -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 }}
0 commit comments