From 68f31b4eb2e865b10149c85afe9095e5eed313b2 Mon Sep 17 00:00:00 2001 From: "nicolas.barbosa" Date: Sat, 4 May 2024 10:10:14 +0200 Subject: [PATCH 1/6] projet de unit testing --- Sources/UnitTesting/UnitTesting.csproj | 25 ++++++++ Sources/mastermind.sln | 87 ++++++++++++++------------ 2 files changed, 73 insertions(+), 39 deletions(-) create mode 100644 Sources/UnitTesting/UnitTesting.csproj diff --git a/Sources/UnitTesting/UnitTesting.csproj b/Sources/UnitTesting/UnitTesting.csproj new file mode 100644 index 0000000..22b0134 --- /dev/null +++ b/Sources/UnitTesting/UnitTesting.csproj @@ -0,0 +1,25 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/Sources/mastermind.sln b/Sources/mastermind.sln index f08ea1d..806d18f 100644 --- a/Sources/mastermind.sln +++ b/Sources/mastermind.sln @@ -1,39 +1,48 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.8.34330.188 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreLibrary", "CoreLibrary\CoreLibrary.csproj", "{341FB405-085D-4C34-B395-64EF0F9B93E0}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "ConsoleApp\ConsoleApp.csproj", "{97507EBF-3973-4D1C-BE56-2F125B25E74F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiSpark", "MauiSpark\MauiSpark.csproj", "{BD22A919-E40E-4791-A6B0-2B8D37BBE834}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {341FB405-085D-4C34-B395-64EF0F9B93E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {341FB405-085D-4C34-B395-64EF0F9B93E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {341FB405-085D-4C34-B395-64EF0F9B93E0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {341FB405-085D-4C34-B395-64EF0F9B93E0}.Release|Any CPU.Build.0 = Release|Any CPU - {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Release|Any CPU.Build.0 = Release|Any CPU - {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Release|Any CPU.Build.0 = Release|Any CPU - {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Release|Any CPU.Deploy.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {B3BD74E0-E5DA-4859-B2B7-E3759C2089EE} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreLibrary", "CoreLibrary\CoreLibrary.csproj", "{341FB405-085D-4C34-B395-64EF0F9B93E0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "ConsoleApp\ConsoleApp.csproj", "{97507EBF-3973-4D1C-BE56-2F125B25E74F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiSpark", "MauiSpark\MauiSpark.csproj", "{BD22A919-E40E-4791-A6B0-2B8D37BBE834}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "UnitTesting\UnitTesting.csproj", "{A2182054-C0D1-46D6-BD39-F3F7926CE2DD}" + ProjectSection(ProjectDependencies) = postProject + {341FB405-085D-4C34-B395-64EF0F9B93E0} = {341FB405-085D-4C34-B395-64EF0F9B93E0} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {341FB405-085D-4C34-B395-64EF0F9B93E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {341FB405-085D-4C34-B395-64EF0F9B93E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {341FB405-085D-4C34-B395-64EF0F9B93E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {341FB405-085D-4C34-B395-64EF0F9B93E0}.Release|Any CPU.Build.0 = Release|Any CPU + {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Release|Any CPU.Build.0 = Release|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Release|Any CPU.Build.0 = Release|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Release|Any CPU.Deploy.0 = Release|Any CPU + {A2182054-C0D1-46D6-BD39-F3F7926CE2DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A2182054-C0D1-46D6-BD39-F3F7926CE2DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A2182054-C0D1-46D6-BD39-F3F7926CE2DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A2182054-C0D1-46D6-BD39-F3F7926CE2DD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B3BD74E0-E5DA-4859-B2B7-E3759C2089EE} + EndGlobalSection +EndGlobal From 085a211c4ca5777b8bb54bfb5a364689d4cfe3f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9leste=20BARBOSA?= Date: Sat, 4 May 2024 10:12:17 +0200 Subject: [PATCH 2/6] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Sources/MauiSp?= =?UTF-8?q?ark/MauiSpark.csproj'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/MauiSpark/MauiSpark.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/MauiSpark/MauiSpark.csproj b/Sources/MauiSpark/MauiSpark.csproj index 4322eef..9f70617 100644 --- a/Sources/MauiSpark/MauiSpark.csproj +++ b/Sources/MauiSpark/MauiSpark.csproj @@ -1,7 +1,7 @@  - net8.0-android;net8.0-ios;net8.0-maccatalyst + net8.0-android; $(TargetFrameworks);net8.0-windows10.0.19041.0 From 3c55b70364dd71dc1cc64f21b67c5c06f9b9d52d Mon Sep 17 00:00:00 2001 From: "nicolas.barbosa" Date: Sat, 4 May 2024 10:25:36 +0200 Subject: [PATCH 3/6] ajout de la solution sans maui --- Sources/mastermindSansMaui.sln | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Sources/mastermindSansMaui.sln diff --git a/Sources/mastermindSansMaui.sln b/Sources/mastermindSansMaui.sln new file mode 100644 index 0000000..7e490cc --- /dev/null +++ b/Sources/mastermindSansMaui.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreLibrary", "CoreLibrary\CoreLibrary.csproj", "{341FB405-085D-4C34-B395-64EF0F9B93E0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "ConsoleApp\ConsoleApp.csproj", "{97507EBF-3973-4D1C-BE56-2F125B25E74F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "UnitTesting\UnitTesting.csproj", "{A2182054-C0D1-46D6-BD39-F3F7926CE2DD}" + ProjectSection(ProjectDependencies) = postProject + {341FB405-085D-4C34-B395-64EF0F9B93E0} = {341FB405-085D-4C34-B395-64EF0F9B93E0} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {341FB405-085D-4C34-B395-64EF0F9B93E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {341FB405-085D-4C34-B395-64EF0F9B93E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {341FB405-085D-4C34-B395-64EF0F9B93E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {341FB405-085D-4C34-B395-64EF0F9B93E0}.Release|Any CPU.Build.0 = Release|Any CPU + {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {97507EBF-3973-4D1C-BE56-2F125B25E74F}.Release|Any CPU.Build.0 = Release|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Release|Any CPU.Build.0 = Release|Any CPU + {BD22A919-E40E-4791-A6B0-2B8D37BBE834}.Release|Any CPU.Deploy.0 = Release|Any CPU + {A2182054-C0D1-46D6-BD39-F3F7926CE2DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A2182054-C0D1-46D6-BD39-F3F7926CE2DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A2182054-C0D1-46D6-BD39-F3F7926CE2DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A2182054-C0D1-46D6-BD39-F3F7926CE2DD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B3BD74E0-E5DA-4859-B2B7-E3759C2089EE} + EndGlobalSection +EndGlobal From 9df76fffb577a5c23d23958d2ba68e739c0d26b6 Mon Sep 17 00:00:00 2001 From: "nicolas.barbosa" Date: Sat, 4 May 2024 10:33:28 +0200 Subject: [PATCH 4/6] ajout du build dans drone --- .drone.yml | 52 +++++++++++++++++++++------------------------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4d835c6..bc2fc1c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,44 +8,34 @@ trigger: - push steps: - - name: build-CoreLibrary + - name: build image: mcr.microsoft.com/dotnet/sdk:8.0 commands: - cd Sources - - dotnet restore CoreLibrary/CoreLibrary.csproj - - dotnet build CoreLibrary/CoreLibrary.csproj -c Release --no-restore - - name: build-ConsoleApp - image: mcr.microsoft.com/dotnet/sdk:8.0 - commands: - - cd Sources - - dotnet restore ConsoleApp/ConsoleApp.csproj - - dotnet build ConsoleApp/ConsoleApp.csproj -c Release --no-restore - - name: build-UnitTesting - image: mcr.microsoft.com/dotnet/sdk:8.0 - commands: - - cd Sources - - dotnet restore UnitTesting/UnitTesting.csproj - - dotnet build UnitTesting/UnitTesting.csproj -c Release --no-restore - - name: build-MauiSpark - image: mcr.microsoft.com/dotnet/sdk:8.0 - commands: - - mkdir /usr/lib/android-sdk - - cd /usr/lib/android-sdk - - wget -O commandlinetools.zip https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip - - apt update && apt install unzip default-jdk -y - - unzip commandlinetools.zip - - yes | /usr/lib/android-sdk/cmdline-tools/bin/sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0" --sdk_root=/usr/lib/android-sdk/ - - cd /drone/src/Sources - - dotnet --version - - dotnet workload install maui-android - - dotnet restore MauiSpark/MauiSpark.csproj - - dotnet build MauiSpark/MauiSpark.csproj -c Release --no-restore /p:AndroidSdkDirectory=/usr/lib/android-sdk/ -property:Aapt2ToolPath=/usr/lib/android-sdk/build-tools/34.0.0 + - dotnet restore mastermindSansMaui.sln + - dotnet build mastermindSansMaui.sln -c Release --no-restore + - dotnet publish mastermindSansMaui.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release + #- name: build-MauiSpark + # image: mcr.microsoft.com/dotnet/sdk:8.0 + # commands: + # - mkdir /usr/lib/android-sdk + # - cd /usr/lib/android-sdk + # - wget -O commandlinetools.zip https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip + # - apt update && apt install unzip default-jdk -y + # - unzip commandlinetools.zip + # - yes | /usr/lib/android-sdk/cmdline-tools/bin/sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0" --sdk_root=/usr/lib/android-sdk/ + # - cd /drone/src/Sources + # - dotnet --version + # - dotnet workload install maui-android + # - dotnet restore MauiSpark/MauiSpark.csproj + # - dotnet build MauiSpark/MauiSpark.csproj -c Release --no-restore /p:AndroidSdkDirectory=/usr/lib/android-sdk/ -property:Aapt2ToolPath=/usr/lib/android-sdk/build-tools/34.0.0 - name: tests image: mcr.microsoft.com/dotnet/sdk:8.0 commands: - cd Sources/ - - dotnet restore UnitTesting/UnitTesting.csproj - - dotnet test UnitTesting/UnitTesting.csproj --no-restore + - dotnet restore mastermindSansMaui.sln + - dotnet test mastermindSansMaui.sln --no-restore + depends_on: [build] - name: generate-and-deploy-docs image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer failure: ignore From dc59d48acde7467d46812a22924c24023b68c967 Mon Sep 17 00:00:00 2001 From: "nicolas.barbosa" Date: Sat, 4 May 2024 10:37:05 +0200 Subject: [PATCH 5/6] ajout du code inspection dans drone --- .drone.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.drone.yml b/.drone.yml index bc2fc1c..3078214 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,6 +36,24 @@ steps: - dotnet restore mastermindSansMaui.sln - dotnet test mastermindSansMaui.sln --no-restore depends_on: [build] + - name: code-inspection + image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet8 + secrets: [ SECRET_SONAR_LOGIN ] + environment: + sonar_host: https://codefirst.iut.uca.fr/sonar/ + sonar_token: + from_secret: SECRET_SONAR_LOGIN + project_key: celestebarbosa-mastermind + coverage_exclusions: "Tests/**" + commands: + - cd Sources/ + - dotnet restore mastermindSansMaui.sln + - 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} + - dotnet build mastermindSansMaui.sln -c Release --no-restore + - dotnet test mastermindSansMaui.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" + - reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport" + - dotnet publish mastermindSansMaui.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release + - dotnet sonarscanner end /d:sonar.login=$${sonar_token} - name: generate-and-deploy-docs image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer failure: ignore From a1acb65dc62bc11962ddbccc04129db028e97ec1 Mon Sep 17 00:00:00 2001 From: "nicolas.barbosa" Date: Sat, 4 May 2024 10:40:13 +0200 Subject: [PATCH 6/6] correction token sonar --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 3078214..62bd864 100644 --- a/.drone.yml +++ b/.drone.yml @@ -42,7 +42,7 @@ steps: environment: sonar_host: https://codefirst.iut.uca.fr/sonar/ sonar_token: - from_secret: SECRET_SONAR_LOGIN + from_secret: sonar_token project_key: celestebarbosa-mastermind coverage_exclusions: "Tests/**" commands: