|
|
@ -3,44 +3,75 @@ type: docker
|
|
|
|
name: CI
|
|
|
|
name: CI
|
|
|
|
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
trigger:
|
|
|
|
|
|
|
|
branch:
|
|
|
|
|
|
|
|
- master
|
|
|
|
event:
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
- push
|
|
|
|
|
|
|
|
|
|
|
|
steps:
|
|
|
|
steps:
|
|
|
|
|
|
|
|
# 1) Build
|
|
|
|
- name: build
|
|
|
|
- name: build
|
|
|
|
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
|
|
|
|
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
|
|
|
|
commands:
|
|
|
|
commands:
|
|
|
|
# On se positionne dans le dossier du projet
|
|
|
|
# Restaurer les dépendances
|
|
|
|
- cd WF-WebAdmin/WF-WebAdmin
|
|
|
|
- dotnet restore WF-WebAdmin.sln
|
|
|
|
# Restauration des dépendances
|
|
|
|
# Compiler en mode Release (sans refaire la restore)
|
|
|
|
- dotnet restore WF-WebAdmin.csproj
|
|
|
|
- dotnet build WF-WebAdmin.sln -c Release --no-restore
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 2) Tests
|
|
|
|
- name: tests
|
|
|
|
- name: tests
|
|
|
|
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
|
|
|
|
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
|
|
|
|
commands:
|
|
|
|
commands:
|
|
|
|
- cd WF-WebAdmin/WF-WebAdmin
|
|
|
|
- dotnet restore WF-WebAdmin.sln
|
|
|
|
- dotnet restore WF-WebAdmin.csproj
|
|
|
|
- dotnet test WF-WebAdmin.sln --no-restore
|
|
|
|
- dotnet test WF-WebAdmin.csproj --no-restore
|
|
|
|
|
|
|
|
depends_on: [build]
|
|
|
|
depends_on: [build]
|
|
|
|
|
|
|
|
|
|
|
|
- name: analyze
|
|
|
|
# 3) Analyse Sonar + Couverture
|
|
|
|
|
|
|
|
- name: code-inspection
|
|
|
|
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
|
|
|
|
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:
|
|
|
|
commands:
|
|
|
|
- cd WF-WebAdmin/WF-WebAdmin
|
|
|
|
# Restauration
|
|
|
|
- dotnet restore WF-WebAdmin.csproj
|
|
|
|
- dotnet restore WF-WebAdmin.sln
|
|
|
|
- dotnet build WF-WebAdmin.csproj -c Release /p:RunAnalyzers=true
|
|
|
|
|
|
|
|
depends_on: [build]
|
|
|
|
# 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
|
|
|
|
- name: docker_build
|
|
|
|
image: plugins/docker
|
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
|
|
|
settings:
|
|
|
|
repo: hub.codefirst.iut.uca.fr/whatthefantasy/wf-webadmin
|
|
|
|
repo: hub.codefirst.iut.uca.fr/whatthefantasy/wf-webadmin
|
|
|
|
registry: hub.codefirst.iut.uca.fr
|
|
|
|
registry: hub.codefirst.iut.uca.fr
|
|
|
|
dockerfile: Docker/Dockerfile
|
|
|
|
dockerfile: Docker/Dockerfile
|
|
|
|
tags:
|
|
|
|
tags:
|
|
|
|
- latest
|
|
|
|
- latest
|
|
|
@ -48,6 +79,4 @@ steps:
|
|
|
|
from_secret: docker_username
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
|
|
|
from_secret: docker_password
|
|
|
|
depends_on: [build, tests, analyze]
|
|
|
|
depends_on: [build, tests, code-inspection]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|