From 56339e50cc78e963b9634143af0986919cad4d43 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 13 Nov 2021 17:46:54 -0600 Subject: upgrade to .net 6 --- Dockerfile | 4 ++-- src/slskd/Common/Compute.cs | 2 +- src/slskd/Common/Extensions.cs | 2 +- src/slskd/Core/API/Controllers/ApplicationController.cs | 2 +- src/slskd/Integrations/FTP/FTPService.cs | 2 +- src/slskd/Startup.cs | 2 +- src/slskd/slskd.csproj | 12 ++++++------ tests/slskd.Tests.Integration/slskd.Tests.Integration.csproj | 2 +- tests/slskd.Tests.Unit/slskd.Tests.Unit.csproj | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 92e19ccd..da5fd4de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN sh ./bin/build --web-only --version $VERSION # build, test, and publish application binaries # note: this needs to be pinned to an amd64 image in order to publish armv7 binaries # https://github.com/dotnet/dotnet-docker/issues/1537#issuecomment-615269150 -FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim-amd64 AS publish +FROM mcr.microsoft.com/dotnet/sdk:6.0-buster-slim-amd64 AS publish ARG TARGETPLATFORM ARG VERSION=0.0.1.65534-local @@ -31,7 +31,7 @@ RUN bash ./bin/build --dotnet-only --version $VERSION RUN bash ./bin/publish --no-prebuild --platform $TARGETPLATFORM --version $VERSION --output ../../dist/${TARGETPLATFORM} # application -FROM mcr.microsoft.com/dotnet/runtime-deps:5.0-buster-slim AS slskd +FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-buster-slim AS slskd ARG TARGETPLATFORM ARG TAG=0.0.1 ARG VERSION=0.0.1.65534-local diff --git a/src/slskd/Common/Compute.cs b/src/slskd/Common/Compute.cs index 464a932d..eacaedf1 100644 --- a/src/slskd/Common/Compute.cs +++ b/src/slskd/Common/Compute.cs @@ -41,7 +41,7 @@ namespace slskd public static string Sha1Hash(string str) { - using var sha1 = new SHA1Managed(); + using var sha1 = SHA1.Create(); return BitConverter.ToString(sha1.ComputeHash(Encoding.UTF8.GetBytes(str))).Replace("-", string.Empty); } diff --git a/src/slskd/Common/Extensions.cs b/src/slskd/Common/Extensions.cs index 03bec7fe..79314389 100644 --- a/src/slskd/Common/Extensions.cs +++ b/src/slskd/Common/Extensions.cs @@ -284,7 +284,7 @@ namespace slskd var options = new JsonSerializerOptions(); options.Converters.Add(new IPAddressConverter()); options.Converters.Add(new JsonStringEnumConverter()); - options.IgnoreNullValues = true; + options.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; return options; } } diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs index a7168efb..82b1d6c5 100644 --- a/src/slskd/Core/API/Controllers/ApplicationController.cs +++ b/src/slskd/Core/API/Controllers/ApplicationController.cs @@ -119,7 +119,7 @@ namespace slskd.Core.API /// [HttpPost("gc")] [Authorize] - public async Task CollectGarbage() + public IActionResult CollectGarbage() { GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect(2, GCCollectionMode.Forced, blocking: false, compacting: true); diff --git a/src/slskd/Integrations/FTP/FTPService.cs b/src/slskd/Integrations/FTP/FTPService.cs index dd1b340f..32b8b253 100644 --- a/src/slskd/Integrations/FTP/FTPService.cs +++ b/src/slskd/Integrations/FTP/FTPService.cs @@ -62,7 +62,7 @@ namespace slskd.Integrations.FTP { if (!FtpOptions.Enabled) { - Log.LogDebug("Skipping FTP upload of {filename}; FTP integration is disabled"); + Log.LogDebug("Skipping FTP upload of {filename}; FTP integration is disabled", filename); return; } diff --git a/src/slskd/Startup.cs b/src/slskd/Startup.cs index a8b64305..ac4a2789 100644 --- a/src/slskd/Startup.cs +++ b/src/slskd/Startup.cs @@ -169,7 +169,7 @@ namespace slskd { options.JsonSerializerOptions.Converters.Add(new IPAddressConverter()); options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); - options.JsonSerializerOptions.IgnoreNullValues = true; + options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; }); services.AddSignalR().AddJsonProtocol(options => diff --git a/src/slskd/slskd.csproj b/src/slskd/slskd.csproj index 58f7cfe0..65f6845c 100644 --- a/src/slskd/slskd.csproj +++ b/src/slskd/slskd.csproj @@ -8,7 +8,7 @@ - net5.0 + net6.0 9.0 Properties\analysis.ruleset true @@ -43,15 +43,15 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/tests/slskd.Tests.Integration/slskd.Tests.Integration.csproj b/tests/slskd.Tests.Integration/slskd.Tests.Integration.csproj index 89e935fa..ac1378c6 100644 --- a/tests/slskd.Tests.Integration/slskd.Tests.Integration.csproj +++ b/tests/slskd.Tests.Integration/slskd.Tests.Integration.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 false diff --git a/tests/slskd.Tests.Unit/slskd.Tests.Unit.csproj b/tests/slskd.Tests.Unit/slskd.Tests.Unit.csproj index 569f124c..a3538c0a 100644 --- a/tests/slskd.Tests.Unit/slskd.Tests.Unit.csproj +++ b/tests/slskd.Tests.Unit/slskd.Tests.Unit.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 false -- cgit v1.2.3 From d6e62731414ea75fca96265f22997a2d31183b0a Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 20 Nov 2021 16:31:12 -0600 Subject: set up .net --- .github/workflows/ci.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7603ad86..2c85d678 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,9 @@ on: branches: [ master ] workflow_dispatch: +env: + DOTNET_VERSION: '6.0.0' + jobs: build: name: Build and Test @@ -17,6 +20,11 @@ jobs: with: fetch-depth: 0 + - name: Set Up .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + - name: Set Environment Variables run: | echo "VERSION=$(git describe --tags --abbrev=0).$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV @@ -48,6 +56,11 @@ jobs: with: fetch-depth: 0 + - name: Set Up .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + - name: Set Environment Variables run: | echo "VERSION=$(git describe --tags --abbrev=0).$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV -- cgit v1.2.3