From e63058075d6181ef24e96c0c2e778f5c6f195ef8 Mon Sep 17 00:00:00 2001 From: Louwar Date: Wed, 1 Mar 2023 09:03:26 +0100 Subject: [PATCH] Update project --- .drone.yml | 79 ++++++++++++++++++++++++------ Sources/LeagueOfLegends.sln | 14 +++--- Sources/StubEF/StubEF.csproj | 2 +- Sources/StubEF/StubEFChampions.cs | 12 ++--- Sources/TestEF/TestEF.csproj | 9 ++-- Sources/TestEF/UnitTestChampion.cs | 2 +- 6 files changed, 82 insertions(+), 36 deletions(-) diff --git a/.drone.yml b/.drone.yml index 303c55f..cf691f9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,19 +1,66 @@ kind: pipeline -name: mon_pipeline +type: docker +name: default + +trigger: + event: + - push steps: -- name: deploy-container-mysql - image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest - environment: - IMAGENAME: mariadb:10 - CONTAINERNAME: mysql - PRIVATE: true - CODEFIRST_CLIENTDRONE_ENV_MARIADB_ROOT_PASSWORD: - from_secret: db_root_password - CODEFIRST_CLIENTDRONE_ENV_MARIADB_DATABASE: - from_secret: db_database - CODEFIRST_CLIENTDRONE_ENV_MARIADB_USER: - from_secret: db_user - CODEFIRST_CLIENTDRONE_ENV_MARIADB_PASSWORD: - from_secret: db_password - COMMAND: create \ No newline at end of file + - name: build + image: mcr.microsoft.com/dotnet/sdk:6.0 + volumes: + - name: docs + path: /docs + commands: + - cd Sources/ + - dotnet restore LeagueOfLegends.sln + - dotnet build LeagueOfLegends.sln -c Release --no-restore + - dotnet publish LeagueOfLegends.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release + + - name: tests + image: mcr.microsoft.com/dotnet/sdk:6.0 + commands: + - cd Sources/ + - dotnet restore LeagueOfLegends.sln + - dotnet test LeagueOfLegends.sln --no-restore + depends_on: [build] + + - name: code-analysis + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6 + commands: + - cd Sources/ + - dotnet restore LeagueOfLegends.sln + - dotnet sonarscanner begin /k:$EntityFramework_LoL /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Tests/**" /d:sonar.login=$${PLUGIN_SONAR_TOKEN} + - dotnet build LeagueOfLegends.sln -c Release --no-restore + - dotnet test LeagueOfLegends.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 LeagueOfLegends.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release + - dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN} + secrets: [ SECRET_SONAR_LOGIN ] + settings: + # accessible en ligne de commande par $${PLUGIN_SONAR_HOST} + sonar_host: https://codefirst.iut.uca.fr/sonar/ + # accessible en ligne de commande par $${PLUGIN_SONAR_TOKEN} + sonar_token: + from_secret: SECRET_SONAR_LOGIN + depends_on: [tests] + + - name: generate-and-deploy-docs + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer + failure: ignore + volumes: + - name: docs + path: /docs + commands: + #- cd Documentation/doxygen + #- doxygen Doxyfile + - /entrypoint.sh + when: + branch: + - master + depends_on: [ build ] + +volumes: +- name: docs + temp: {} \ No newline at end of file diff --git a/Sources/LeagueOfLegends.sln b/Sources/LeagueOfLegends.sln index 19996b0..ec2c780 100644 --- a/Sources/LeagueOfLegends.sln +++ b/Sources/LeagueOfLegends.sln @@ -23,10 +23,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "API", "API\API.csproj", "{3 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleAPI", "ConsoleAPI\ConsoleAPI.csproj", "{1BC3389F-495C-4889-8969-BD566F1512AF}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StubEF", "StubEF\StubEF.csproj", "{9AA1A21B-90EE-4D6C-B47B-8FDA701078EF}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestEF", "TestEF\TestEF.csproj", "{84B0BF2B-17C8-403B-9A26-2310A2A368F9}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StubEF", "StubEF\StubEF.csproj", "{C1DC0ABC-B053-4E2F-8D9D-E283C68735E6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -65,14 +65,14 @@ Global {1BC3389F-495C-4889-8969-BD566F1512AF}.Debug|Any CPU.Build.0 = Debug|Any CPU {1BC3389F-495C-4889-8969-BD566F1512AF}.Release|Any CPU.ActiveCfg = Release|Any CPU {1BC3389F-495C-4889-8969-BD566F1512AF}.Release|Any CPU.Build.0 = Release|Any CPU - {9AA1A21B-90EE-4D6C-B47B-8FDA701078EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9AA1A21B-90EE-4D6C-B47B-8FDA701078EF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9AA1A21B-90EE-4D6C-B47B-8FDA701078EF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9AA1A21B-90EE-4D6C-B47B-8FDA701078EF}.Release|Any CPU.Build.0 = Release|Any CPU {84B0BF2B-17C8-403B-9A26-2310A2A368F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {84B0BF2B-17C8-403B-9A26-2310A2A368F9}.Debug|Any CPU.Build.0 = Debug|Any CPU {84B0BF2B-17C8-403B-9A26-2310A2A368F9}.Release|Any CPU.ActiveCfg = Release|Any CPU {84B0BF2B-17C8-403B-9A26-2310A2A368F9}.Release|Any CPU.Build.0 = Release|Any CPU + {C1DC0ABC-B053-4E2F-8D9D-E283C68735E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1DC0ABC-B053-4E2F-8D9D-E283C68735E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1DC0ABC-B053-4E2F-8D9D-E283C68735E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1DC0ABC-B053-4E2F-8D9D-E283C68735E6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -80,8 +80,8 @@ Global GlobalSection(NestedProjects) = preSolution {1889FA6E-B7C6-416E-8628-9449FB9070B9} = {C76D0C23-1FFA-4963-93CD-E12BD643F030} {B01D7EF2-2D64-409A-A29A-61FB7BB7A9DB} = {2C607793-B163-4731-A4D1-AFE8A7C4C170} - {9AA1A21B-90EE-4D6C-B47B-8FDA701078EF} = {2C607793-B163-4731-A4D1-AFE8A7C4C170} {84B0BF2B-17C8-403B-9A26-2310A2A368F9} = {C76D0C23-1FFA-4963-93CD-E12BD643F030} + {C1DC0ABC-B053-4E2F-8D9D-E283C68735E6} = {2C607793-B163-4731-A4D1-AFE8A7C4C170} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {92F3083D-793F-4552-8A9A-0AD6534159C9} diff --git a/Sources/StubEF/StubEF.csproj b/Sources/StubEF/StubEF.csproj index b4c70c5..499e832 100644 --- a/Sources/StubEF/StubEF.csproj +++ b/Sources/StubEF/StubEF.csproj @@ -9,7 +9,7 @@ - + diff --git a/Sources/StubEF/StubEFChampions.cs b/Sources/StubEF/StubEFChampions.cs index a86956e..5ce347c 100644 --- a/Sources/StubEF/StubEFChampions.cs +++ b/Sources/StubEF/StubEFChampions.cs @@ -17,12 +17,12 @@ namespace StubEF { base.OnModelCreating(modelBuilder); modelBuilder.Entity().HasData( - new EFChampion (1, "Akali", "maBio1", "monIcon1" ), - new EFChampion (2, "Aatrox", "maBio2", "monIcon2" ), - new EFChampion (3, "Ahri", "maBio3", "monIcon3" ), - new EFChampion (4, "Akshan", "maBio4", "monIcon4"), - new EFChampion (5, "Bard", "maBio5", "monIcon5"), - new EFChampion (6, "Alistar", "maBio6", "monIcon6") + new EFChampion { Id = 1, Name = "Akali", Bio = "maBio1", Icon = "monIcon1" }, + new EFChampion { Id=2, Name="Aatrox", Bio="maBio2", Icon="monIcon2" }, + new EFChampion { Id = 3, Name = "Ahri", Bio = "maBio3", Icon = "monIcon3" }, + new EFChampion { Id = 4, Name = "Akshan", Bio = "maBio4", Icon = "monIcon4" }, + new EFChampion { Id = 5, Name = "Bard", Bio = "maBio5", Icon = "monIcon5" }, + new EFChampion { Id = 6, Name = "Alistar", Bio = "maBio6", Icon = "monIcon6" } ); } } diff --git a/Sources/TestEF/TestEF.csproj b/Sources/TestEF/TestEF.csproj index 24a595b..ff1dd04 100644 --- a/Sources/TestEF/TestEF.csproj +++ b/Sources/TestEF/TestEF.csproj @@ -9,20 +9,19 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - diff --git a/Sources/TestEF/UnitTestChampion.cs b/Sources/TestEF/UnitTestChampion.cs index 9844bb6..cc5885d 100644 --- a/Sources/TestEF/UnitTestChampion.cs +++ b/Sources/TestEF/UnitTestChampion.cs @@ -12,7 +12,7 @@ namespace TestEF public async Task GetChampion_Test() { //connection must be opened to use In-memory database - var connection = new SqliteConnection("DataSource=:memory:"); + var connection = new SqliteConnection("DataSource =:memory:"); connection.Open(); var options = new DbContextOptionsBuilder().UseSqlite(connection).Options;