name: .NET on: [push, pull_request] env: EXCLUDE_RUN_ID_FROM_PACKAGE: false EXCLUDE_SUFFIX_FROM_VERSION: false 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 /bl shell: cmd - name: Upload MSBuild binary log uses: actions/upload-artifact@v2 with: name: msbuild_log path: msbuild.binlog if-no-files-found: error # 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 .msbuildproj projects and the UWP/WinUI projects to generate all the NuGet packages. # This workflow also uploads the resulting packages as artifacts. build-packages: 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 6 SDK uses: actions/setup-dotnet@v1 with: dotnet-version: 6.0.x - name: Build ComputeSharp.Core package run: dotnet build src\ComputeSharp.Core.Package\ComputeSharp.Core.Package.msbuildproj -c Release shell: cmd - name: Build ComputeSharp package run: dotnet build src\ComputeSharp.Package\ComputeSharp.Package.msbuildproj -c Release shell: cmd - name: Build ComputeSharp.Dynamic package run: dotnet build src\ComputeSharp.Dynamic.Package\ComputeSharp.Dynamic.Package.msbuildproj -c Release shell: cmd - name: Build ComputeSharp.D2D1 package run: dotnet build src\ComputeSharp.D2D1.Package\ComputeSharp.D2D1.Package.msbuildproj -c Release shell: cmd - name: Build ComputeSharp.Uwp package run: msbuild src\ComputeSharp.Uwp\ComputeSharp.Uwp.csproj -t:restore,build,pack /p:Configuration=Release shell: cmd - name: Restore ComputeSharp.WinUI project run: msbuild src\ComputeSharp.WinUI\ComputeSharp.WinUI.csproj -t:restore /p:Configuration=Release shell: cmd - name: Build ComputeSharp.WinUI package run: msbuild src\ComputeSharp.WinUI\ComputeSharp.WinUI.csproj -t:pack /p:Configuration=Release shell: cmd # Packing needs to be done separately and with no previous build target for it to work correctly - name: Upload package artifacts uses: actions/upload-artifact@v2 with: name: nuget_preview path: artifacts\*.nupkg if-no-files-found: error # Run all the DX12 unit tests referencing the ComputeSharp project directly run-dx12-tests: if: success() needs: [build-solution-debug, build-solution-release] 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.DisableDynamicCompilation (.NET 6) run: dotnet test tests\ComputeSharp.Tests.DisableDynamicCompilation\ComputeSharp.Tests.DisableDynamicCompilation.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.DisableDynamicCompilation (.NET Core 3.1) run: dotnet test tests\ComputeSharp.Tests.DisableDynamicCompilation\ComputeSharp.Tests.DisableDynamicCompilation.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.DisableDynamicCompilation (.NET Framework 4.7.2) run: dotnet test tests\ComputeSharp.Tests.DisableDynamicCompilation\ComputeSharp.Tests.DisableDynamicCompilation.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 D2D1 unit tests (referencing ComputeSharp.D2D1) run-d2d1-tests: if: success() needs: [build-solution-debug, build-solution-release] 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.D2D1.Tests run: dotnet test tests\ComputeSharp.D2D1.Tests\ComputeSharp.D2D1.Tests.csproj -c Release -v n -l "console;verbosity=detailed" shell: cmd # Run all the local samples to ensure they build and run with no errors run-dx12-samples: if: success() needs: [build-solution-debug, build-solution-release] 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 # Download the NuGet packages generated in the previous job and use them # to build and run the sample project referencing them. This is used as # a test to ensure the NuGet packages work in a consuming project. verify-packages: if: success() needs: [build-packages] 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 artifacts shell: cmd - name: Download package artifacts uses: actions/download-artifact@v2 with: name: nuget_preview path: artifacts - 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: [build-packages] 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 # Publish the packages to GitHub packages publish-nightlies-github: needs: [ run-dx12-tests, run-d2d1-tests, run-dx12-samples, verify-packages, verify-package-native-libs ] runs-on: windows-2022 if: ${{github.event_name == 'push'}} steps: - uses: actions/download-artifact@v2 with: name: nuget_preview path: artifacts - uses: actions/setup-dotnet@v1 with: dotnet-version: 6.0.x - run: dotnet nuget push "artifacts\*.nupkg" --source "https://nuget.pkg.github.com/ComputeSharp/index.json" --api-key ${{secrets.GITHUB_TOKEN}} --skip-duplicate shell: cmd # Publish the packages to Azure DevOps publish-nightlies-azure-devops: needs: [ run-dx12-tests, run-d2d1-tests, run-dx12-samples, verify-packages, verify-package-native-libs ] runs-on: windows-2022 if: ${{github.event_name == 'push'}} steps: - uses: actions/download-artifact@v2 with: name: nuget_preview path: artifacts - uses: actions/setup-dotnet@v1 with: dotnet-version: 6.0.x source-url: "https://sergio0694.pkgs.visualstudio.com/ComputeSharp/_packaging/ComputeSharp/nuget/v3/index.json" env: NUGET_AUTH_TOKEN: ${{ secrets.ADO_FEED_PERSONAL_ACCESS_TOKEN }} - run: dotnet nuget push "artifacts\*.nupkg" --api-key AzureDevOps --skip-duplicate shell: cmd