Merge pull request #99 from ineszang/feat/sonar-dashboard

test: ajout de propriétés dans le fichier de config pour sonarqube
This commit is contained in:
ineszang
2026-09-18 10:31:19 +02:00
committed by GitHub
4 changed files with 37 additions and 42 deletions
+15 -24
View File
@@ -2,19 +2,6 @@ name: Frontend
# Pipeline à choix multiple # Pipeline à choix multiple
on: on:
# workflow_dispatch -> lancement manuel des jobs
workflow_dispatch:
inputs:
job_choice:
required: true
description: "Choix du job"
type: choice
default: all
options:
- build
- sonarqube
- test
- all # lancer tous les jobs
push: push:
paths: paths:
- "apps/frontend/**" - "apps/frontend/**"
@@ -54,24 +41,28 @@ jobs:
cache-dependency-path: apps/frontend/package-lock.json cache-dependency-path: apps/frontend/package-lock.json
- run: npm ci - run: npm ci
working-directory: apps/frontend working-directory: apps/frontend
- run: npm test -- --watch=false - run: npm test --watch=false --code-coverage --coverageReporters=lcov
working-directory: apps/frontend working-directory: apps/frontend
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: frontend-coverage
path: apps/frontend/coverage/frontend/lcov.info
sonarqube: sonarqube:
needs: [build, test] needs: [build, test]
name: SonarQube name: SonarQube
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - uses: actions/checkout@v6
with: with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis fetch-depth: 0
- name: Download coverage
uses: actions/download-artifact@v4
with:
name: frontend-coverage
path: apps/frontend/coverage/frontend
- name: SonarQube Scan - name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@7006c4492b2e0ee0f816d36501671557c97f5995 # v8.1.0 uses: SonarSource/sonarqube-scan-action@v8
env: env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# deploy:
# runs-on: ubuntu-latest
# steps:
# - run: echo "DEPLOY job is running"
-9
View File
@@ -86,15 +86,6 @@
"text-summary", "text-summary",
"lcov", "lcov",
"html" "html"
],
"reporters": [
"default",
[
"junit",
{
"outputFile": "test-results/junit.xml"
}
]
] ]
} }
} }
+18
View File
@@ -0,0 +1,18 @@
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
coverage: {
provider: 'v8',
reporter: ['text', 'lcov'],
reportsDirectory: './coverage',
include: ['src/**/*.{ts,tsx,js,jsx}'],
exclude: [
'**/*.spec.*',
'**/*.test.*',
'**/node_modules/**',
'**/dist/**',
],
},
},
})
+4 -9
View File
@@ -1,14 +1,9 @@
sonar.projectKey=ProjetPiscine_EnerVision sonar.projectKey=ProjetPiscine_EnerVision
sonar.organization=groupe3-ener-vision sonar.organization=groupe3-ener-vision
sonar.sourceEncoding=UTF-8
sonar.sources=apps/frontend/src,apps/backend/app
# This is the name and version displayed in the SonarCloud UI. sonar.exclusions=**/node_modules/**,**/dist/**,**/*.spec.js,**/*.test.js,github,db,ml,docker-compose.yml,**/**/Dockerfile,**/**/proxy.conf.json,**/**/package.json,**/**/angular.json
#sonar.projectName=ProjetPiscine_EnerVision
#sonar.projectVersion=1.0
sonar.javascript.lcov.reportPaths=apps/frontend/coverage/frontend/lcov.info
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8