|
|
|
@ -24,43 +24,46 @@ steps:
|
|
|
|
|
depends_on: [ build ]
|
|
|
|
|
|
|
|
|
|
- name: code-inspection
|
|
|
|
|
# On garde l'image du prof, comme demandé
|
|
|
|
|
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
|
|
|
|
|
secrets: [ sonar_token ]
|
|
|
|
|
|
|
|
|
|
secrets: [ sonar_tocken ]
|
|
|
|
|
|
|
|
|
|
environment:
|
|
|
|
|
sonar_host: https://codefirst.iut.uca.fr/sonar/
|
|
|
|
|
sonar_token:
|
|
|
|
|
from_secret: sonar_token
|
|
|
|
|
project_key: WF-WebAdmin
|
|
|
|
|
coverage_exclusions: 'UnitTesting/**'
|
|
|
|
|
from_secret: sonar_tocken
|
|
|
|
|
project_key: "web_admin" # mettre ici votre vraie clé sonar
|
|
|
|
|
coverage_exclusions: "Tests/**" # ou tout autre dossier à exclure
|
|
|
|
|
|
|
|
|
|
commands:
|
|
|
|
|
# Se placer dans votre répertoire de projet
|
|
|
|
|
- cd WF-WebAdmin/WF-WebAdmin
|
|
|
|
|
|
|
|
|
|
# Restauration des dépendances
|
|
|
|
|
- dotnet restore WF-WebAdmin.csproj
|
|
|
|
|
|
|
|
|
|
# SonarScanner (en une seule ligne pour éviter les soucis d'arguments)
|
|
|
|
|
# Démarrage de l'analyse SonarQube
|
|
|
|
|
- dotnet sonarscanner begin /k:$${project_key} /d:sonar.host.url=$${sonar_host} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions=$${coverage_exclusions} /d:sonar.login=$${sonar_token}
|
|
|
|
|
|
|
|
|
|
# Build en Release
|
|
|
|
|
- dotnet build WF-WebAdmin.csproj -c Release --no-restore
|
|
|
|
|
|
|
|
|
|
# Exécution des tests + Coverlet => fichier Cobertura (coverage.cobertura.xml)
|
|
|
|
|
# Exécution des tests avec collecte de couverture Cobertura
|
|
|
|
|
- dotnet test WF-WebAdmin.csproj --logger trx --no-restore \
|
|
|
|
|
/p:CollectCoverage=true \
|
|
|
|
|
/p:CoverletOutput=coveragereport/coverage.cobertura.xml \
|
|
|
|
|
/p:CoverletOutputFormat=cobertura
|
|
|
|
|
/p:CoverletOutputFormat=cobertura \
|
|
|
|
|
--collect "XPlat Code Coverage"
|
|
|
|
|
|
|
|
|
|
# Vérification du contenu
|
|
|
|
|
- ls -R
|
|
|
|
|
# Génération du rapport SonarQube à partir du Cobertura
|
|
|
|
|
- reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
|
|
|
|
|
|
|
|
|
|
# Génération du rapport SonarQube depuis Cobertura
|
|
|
|
|
- reportgenerator -reports:"coveragereport/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
|
|
|
|
|
# (Optionnel) Publication de l'appli si vous en avez besoin
|
|
|
|
|
- dotnet publish WF-WebAdmin.csproj -c Release --no-restore -o $CI_PROJECT_DIR/build/release
|
|
|
|
|
|
|
|
|
|
# (Optionnel) Publication si besoin
|
|
|
|
|
- dotnet publish WF-WebAdmin.csproj -c Release --no-restore -o $CI_PROJECT_DIR/build/publish
|
|
|
|
|
|
|
|
|
|
# Clôture de l'analyse Sonar
|
|
|
|
|
# Fin de l'analyse SonarQube
|
|
|
|
|
- dotnet sonarscanner end /d:sonar.login=$${sonar_token}
|
|
|
|
|
|
|
|
|
|
depends_on: [ build, tests ]
|
|
|
|
|
|
|
|
|
|
- name: docker_build
|
|
|
|
|
image: plugins/docker
|
|
|
|
|
settings:
|
|
|
|
|