diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index bbea182c..fa25ac2b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -7,7 +7,7 @@ jobs: # Build the ComputeSharp project directly. This is the project that # would be built when running any of the local samples or unit tests. build-project: - runs-on: windows-latest + runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 @@ -23,7 +23,7 @@ jobs: run-tests: if: success() needs: [build-project] - runs-on: windows-latest + runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 @@ -61,7 +61,7 @@ jobs: run-samples: if: success() needs: [run-tests] - runs-on: windows-latest + runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 @@ -85,6 +85,12 @@ jobs: - 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 (.NET Framework 4.7.2) + run: dotnet build samples\ComputeSharp.Sample\ComputeSharp.Sample.csproj -c Release -f net472 /p:Platform=x64 + shell: cmd + - name: Run ComputeSharp.Sample (.NET Framework 4.7.2) + run: samples\ComputeSharp.Sample\bin\x64\Release\net472\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 @@ -103,6 +109,12 @@ jobs: - 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.ImageProcessing.csproj (.NET Framework 4.7.2) + run: dotnet build samples\ComputeSharp.ImageProcessing\ComputeSharp.ImageProcessing.csproj -c Release -f net472 /p:Platform=x64 + shell: cmd + - name: Run ComputeSharp.ImageProcessing.csproj (.NET Framework 4.7.2) + run: samples\ComputeSharp.ImageProcessing\bin\x64\Release\net472\ComputeSharp.ImageProcessing.exe + shell: cmd - name: Build ComputeSharp.Benchmark.csproj run: dotnet build samples\ComputeSharp.Benchmark\ComputeSharp.Benchmark.csproj -c Release shell: cmd @@ -113,7 +125,7 @@ jobs: # Buils the .msbuildproj project to generate the NuGet package. # This workflow also uploads the resulting package as an artifact. build-package: - runs-on: windows-latest + runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 @@ -136,7 +148,7 @@ jobs: verify-package: if: success() needs: [build-package] - runs-on: windows-latest + runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 @@ -164,6 +176,12 @@ jobs: - 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 + - name: Build ComputeSharp.Sample.NuGet (.NET Framework 4.7.2) + run: dotnet build samples\ComputeSharp.Sample.NuGet\ComputeSharp.Sample.NuGet.csproj -c Release -f net472 /p:Platform=x64 + shell: cmd + - name: Run ComputeSharp.Sample.NuGet (.NET Framework 4.7.2) + run: samples\ComputeSharp.Sample.NuGet\bin\x64\Release\net472\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 @@ -171,7 +189,7 @@ jobs: verify-libs: if: success() needs: [verify-package] - runs-on: windows-latest + runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 diff --git a/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj b/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj index 8e8919f8..e9acb27c 100644 --- a/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj +++ b/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1;net6.0 + net472;netcoreapp3.1;net6.0 AnyCPU;x64;ARM64 diff --git a/samples/ComputeSharp.ImageProcessing/Program.cs b/samples/ComputeSharp.ImageProcessing/Program.cs index 2487916f..0318a63e 100644 --- a/samples/ComputeSharp.ImageProcessing/Program.cs +++ b/samples/ComputeSharp.ImageProcessing/Program.cs @@ -28,9 +28,16 @@ class Program using Image copy = image.Clone(c => c.ApplyProcessor(effect.Processor)); Console.WriteLine($">> Saving {effect.Name} to disk"); - string targetPath = Path.Combine( - Path.GetRelativePath(Path.GetDirectoryName(path)!, @"..\..\..\"), - $"{Path.GetFileNameWithoutExtension(path)}_{effect.Name}{Path.GetExtension(path)}"); + + string targetPath = Path.GetDirectoryName(path)!; + + while (Path.GetFileName(targetPath) != "ComputeSharp.ImageProcessing") + { + targetPath = Path.GetDirectoryName(targetPath)!; + } + + targetPath = Path.Combine(targetPath, $"{Path.GetFileNameWithoutExtension(path)}_{effect.Name}{Path.GetExtension(path)}"); + copy.Save(targetPath); } } diff --git a/samples/ComputeSharp.Sample.NuGet/ComputeSharp.Sample.NuGet.csproj b/samples/ComputeSharp.Sample.NuGet/ComputeSharp.Sample.NuGet.csproj index 0469d323..a518813b 100644 --- a/samples/ComputeSharp.Sample.NuGet/ComputeSharp.Sample.NuGet.csproj +++ b/samples/ComputeSharp.Sample.NuGet/ComputeSharp.Sample.NuGet.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1;net6.0 + net472;netcoreapp3.1;net6.0 AnyCPU;x64;ARM64 diff --git a/samples/ComputeSharp.Sample.Shared/Program.cs b/samples/ComputeSharp.Sample.Shared/Program.cs index 3fc4ead9..c1dfd234 100644 --- a/samples/ComputeSharp.Sample.Shared/Program.cs +++ b/samples/ComputeSharp.Sample.Shared/Program.cs @@ -59,7 +59,7 @@ partial class Program for (int i = 0; i < height; i++) { - var row = array[(i * width)..((i + 1) * width)]; + var row = array.AsSpan(i * width, width).ToArray(); var text = string.Join(",", row.Select(x => x.ToString(CultureInfo.InvariantCulture).PadLeft(numberWidth))); Console.WriteLine(text); diff --git a/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj b/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj index 6b126849..ce698002 100644 --- a/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj +++ b/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1;net6.0 + net472;netcoreapp3.1;net6.0 AnyCPU;x64;ARM64