From 23ddbace7f24fab6b74c23d47db3e1fe04b72a97 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 16 Nov 2021 23:13:40 +0100 Subject: [PATCH] Add more .NET Core 3.1 validation tests in CI script --- .github/workflows/dotnet.yml | 40 ++++++++++++++----- .../ComputeSharp.ImageProcessing.csproj | 3 +- .../ComputeSharp.Sample.NuGet.csproj | 3 +- .../ComputeSharp.Sample.csproj | 3 +- .../NativeLibrariesResolverTests.cs | 4 +- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 1e31a033..1badc5cc 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -59,28 +59,44 @@ jobs: steps: - name: Git checkout uses: actions/checkout@v2 + - name: Setup .NET Core 3.1 SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.x - name: Setup .NET 6 SDK uses: actions/setup-dotnet@v1 with: dotnet-version: 6.0.x - - name: Build ComputeSharp.Sample - run: dotnet build samples\ComputeSharp.Sample\ComputeSharp.Sample.csproj -c Release + - name: Build ComputeSharp.Sample (.NET 6) + run: dotnet build samples\ComputeSharp.Sample\ComputeSharp.Sample.csproj -c Release -f net6.0 shell: cmd - - name: Run ComputeSharp.Sample + - name: Run ComputeSharp.Sample (.NET 6) run: dotnet samples\ComputeSharp.Sample\bin\Release\net6.0\ComputeSharp.Sample.dll shell: cmd + - name: Build ComputeSharp.Sample (.NET Core 3.1) + run: dotnet build samples\ComputeSharp.Sample\ComputeSharp.Sample.csproj -c Release -f netcoreapp3.1 /p:Platform=x64 -r win-x64 + shell: cmd + - name: Run ComputeSharp.Sample (.NET Core 3.1) + run: samples\ComputeSharp.Sample\bin\x64\Release\netcoreapp3.1\win-x64\ComputeSharp.Sample.exe + shell: cmd - name: Build ComputeSharp.Sample.FSharp run: dotnet build samples\ComputeSharp.Sample.FSharp\ComputeSharp.Sample.FSharp.fsproj -c Release shell: cmd - name: Run ComputeSharp.Sample.FSharp run: dotnet samples\ComputeSharp.Sample.FSharp\bin\Release\net6.0\ComputeSharp.Sample.FSharp.dll shell: cmd - - name: Build ComputeSharp.ImageProcessing.csproj - run: dotnet build samples\ComputeSharp.ImageProcessing\ComputeSharp.ImageProcessing.csproj -c Release + - name: Build ComputeSharp.ImageProcessing.csproj (.NET 6) + run: dotnet build samples\ComputeSharp.ImageProcessing\ComputeSharp.ImageProcessing.csproj -c Release -f net6.0 shell: cmd - - name: Run ComputeSharp.ImageProcessing.csproj + - name: Run ComputeSharp.ImageProcessing.csproj (.NET 6) run: dotnet samples\ComputeSharp.ImageProcessing\bin\Release\net6.0\ComputeSharp.ImageProcessing.dll shell: cmd + - name: Build ComputeSharp.ImageProcessing.csproj (.NET Core 3.1) + run: dotnet build samples\ComputeSharp.ImageProcessing\ComputeSharp.ImageProcessing.csproj -c Release -f netcoreapp3.1 /p:Platform=x64 -r win-x64 + shell: cmd + - name: Run ComputeSharp.ImageProcessing.csproj (.NET Core 3.1) + run: samples\ComputeSharp.ImageProcessing\bin\x64\Release\netcoreapp3.1\win-x64\ComputeSharp.ImageProcessing.exe + shell: cmd - name: Build ComputeSharp.Benchmark.csproj run: dotnet build samples\ComputeSharp.Benchmark\ComputeSharp.Benchmark.csproj -c Release shell: cmd @@ -130,12 +146,18 @@ jobs: with: name: ComputeSharp.nupkg path: src\ComputeSharp.Package\bin\Release\ComputeSharp.nupkg - - name: Build ComputeSharp.Sample.NuGet - run: dotnet build samples\ComputeSharp.Sample.NuGet\ComputeSharp.Sample.NuGet.csproj -c Release + - name: Build ComputeSharp.Sample.NuGet (.NET 6) + run: dotnet build samples\ComputeSharp.Sample.NuGet\ComputeSharp.Sample.NuGet.csproj -c Release -f net6.0 shell: cmd - - name: Run ComputeSharp.Sample.NuGet + - name: Run ComputeSharp.Sample.NuGet (.NET 6) run: dotnet samples\ComputeSharp.Sample.NuGet\bin\Release\net6.0\ComputeSharp.Sample.NuGet.dll shell: cmd + - name: Build ComputeSharp.Sample.NuGet (.NET Core 3.1) + run: dotnet build samples\ComputeSharp.Sample.NuGet\ComputeSharp.Sample.NuGet.csproj -c Release -f netcoreapp3.1 -r win-x64 + shell: cmd + - name: Run ComputeSharp.Sample.NuGet (.NET Core 3.1) + run: samples\ComputeSharp.Sample.NuGet\bin\Release\netcoreapp3.1\win-x64\ComputeSharp.Sample.NuGet.exe + shell: cmd # Run the extra tests to validate a number of build and publishing configurations. # This is used to ensure the native dependencies can always be loaded correctly diff --git a/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj b/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj index fa78d65d..8e8919f8 100644 --- a/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj +++ b/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj @@ -2,7 +2,8 @@ Exe - net6.0 + netcoreapp3.1;net6.0 + AnyCPU;x64;ARM64 diff --git a/samples/ComputeSharp.Sample.NuGet/ComputeSharp.Sample.NuGet.csproj b/samples/ComputeSharp.Sample.NuGet/ComputeSharp.Sample.NuGet.csproj index 8a48f676..0469d323 100644 --- a/samples/ComputeSharp.Sample.NuGet/ComputeSharp.Sample.NuGet.csproj +++ b/samples/ComputeSharp.Sample.NuGet/ComputeSharp.Sample.NuGet.csproj @@ -2,7 +2,8 @@ Exe - net6.0 + netcoreapp3.1;net6.0 + AnyCPU;x64;ARM64 diff --git a/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj b/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj index 54c7d518..6b126849 100644 --- a/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj +++ b/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj @@ -2,7 +2,8 @@ Exe - net6.0 + netcoreapp3.1;net6.0 + AnyCPU;x64;ARM64 diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs b/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs index 87814d9e..cd9741a3 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs @@ -46,7 +46,7 @@ public class NativeLibrariesResolverTests { CleanSampleProject(configuration, rid); - Assert.AreEqual(0, Exec(SampleProjectDirectory!, "dotnet", $"run -c {configuration} {ToOption(rid)}")); + Assert.AreEqual(0, Exec(SampleProjectDirectory!, "dotnet", $"run -c {configuration} -f net6.0 {ToOption(rid)}")); } [TestMethod] @@ -123,7 +123,7 @@ public class NativeLibrariesResolverTests // Furthermore, only publishing in Release mode is tested. CleanSampleProject(Configuration.Release, RID.Win_x64); - Exec(SampleProjectDirectory!, "dotnet", $"publish -c Release -r win-x64 {ToOption(publishMode)} {ToOption(deploymentMode)} {ToOption(nativeLibsDeploymentMode)} /bl"); + Exec(SampleProjectDirectory!, "dotnet", $"publish -c Release -f net6.0 -r win-x64 {ToOption(publishMode)} {ToOption(deploymentMode)} {ToOption(nativeLibsDeploymentMode)} /bl"); string pathToAppHost = Path.Combine("bin", $"Release", "net6.0", "win-x64", "publish", "ComputeSharp.Sample.NuGet.exe");