diff --git a/ci/.drone.yml b/ci/.drone.yml index 2555b1d..675e23a 100644 --- a/ci/.drone.yml +++ b/ci/.drone.yml @@ -6,15 +6,22 @@ name: "CI/CD" steps: - image: mcr.microsoft.com/dotnet/sdk:8.0 - name: "Run Tests" + name: "Run Tests and sonar" commands: - - dotnet test + - apt update && apt install openjdk-17-jre -y + - dotnet tool install --global dotnet-sonarscanner + - dotnet tool install --global dotnet-coverage + - export PATH="$PATH:/root/.dotnet/tools" + - dotnet sonarscanner begin /k:"IQBall-WebAPI" /d:sonar.host.url="https://codefirst.iut.uca.fr/sonar" /d:sonar.login="sqp_b16ad09dcce1b9dde920e313b10c2fe85566624c" + - dotnet build + - dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml" + - dotnet sonarscanner end /d:sonar.login="sqp_b16ad09dcce1b9dde920e313b10c2fe85566624c" - image: plugins/docker name: "build and push docker image" depends_on: - - "Run Tests" + - "Run Tests and sonar" settings: dockerfile: ci/API.dockerfile context: .