diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 09176dd1..d63a057a 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -3,6 +3,9 @@ name: .NET on: [push, pull_request] 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 steps: @@ -16,8 +19,10 @@ jobs: run: mkdir src\ComputeSharp.Package\bin\Release shell: cmd - name: Build - run: dotnet build src\ComputeSharp\ComputeSharp.csproj + run: dotnet build src\ComputeSharp\ComputeSharp.csproj -c Release shell: cmd + + # Run all the unit tests referencing the ComputeSharp project directly. run-tests: if: success() needs: [build-project] @@ -32,9 +37,6 @@ jobs: - name: Create local NuGet feed run: mkdir src\ComputeSharp.Package\bin\Release shell: cmd - - name: Build project - run: dotnet build src\ComputeSharp\ComputeSharp.csproj -c Release - shell: cmd - name: Run ComputeSharp.Tests run: dotnet test tests\ComputeSharp.Tests\ComputeSharp.Tests.csproj shell: cmd @@ -44,6 +46,8 @@ jobs: - name: Run ComputeSharp.Tests.Internals.SourceGenerators run: dotnet test tests\ComputeSharp.Tests.Internals.SourceGenerators\ComputeSharp.Tests.Internals.SourceGenerators.csproj shell: cmd + + # Run all the local samples to ensure they build and run with no errors. run-samples: if: success() needs: [run-tests] @@ -73,6 +77,9 @@ jobs: - name: Run ComputeSharp.ImageProcessing.csproj run: dotnet samples\ComputeSharp.ImageProcessing\bin\Release\net5.0\ComputeSharp.ImageProcessing.dll shell: cmd + + # 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 steps: @@ -93,11 +100,44 @@ jobs: with: name: ComputeSharp.nupkg path: src\ComputeSharp.Package\bin\Release\*.nupkg - verify-libs: + + # 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-latest steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Setup .NET SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.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 + run: dotnet build samples\ComputeSharp.Sample.NuGet\ComputeSharp.Sample.NuGet.csproj -c Release + shell: cmd + - name: Run ComputeSharp.Sample.NuGet + run: dotnet samples\ComputeSharp.Sample.NuGet\bin\Release\net5.0\ComputeSharp.Sample.NuGet.dll + 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-libs: + if: success() + needs: [verify-package] + runs-on: windows-latest + steps: - name: Git checkout uses: actions/checkout@v2 - name: Setup .NET SDK