name: .NET on: [push, pull_request] jobs: # Build the whole ComputeSharp solution, in Debug build-solution-debug: runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.3 - 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 run: msbuild -t:restore,build /p:Configuration=Debug /p:Platform=x64 shell: cmd # Build the whole ComputeSharp solution, in Release build-solution-release: runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.3 - 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 run: msbuild -t:restore,build /p:Configuration=Release /p:Platform=x64 shell: cmd # Build the whole ComputeSharp solution with /p:DisableShaderCompilationSupport=True build-solution-release-no-dynamic: runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.3 - 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 run: msbuild -t:restore,build /p:Configuration=Release /p:Platform=x64 /p:DisableShaderCompilationSupport=True shell: cmd # Run all the unit tests referencing the ComputeSharp project directly run-tests: if: success() needs: [build-solution-debug, build-solution-release, build-solution-release-no-dynamic] runs-on: windows-2022 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: Run ComputeSharp.Tests (.NET 6) run: dotnet test tests\ComputeSharp.Tests\ComputeSharp.Tests.csproj -c Release -f net6.0 -v n -l "console;verbosity=detailed" shell: cmd - name: Run ComputeSharp.Tests.Internals (.NET 6) run: dotnet test tests\ComputeSharp.Tests.Internals\ComputeSharp.Tests.Internals.csproj -c Release -f net6.0 -v n -l "console;verbosity=detailed" shell: cmd - name: Run ComputeSharp.Tests (.NET Core 3.1) run: dotnet test tests\ComputeSharp.Tests\ComputeSharp.Tests.csproj -c Release -f netcoreapp3.1 /p:Platform=x64 -v n -l "console;verbosity=detailed" shell: cmd - name: Run ComputeSharp.Tests.Internals (.NET Core 3.1) run: dotnet test tests\ComputeSharp.Tests.Internals\ComputeSharp.Tests.Internals.csproj -c Release -f netcoreapp3.1 /p:Platform=x64 -v n -l "console;verbosity=detailed" shell: cmd - name: Run ComputeSharp.Tests (.NET Framework 4.7.2) run: dotnet test tests\ComputeSharp.Tests\ComputeSharp.Tests.csproj -c Release -f net472 /p:Platform=x64 -v n -l "console;verbosity=detailed" shell: cmd - name: Run ComputeSharp.Tests.Internals (.NET Framework 4.7.2) run: dotnet test tests\ComputeSharp.Tests.Internals\ComputeSharp.Tests.Internals.csproj -c Release -f net472 /p:Platform=x64 -v n -l "console;verbosity=detailed" shell: cmd - name: Run ComputeSharp.Tests.SourceGenerators run: dotnet test tests\ComputeSharp.Tests.SourceGenerators\ComputeSharp.Tests.SourceGenerators.csproj -v n -l "console;verbosity=detailed" shell: cmd # Run all the local samples to ensure they build and run with no errors run-samples: if: success() needs: [run-tests] runs-on: windows-2022 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 (.NET 6) run: dotnet build samples\ComputeSharp.Sample\ComputeSharp.Sample.csproj -c Release -f net6.0 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 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 (.NET 6) run: dotnet build samples\ComputeSharp.ImageProcessing\ComputeSharp.ImageProcessing.csproj -c Release -f net6.0 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 shell: cmd - name: Build ComputeSharp.Benchmark.csproj run: dotnet build samples\ComputeSharp.Benchmark\ComputeSharp.Benchmark.csproj -c Release shell: cmd - name: Build ComputeSharp.SwapChain.csproj run: dotnet build samples\ComputeSharp.SwapChain\ComputeSharp.SwapChain.csproj -c Release shell: cmd # Buils the .msbuildproj project to generate the NuGet package. # This workflow also uploads the resulting package as an artifact. build-package: if: success() needs: [build-solution-debug, build-solution-release, build-solution-release-no-dynamic] runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 - name: Setup .NET 6 SDK uses: actions/setup-dotnet@v1 with: dotnet-version: 6.0.x - name: Build run: dotnet build src\ComputeSharp.Package\ComputeSharp.Package.msbuildproj -c Release /p:ContinuousIntegrationBuild=True shell: cmd - name: Upload package artifact uses: actions/upload-artifact@v2 with: name: ComputeSharp.nupkg path: src\ComputeSharp.Package\bin\Release\*.nupkg # Download the NuGet package generated in the previous job and use it # to build and run the sample project referencing it. This is used as # a test to ensure the NuGet package works in a consuming project. verify-package: if: success() needs: [build-package] runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 - name: Setup .NET 6 SDK uses: actions/setup-dotnet@v1 with: dotnet-version: 6.0.x - name: Create local NuGet feed run: mkdir src\ComputeSharp.Package\bin\Release shell: cmd - name: Download package artifact uses: actions/download-artifact@v2 with: name: ComputeSharp.nupkg path: src\ComputeSharp.Package\bin\Release\ComputeSharp.nupkg - 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 (.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 - 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 # regardless of whether the app is shipping with R2R, self-contained, etc. verify-package-native-libs: if: success() needs: [verify-package] runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 - name: Setup .NET 6 SDK uses: actions/setup-dotnet@v1 with: dotnet-version: 6.0.x - name: Run ComputeSharp.Tests.NativeLibrariesResolver run: dotnet test tests\ComputeSharp.Tests.NativeLibrariesResolver\ComputeSharp.Tests.NativeLibrariesResolver.csproj -v n -l "console;verbosity=detailed" shell: cmd # Build the WinUI project again to generate a NuGet package from it. # This workflow also uploads the resulting package as an artifact. build-package-winui: if: success() needs: [verify-package] runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.3 - name: Setup .NET SDK uses: actions/setup-dotnet@v1 with: dotnet-version: 6.0.x - name: Build run: msbuild src\ComputeSharp.WinUI\ComputeSharp.WinUI.csproj -t:restore /p:Configuration=Release /p:ContinuousIntegrationBuild=True shell: cmd - name: Build run: msbuild src\ComputeSharp.WinUI\ComputeSharp.WinUI.csproj -t:pack /p:Configuration=Release /p:ContinuousIntegrationBuild=True shell: cmd # Packing needs to be done separately and with no previous build target for it to work correctly - name: Upload package artifact uses: actions/upload-artifact@v2 with: name: ComputeSharp.WinUI.nupkg path: src\ComputeSharp.WinUI\bin\Release\*.nupkg # Build the UWP project again to generate a NuGet package from it. # This workflow also uploads the resulting package as an artifact, like the WinUI one. build-package-uwp: if: success() needs: [verify-package] runs-on: windows-2022 steps: - name: Git checkout uses: actions/checkout@v2 - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.3 - name: Setup .NET SDK uses: actions/setup-dotnet@v1 with: dotnet-version: 6.0.x - name: Build run: msbuild src\ComputeSharp.Uwp\ComputeSharp.Uwp.csproj -t:restore,build,pack /p:Configuration=Release /p:ContinuousIntegrationBuild=True shell: cmd - name: Upload package artifact uses: actions/upload-artifact@v2 with: name: ComputeSharp.Uwp.nupkg path: src\ComputeSharp.Uwp\bin\Release\*.nupkg