From f2ee0e925e4cc492f8f064873b1cd65124d6217c Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 6 Nov 2022 16:26:55 +0100 Subject: [PATCH] Use matrix to run samples in pipeline --- .github/workflows/dotnet.yml | 66 ++++++++----------- .../ComputeSharp.Sample.FSharp.Shaders.csproj | 4 +- .../ComputeSharp.Sample.FSharp.fsproj | 3 +- 3 files changed, 33 insertions(+), 40 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index a6478579..0736b5f2 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -127,53 +127,45 @@ jobs: shell: cmd # Run all the local samples to ensure they build and run with no errors - run-dx12-samples: + run-samples: needs: [build-solution] + strategy: + matrix: + framework: [net6.0, netcoreapp3.1, net472] + include: + - framework: net6.0 + options: '' + path: Release\net6.0 + extension: dll + - framework: netcoreapp3.1 + options: -r win-x64 + path: Release\netcoreapp3.1\win-x64 + extension: exe + - framework: net472 + options: /p:Platform=x64 + path: x64\Release\net472 + extension: exe runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v3 - - name: Build ComputeSharp.Sample (.NET 6) - run: dotnet build samples\ComputeSharp.Sample\ComputeSharp.Sample.csproj -c Release -f net6.0 + - name: Build ComputeSharp.Sample + run: dotnet build samples\ComputeSharp.Sample\ComputeSharp.Sample.csproj -c Release -f ${{matrix.framework}} ${{matrix.options}} shell: cmd - - 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 (.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 + - name: Run ComputeSharp.Sample + run: dotnet samples\ComputeSharp.Sample\bin\${{matrix.path}}\ComputeSharp.Sample.${{matrix.extension}} shell: cmd - name: Build ComputeSharp.Sample.FSharp - run: dotnet build samples\ComputeSharp.Sample.FSharp\ComputeSharp.Sample.FSharp.fsproj -c Release + run: dotnet build samples\ComputeSharp.Sample.FSharp\ComputeSharp.Sample.FSharp.fsproj -c Release ${{matrix.framework}} ${{matrix.options}} shell: cmd - name: Run ComputeSharp.Sample.FSharp - run: dotnet samples\ComputeSharp.Sample.FSharp\bin\Release\net6.0\ComputeSharp.Sample.FSharp.dll + run: dotnet samples\ComputeSharp.Sample.FSharp\bin\${{matrix.path}}\ComputeSharp.Sample.FSharp.${{matrix.extension}} shell: cmd - - name: Build ComputeSharp.ImageProcessing.csproj (.NET 6) - run: dotnet build samples\ComputeSharp.ImageProcessing\ComputeSharp.ImageProcessing.csproj -c Release -f net6.0 + - name: Build ComputeSharp.ImageProcessing.csproj + run: dotnet build samples\ComputeSharp.ImageProcessing\ComputeSharp.ImageProcessing.csproj -c Release -f ${{matrix.framework}} ${{matrix.options}} shell: cmd - - 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.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 + - name: Run ComputeSharp.ImageProcessing.csproj + run: dotnet samples\ComputeSharp.ImageProcessing\bin\${{matrix.path}}\ComputeSharp.ImageProcessing.${{matrix.extension}} shell: cmd # Download the NuGet packages generated in the previous job and use them @@ -243,7 +235,7 @@ jobs: # Publish the packages to GitHub packages publish-nightlies-github: - needs: [run-tests, run-dx12-samples, verify-packages, verify-package-native-libs] + needs: [run-tests, run-samples, verify-packages, verify-package-native-libs] runs-on: windows-2022 if: ${{github.event_name == 'push'}} steps: @@ -256,7 +248,7 @@ jobs: # Publish the packages to Azure DevOps publish-nightlies-azure-devops: - needs: [run-tests, run-dx12-samples, verify-packages, verify-package-native-libs] + needs: [run-tests, run-samples, verify-packages, verify-package-native-libs] runs-on: windows-2022 if: ${{github.event_name == 'push'}} steps: diff --git a/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj b/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj index 72c55e82..f5fd8b2a 100644 --- a/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj +++ b/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj @@ -1,7 +1,7 @@ - + - net6.0 + net472;netcoreapp3.1;net6.0 $(NoWarn);CA1416 diff --git a/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj b/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj index ba46b683..6c92ca2b 100644 --- a/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj +++ b/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj @@ -2,7 +2,8 @@ Exe - net6.0 + net472;netcoreapp3.1;net6.0 + AnyCPU;x64;ARM64 5.0