test CI 12
continuous-integration/drone/push Build is failing Details

pull/29/head
Maxime ROCHER 3 months ago
parent bd925d8464
commit f0dce9458d

@ -3,39 +3,70 @@ type: docker
name: CI
trigger:
branch:
- master
event:
- push
steps:
# 1) Build
- name: build
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
commands:
# On se positionne dans le dossier du projet
- cd WF-WebAdmin/WF-WebAdmin
# Restauration des dépendances
- dotnet restore WF-WebAdmin.csproj
# Compilation en mode Release
- dotnet build WF-WebAdmin.csproj -c Release --no-restore
# Publication de l'application dans le dossier build/publish du workspace
- dotnet publish WF-WebAdmin.csproj -c Release --no-restore -o $CI_PROJECT_DIR/build/publish
# Restaurer les dépendances
- dotnet restore WF-WebAdmin.sln
# Compiler en mode Release (sans refaire la restore)
- dotnet build WF-WebAdmin.sln -c Release --no-restore
# 2) Tests
- name: tests
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
commands:
- cd WF-WebAdmin/WF-WebAdmin
- dotnet restore WF-WebAdmin.csproj
- dotnet test WF-WebAdmin.csproj --no-restore
- dotnet restore WF-WebAdmin.sln
- dotnet test WF-WebAdmin.sln --no-restore
depends_on: [build]
- name: analyze
# 3) Analyse Sonar + Couverture
- name: code-inspection
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
secrets: [ sonar_token ]
environment:
sonar_host: https://codefirst.iut.uca.fr/sonar/
sonar_token:
from_secret: sonar_token
project_key: wf-webadmin # Clé projet Sonar, adaptez si besoin
coverage_exclusions: 'UnitTesting/**' # Exclusions de couverture, ajustez selon vos besoins
commands:
- cd WF-WebAdmin/WF-WebAdmin
- dotnet restore WF-WebAdmin.csproj
- dotnet build WF-WebAdmin.csproj -c Release /p:RunAnalyzers=true
depends_on: [build]
# Restauration
- dotnet restore WF-WebAdmin.sln
# Début de l'analyse Sonar
- 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}
# Compilation
- dotnet build WF-WebAdmin.sln -c Release --no-restore
# Test avec génération de couverture
- dotnet test WF-WebAdmin.sln --logger trx --no-restore \
/p:CollectCoverage=true \
/p:CoverletOutputFormat=cobertura \
--collect "XPlat Code Coverage"
# Génération du rapport compatible SonarQube
- reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
# Publication (optionnelle) en Release, si besoin pour valider le build final
- dotnet publish WF-WebAdmin.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release
# Fin de l'analyse Sonar
- dotnet sonarscanner end /d:sonar.login=$${sonar_token}
depends_on: [build, tests]
# 4) Construction et push de l'image Docker
- name: docker_build
image: plugins/docker
settings:
@ -48,6 +79,4 @@ steps:
from_secret: docker_username
password:
from_secret: docker_password
depends_on: [build, tests, analyze]
depends_on: [build, tests, code-inspection]

Loading…
Cancel
Save