diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..6afe37a --- /dev/null +++ b/.drone.yml @@ -0,0 +1,81 @@ +kind: pipeline +type: docker +name: default + +trigger: + event: + - push + +steps: + + + - name: build + image: mcr.microsoft.com/dotnet/sdk:6.0 + commands: + - cd Sources/ + - dotnet restore MySolution.sln + - dotnet build MySolution.sln -c Release --no-restore + + + - name: tests + image: mcr.microsoft.com/dotnet/sdk:6.0 + commands: + - cd Sources/ + - dotnet restore MySolution.sln + - dotnet test MySolution.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 MySolution.sln + - dotnet sonarscanner begin /k:$REPO_NAME /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 MySolution.sln -c Release --no-restore + - dotnet test MySolution.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 MySolution.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: + - /entrypoint.sh + when: + branch: + - master + depends_on: [ build ] + + - name: docker-build + image: plugins/docker + settings: + dockerfile: Sources/Dockerfile + context: . + registry: hub.codefirst.iut.uca.fr + repo: hub.codefirst.iut.uca.fr/my-group/my-application-client + username: + from_secret: SECRET_REGISTRY_USERNAME + password: + from_secret: SECRET_REGISTRY_PASSWORD + when: + branch: + - master + +# The volumes declaration appear at the end of the file, after all steps +volumes: +- name: docs + temp: {} \ No newline at end of file diff --git a/Blazor.csproj b/Blazor.csproj index 1801469..334b285 100644 --- a/Blazor.csproj +++ b/Blazor.csproj @@ -4,6 +4,9 @@ net6.0 enable enable + b0b030db-9ce6-45da-9caa-5e0e14c1a3f2 + Linux + . @@ -12,6 +15,8 @@ + + diff --git a/Blazor.sln b/Blazor.sln index 027a199..7c694b1 100644 --- a/Blazor.sln +++ b/Blazor.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.4.33103.184 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor", "Blazor.csproj", "{91C123A8-0331-470F-82BF-AF46E9DBADFF}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Minecraft.Crafting.Api", "..\Minecraft.Crafting.Api\Minecraft.Crafting.Api.csproj", "{C2EE1DDF-F78D-4C2B-8438-8CFD5BF0D7E2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {91C123A8-0331-470F-82BF-AF46E9DBADFF}.Debug|Any CPU.Build.0 = Debug|Any CPU {91C123A8-0331-470F-82BF-AF46E9DBADFF}.Release|Any CPU.ActiveCfg = Release|Any CPU {91C123A8-0331-470F-82BF-AF46E9DBADFF}.Release|Any CPU.Build.0 = Release|Any CPU + {C2EE1DDF-F78D-4C2B-8438-8CFD5BF0D7E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C2EE1DDF-F78D-4C2B-8438-8CFD5BF0D7E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C2EE1DDF-F78D-4C2B-8438-8CFD5BF0D7E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C2EE1DDF-F78D-4C2B-8438-8CFD5BF0D7E2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Component/CraftingItem.razor b/Component/CraftingItem.razor index e64e6cd..7c83171 100644 --- a/Component/CraftingItem.razor +++ b/Component/CraftingItem.razor @@ -8,6 +8,6 @@ @if (Item != null) { - @Item.DisplayName + @Item.DisplayName } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b6df572 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["Blazor.csproj", "."] +RUN dotnet restore "./Blazor.csproj" +COPY . . +WORKDIR "/src/." +COPY ["nuget.config", "."] +RUN dotnet build "Blazor.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "Blazor.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Blazor.dll"] \ No newline at end of file diff --git a/Pages/List.razor b/Pages/List.razor index d2b127b..7002315 100644 --- a/Pages/List.razor +++ b/Pages/List.razor @@ -58,7 +58,7 @@ } else { - @context.DisplayName + @context.DisplayName } \ No newline at end of file diff --git a/PositionOptions.cs b/PositionOptions.cs new file mode 100644 index 0000000..3fc9b3f --- /dev/null +++ b/PositionOptions.cs @@ -0,0 +1,10 @@ +namespace Blazor +{ + public class PositionOptions + { + public const string Position = "Position"; + + public string Title { get; set; } + public string Name { get; set; } + } +} diff --git a/Program.cs b/Program.cs index f5f7dbe..3c32841 100644 --- a/Program.cs +++ b/Program.cs @@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Localization; using System.Globalization; using Microsoft.Extensions.Options; +using Microsoft.Extensions.Logging; var builder = WebApplication.CreateBuilder(args); @@ -25,10 +26,10 @@ builder.Services .AddFontAwesomeIcons() .AddBlazoredModal(); -builder.Services.AddScoped(); builder.Services.AddBlazoredLocalStorage(); // Add the controller of the app builder.Services.AddControllers(); +builder.Services.AddScoped(); // Add the localization to the app and specify the resources path builder.Services.AddLocalization(opts => { opts.ResourcesPath = "Resources"; }); diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index 7200007..bd9cb88 100644 --- a/Properties/launchSettings.json +++ b/Properties/launchSettings.json @@ -1,21 +1,13 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:6913", - "sslPort": 44309 - } - }, "profiles": { "Blazor": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "https://localhost:7027;http://localhost:5027", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7027;http://localhost:5027" }, "IIS Express": { "commandName": "IISExpress", @@ -23,6 +15,21 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "publishAllPorts": true, + "useSSL": true + } + }, + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:6913", + "sslPort": 44309 } } -} +} \ No newline at end of file diff --git a/appsettings.Development.json b/appsettings.Development.json deleted file mode 100644 index 770d3e9..0000000 --- a/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "DetailedErrors": true, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/appsettings.json b/appsettings.json deleted file mode 100644 index 10f68b8..0000000 --- a/appsettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -}