From 1a410bbaffbcbbfdf89c898511ecf4eadceab72e Mon Sep 17 00:00:00 2001 From: Michael Green <84688932+michael-j-green@users.noreply.github.com> Date: Thu, 1 Feb 2024 11:36:12 +1100 Subject: [PATCH] .net8.0 upgrade required to build ARM on GitHub --- .github/workflows/BuildOnTestBranch.yml | 4 +++ Dockerfile | 4 +-- Gaseous.sln | 4 +-- .../Controllers/V1.0/AccountController.cs | 1 + .../V1.0/BackgroundTasksController.cs | 1 + .../Controllers/V1.0/BiosController.cs | 1 + .../Controllers/V1.0/CollectionsController.cs | 1 + .../Controllers/V1.0/FilterController.cs | 1 + .../Controllers/V1.0/GamesController.cs | 1 + .../Controllers/V1.0/LibraryController.cs | 1 + .../Controllers/V1.0/LogsController.cs | 1 + .../V1.0/PlatformMapsController.cs | 1 + .../Controllers/V1.0/PlatformsController.cs | 1 + .../Controllers/V1.0/RomsController.cs | 1 + .../Controllers/V1.0/SearchController.cs | 2 +- .../Controllers/V1.0/SignaturesController.cs | 1 + .../Controllers/V1.0/SystemController.cs | 1 + .../Controllers/V1.1/FirstSetupController.cs | 1 + .../Controllers/V1.1/GamesController.cs | 1 + .../Controllers/V1.1/RatingsController.cs | 1 + .../V1.1/StateManagerController.cs | 1 + gaseous-server/Program.cs | 34 +++++++------------ gaseous-server/gaseous-server.csproj | 29 +++++++--------- 23 files changed, 51 insertions(+), 43 deletions(-) diff --git a/.github/workflows/BuildOnTestBranch.yml b/.github/workflows/BuildOnTestBranch.yml index cd5e90b5..6a8218d7 100644 --- a/.github/workflows/BuildOnTestBranch.yml +++ b/.github/workflows/BuildOnTestBranch.yml @@ -12,6 +12,10 @@ jobs: uses: actions/checkout@v3 with: submodules: 'true' + - name: Install dotnet tool + run: dotnet tool install -g dotnetCampus.TagToVersion + - name: Set tag to version + run: dotnet TagToVersion -t 0.0.1 - name: Sign in to Nuget run: dotnet nuget add source --username michael-j-green --password ${{ secrets.NUGETKEY }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/gaseous-project/index.json" - name: Set up QEMU diff --git a/Dockerfile b/Dockerfile index 9a459949..ac8eedd0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env WORKDIR /App EXPOSE 80 @@ -16,7 +16,7 @@ RUN wget https://cdn.emulatorjs.org/releases/4.0.9.7z RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.0.9.7z # Build runtime image -FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0 WORKDIR /App COPY --from=build-env /App/out . ENTRYPOINT ["dotnet", "gaseous-server.dll"] diff --git a/Gaseous.sln b/Gaseous.sln index cca272b8..8b88e803 100644 --- a/Gaseous.sln +++ b/Gaseous.sln @@ -1,9 +1,9 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 25.0.1704.4 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gaseous-server", "gaseous-server\gaseous-server.csproj", "{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "gaseous-server", "gaseous-server\gaseous-server.csproj", "{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{17FA6F12-8532-420C-9489-CB8FDE42137C}" ProjectSection(SolutionItems) = preProject diff --git a/gaseous-server/Controllers/V1.0/AccountController.cs b/gaseous-server/Controllers/V1.0/AccountController.cs index eb2249b0..e5b38751 100644 --- a/gaseous-server/Controllers/V1.0/AccountController.cs +++ b/gaseous-server/Controllers/V1.0/AccountController.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/BackgroundTasksController.cs b/gaseous-server/Controllers/V1.0/BackgroundTasksController.cs index 877bbd13..73e4351a 100644 --- a/gaseous-server/Controllers/V1.0/BackgroundTasksController.cs +++ b/gaseous-server/Controllers/V1.0/BackgroundTasksController.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/BiosController.cs b/gaseous-server/Controllers/V1.0/BiosController.cs index 732b2f89..6dc01f8e 100644 --- a/gaseous-server/Controllers/V1.0/BiosController.cs +++ b/gaseous-server/Controllers/V1.0/BiosController.cs @@ -6,6 +6,7 @@ using gaseous_server.Classes; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/CollectionsController.cs b/gaseous-server/Controllers/V1.0/CollectionsController.cs index 6a67307a..a5abb8a4 100644 --- a/gaseous-server/Controllers/V1.0/CollectionsController.cs +++ b/gaseous-server/Controllers/V1.0/CollectionsController.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/FilterController.cs b/gaseous-server/Controllers/V1.0/FilterController.cs index ad25624d..30a54b0f 100644 --- a/gaseous-server/Controllers/V1.0/FilterController.cs +++ b/gaseous-server/Controllers/V1.0/FilterController.cs @@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/GamesController.cs b/gaseous-server/Controllers/V1.0/GamesController.cs index df14fbd0..b1067b39 100644 --- a/gaseous-server/Controllers/V1.0/GamesController.cs +++ b/gaseous-server/Controllers/V1.0/GamesController.cs @@ -17,6 +17,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis.Scripting; using static gaseous_server.Classes.Metadata.AgeRatings; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/LibraryController.cs b/gaseous-server/Controllers/V1.0/LibraryController.cs index fe5981e9..59211f1d 100644 --- a/gaseous-server/Controllers/V1.0/LibraryController.cs +++ b/gaseous-server/Controllers/V1.0/LibraryController.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/LogsController.cs b/gaseous-server/Controllers/V1.0/LogsController.cs index d0e22204..172bc20a 100644 --- a/gaseous-server/Controllers/V1.0/LogsController.cs +++ b/gaseous-server/Controllers/V1.0/LogsController.cs @@ -5,6 +5,7 @@ using gaseous_server.Classes; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/PlatformMapsController.cs b/gaseous-server/Controllers/V1.0/PlatformMapsController.cs index 18304a3f..2e484603 100644 --- a/gaseous-server/Controllers/V1.0/PlatformMapsController.cs +++ b/gaseous-server/Controllers/V1.0/PlatformMapsController.cs @@ -14,6 +14,7 @@ using Microsoft.CodeAnalysis.Scripting; using Microsoft.AspNetCore.Authorization; using System.Text; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/PlatformsController.cs b/gaseous-server/Controllers/V1.0/PlatformsController.cs index 2cd370eb..d91236cc 100644 --- a/gaseous-server/Controllers/V1.0/PlatformsController.cs +++ b/gaseous-server/Controllers/V1.0/PlatformsController.cs @@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis.Scripting; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/RomsController.cs b/gaseous-server/Controllers/V1.0/RomsController.cs index 792df545..a6fe557c 100644 --- a/gaseous-server/Controllers/V1.0/RomsController.cs +++ b/gaseous-server/Controllers/V1.0/RomsController.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis.Scripting; using static gaseous_server.Classes.Metadata.AgeRatings; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/SearchController.cs b/gaseous-server/Controllers/V1.0/SearchController.cs index 8db4e5bf..a4766881 100644 --- a/gaseous-server/Controllers/V1.0/SearchController.cs +++ b/gaseous-server/Controllers/V1.0/SearchController.cs @@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Mvc; using NuGet.Common; using static gaseous_server.Classes.Metadata.Games; - +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.0/SignaturesController.cs b/gaseous-server/Controllers/V1.0/SignaturesController.cs index 9cb70468..2d85377d 100644 --- a/gaseous-server/Controllers/V1.0/SignaturesController.cs +++ b/gaseous-server/Controllers/V1.0/SignaturesController.cs @@ -8,6 +8,7 @@ using gaseous_signature_parser.models.RomSignatureObject; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Asp.Versioning; // For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 diff --git a/gaseous-server/Controllers/V1.0/SystemController.cs b/gaseous-server/Controllers/V1.0/SystemController.cs index 09657fcd..e7d95cf6 100644 --- a/gaseous-server/Controllers/V1.0/SystemController.cs +++ b/gaseous-server/Controllers/V1.0/SystemController.cs @@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Razor.Hosting; using RestEase; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.1/FirstSetupController.cs b/gaseous-server/Controllers/V1.1/FirstSetupController.cs index a8ae898f..3b88c67a 100644 --- a/gaseous-server/Controllers/V1.1/FirstSetupController.cs +++ b/gaseous-server/Controllers/V1.1/FirstSetupController.cs @@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using Asp.Versioning; namespace gaseous_server.Controllers { diff --git a/gaseous-server/Controllers/V1.1/GamesController.cs b/gaseous-server/Controllers/V1.1/GamesController.cs index 979da2ba..ea730462 100644 --- a/gaseous-server/Controllers/V1.1/GamesController.cs +++ b/gaseous-server/Controllers/V1.1/GamesController.cs @@ -17,6 +17,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Scripting; using static gaseous_server.Classes.Metadata.AgeRatings; +using Asp.Versioning; namespace gaseous_server.Controllers.v1_1 { diff --git a/gaseous-server/Controllers/V1.1/RatingsController.cs b/gaseous-server/Controllers/V1.1/RatingsController.cs index d02355dc..845b3b6f 100644 --- a/gaseous-server/Controllers/V1.1/RatingsController.cs +++ b/gaseous-server/Controllers/V1.1/RatingsController.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis.Scripting; using static gaseous_server.Classes.Metadata.AgeRatings; +using Asp.Versioning; namespace gaseous_server.Controllers.v1_1 { diff --git a/gaseous-server/Controllers/V1.1/StateManagerController.cs b/gaseous-server/Controllers/V1.1/StateManagerController.cs index 37398e0a..db47d7ed 100644 --- a/gaseous-server/Controllers/V1.1/StateManagerController.cs +++ b/gaseous-server/Controllers/V1.1/StateManagerController.cs @@ -5,6 +5,7 @@ using Authentication; using Microsoft.AspNetCore.Identity; using System.Data; +using Asp.Versioning; namespace gaseous_server.Controllers.v1_1 { diff --git a/gaseous-server/Program.cs b/gaseous-server/Program.cs index 62b13e36..02db4a2f 100644 --- a/gaseous-server/Program.cs +++ b/gaseous-server/Program.cs @@ -3,18 +3,14 @@ using gaseous_server; using gaseous_server.Classes; using gaseous_server.Models; -using gaseous_server.SignatureIngestors.XML; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Versioning; -using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.OpenApi.Models; using Authentication; using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Identity.UI.Services; -using IGDB.Models; using gaseous_server.Classes.Metadata; +using Asp.Versioning; Logging.WriteToDiskOnly = true; Logging.Log(Logging.LogType.Information, "Startup", "Starting Gaseous Server " + Assembly.GetExecutingAssembly().GetName().Version); @@ -131,12 +127,7 @@ config.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader(), new HeaderApiVersionReader("x-api-version"), new MediaTypeApiVersionReader("x-api-version")); -}); -// builder.Services.AddApiVersioning(setup => -// { -// setup.ApiVersionReader = new UrlSegmentApiVersionReader(); -// }); -builder.Services.AddVersionedApiExplorer(setup => +}).AddApiExplorer(setup => { setup.GroupNameFormat = "'v'VVV"; setup.SubstituteApiVersionInUrl = true; @@ -233,15 +224,6 @@ options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest; options.Cookie.SameSite = SameSiteMode.Strict; }); -// builder.Services.AddIdentityCore(options => { -// options.SignIn.RequireConfirmedAccount = false; -// options.User.RequireUniqueEmail = true; -// options.Password.RequireDigit = false; -// options.Password.RequiredLength = 10; -// options.Password.RequireNonAlphanumeric = false; -// options.Password.RequireUppercase = false; -// options.Password.RequireLowercase = false; -// }); builder.Services.AddScoped(); builder.Services.AddScoped(); @@ -268,8 +250,16 @@ app.UseSwagger(); app.UseSwaggerUI(options => { - options.SwaggerEndpoint($"/swagger/v1/swagger.json", "v1.0"); - options.SwaggerEndpoint($"/swagger/v1.1/swagger.json", "v1.1"); + // options.SwaggerEndpoint($"/swagger/v1/swagger.json", "v1.0"); + // options.SwaggerEndpoint($"/swagger/v1.1/swagger.json", "v1.1"); + + var descriptions = app.DescribeApiVersions(); + foreach (var description in descriptions) + { + var url = $"/swagger/{description.GroupName}/swagger.json"; + var name = description.GroupName.ToUpperInvariant(); + options.SwaggerEndpoint(url, name); + } } ); //} diff --git a/gaseous-server/gaseous-server.csproj b/gaseous-server/gaseous-server.csproj index 64213bea..7c627f8a 100644 --- a/gaseous-server/gaseous-server.csproj +++ b/gaseous-server/gaseous-server.csproj @@ -1,12 +1,10 @@ - - net7.0 + net8.0 enable enable gaseous_server - @@ -18,23 +16,22 @@ bin\Release\net7.0\gaseous-server.xml - - - + + + + + - - - - - - + - + + + + - @@ -75,7 +72,7 @@ - PreserveNewest + PreserveNewest @@ -102,4 +99,4 @@ - + \ No newline at end of file