You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WF-WebAdmin/.drone.yml

83 lines
2.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

kind: pipeline
type: docker
name: CI
trigger:
event:
- push
steps:
- name: build
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
commands:
- cd WF-WebAdmin/WF-WebAdmin
- dotnet restore WF-WebAdmin.csproj
- dotnet build WF-WebAdmin.csproj -c Release --no-restore
- dotnet publish WF-WebAdmin.csproj -c Release --no-restore -o $CI_PROJECT_DIR/build/publish
- 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
depends_on: [build]
- 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: S201
coverage_exclusions: 'UnitTesting/**'
commands:
- cd WF-WebAdmin/WF-WebAdmin
- dotnet restore WF-WebAdmin.csproj
# 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}
# Build
- dotnet build WF-WebAdmin.csproj -c Release --no-restore
# Test + Collecte de la couverture en format Cobertura
- dotnet test WF-WebAdmin.csproj --logger trx --no-restore \
/p:CollectCoverage=true \
/p:CoverletOutput=coveragereport/coverage.cobertura.xml \
/p:CoverletOutputFormat=cobertura
# Vérifier la présence du fichier de couverture
- ls -R
# Générer le rapport SonarQube
- reportgenerator -reports:"coveragereport/coverage.cobertura.xml" \
-reporttypes:SonarQube \
-targetdir:"coveragereport"
# (Optionnel) Publish si besoin
- dotnet publish WF-WebAdmin.csproj -c Release --no-restore -o $CI_PROJECT_DIR/build/publish
# Fin de lanalyse Sonar
- dotnet sonarscanner end /d:sonar.login=$${sonar_token}
- name: docker_build
image: plugins/docker
settings:
repo: hub.codefirst.iut.uca.fr/whatthefantasy/wf-webadmin
registry: hub.codefirst.iut.uca.fr
dockerfile: Docker/Dockerfile
tags:
- latest
username:
from_secret: docker_username
password:
from_secret: docker_password
depends_on: [build, tests, code-inspection]