Add HtmlRenderer.WinUI adapter for WinUI 3 / Win2D #235
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build, Package & Publish | |
| on: [push, pull_request, workflow_dispatch] | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
| DOTNET_NOLOGO: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
| NuGetDirectory: ${{ github.workspace }}/nuget | |
| defaults: | |
| run: | |
| shell: pwsh | |
| jobs: | |
| build: | |
| name: ${{ matrix.platform.name }} ${{ matrix.dotnet.name }} | |
| runs-on: ${{ matrix.platform.os }} | |
| permissions: | |
| id-token: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - { name: Windows x64, os: windows-2025-vs2026 } | |
| - { name: Ubuntu x64, os: ubuntu-24.04 } | |
| - { name: macOS arm64, os: macos-15 } | |
| dotnet: | |
| - { name: .NET 8, version: '8.0.x' } | |
| - { name: .NET 9, version: '9.0.x' } | |
| - { name: .NET 10, version: '10.0.x' } | |
| steps: | |
| - name: Checkout HTML Renderer | |
| uses: actions/checkout@v7 | |
| - name: Setup .NET ${{ matrix.dotnet.version }} SDK | |
| id: setup-dotnet | |
| uses: actions/setup-dotnet@v6 | |
| with: | |
| dotnet-version: ${{ matrix.dotnet.version }} | |
| - name: Enforce SDK Version | |
| run: dotnet new globaljson --sdk-version ${{ steps.setup-dotnet.outputs.dotnet-version }} --force | |
| - name: Verify SDK Installation | |
| run: dotnet --info | |
| - name: Select build target | |
| id: build-target | |
| run: | | |
| # HtmlRenderer.WinUI/HtmlRenderer.Demo.WinUI (Windows App SDK/Win2D, MSIX PRI generation via | |
| # native makepri.exe/makeappx.exe) can only build on Windows - unlike the WinForms/WPF adapters, | |
| # which cross-compile cleanly everywhere via EnableWindowsTargeting's reference-assembly story, | |
| # there is no non-Windows equivalent for those native tools at all. Non-Windows runners build a | |
| # solution filter excluding just those two projects; everything else still builds and tests | |
| # identically on every OS. | |
| $target = $IsWindows ? "Source/HtmlRenderer.sln" : "Source/HtmlRenderer.CrossPlatform.slnf" | |
| echo "path=$target" >> $env:GITHUB_OUTPUT | |
| - name: Restore Dependencies | |
| run: dotnet restore ${{ steps.build-target.outputs.path }} | |
| - name: Build | |
| run: dotnet build ${{ steps.build-target.outputs.path }} --configuration Release --no-restore | |
| - name: Run Tests | |
| if: runner.os == 'Windows' | |
| run: dotnet test Source/HtmlRenderer.sln --configuration Release --no-build --logger trx --results-directory ${{ github.workspace }}/TestResults | |
| env: | |
| PDF_OUTPUT_DIRECTORY: ${{ github.workspace }}/pdf-artifacts/${{ matrix.platform.name }}-${{ matrix.dotnet.name }} | |
| HTML_RENDERER_REGRESSION_OUTPUT_DIRECTORY: ${{ github.workspace }}/image-regression/${{ matrix.platform.name }}-${{ matrix.dotnet.name }} | |
| - name: Run Tests | |
| if: runner.os != 'Windows' | |
| run: | | |
| $failed = $false | |
| Get-ChildItem -Path Source/Test -Recurse -Filter *.Test.csproj | ForEach-Object { | |
| dotnet test $_.FullName --configuration Release --no-build --logger trx --results-directory ${{ github.workspace }}/TestResults | |
| if ($LASTEXITCODE -ne 0) { $failed = $true } | |
| } | |
| if ($failed) { exit 1 } | |
| env: | |
| PDF_OUTPUT_DIRECTORY: ${{ github.workspace }}/pdf-artifacts/${{ matrix.platform.name }}-${{ matrix.dotnet.name }} | |
| - name: Create HtmlRenderer.Core NuGet package | |
| run: dotnet pack Source/HtmlRenderer/HtmlRenderer.csproj --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg --no-build --verbosity normal --output ${{ env.NuGetDirectory }} | |
| - name: Create HtmlRenderer.PdfSharp NuGet package | |
| run: dotnet pack Source/HtmlRenderer.PdfSharp/HtmlRenderer.PdfSharp.csproj --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg --no-build --verbosity normal --output ${{ env.NuGetDirectory }} | |
| - name: Create HtmlRenderer.WinForms NuGet package | |
| run: dotnet pack Source/HtmlRenderer.WinForms/HtmlRenderer.WinForms.csproj --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg --no-build --verbosity normal --output ${{ env.NuGetDirectory }} | |
| - name: Create HtmlRenderer.WPF NuGet package | |
| run: dotnet pack Source/HtmlRenderer.WPF/HtmlRenderer.WPF.csproj --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg --no-build --verbosity normal --output ${{ env.NuGetDirectory }} | |
| - name: Upload NuGet package artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: "HTML Renderer (${{ matrix.platform.name }} ${{ matrix.dotnet.name }})" | |
| path: ${{ env.NuGetDirectory }}/*.*nupkg | |
| - name: Upload PDF artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: "PDF artifacts (${{ matrix.platform.name }} ${{ matrix.dotnet.name }})" | |
| path: ${{ github.workspace }}/pdf-artifacts/**/*.pdf | |
| if-no-files-found: ignore | |
| - name: Upload image regression artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: "Image regression artifacts (${{ matrix.platform.name }} ${{ matrix.dotnet.name }})" | |
| path: ${{ github.workspace }}/image-regression/**/*.png | |
| if-no-files-found: ignore | |
| - name: NuGet Login | |
| if: startsWith(github.ref, 'refs/tags/') && matrix.dotnet.name == '.NET 8' && runner.os == 'Windows' | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: eXpl0it3r | |
| - name: NuGet Push | |
| if: startsWith(github.ref, 'refs/tags/') && matrix.dotnet.name == '.NET 8' && runner.os == 'Windows' | |
| run: | | |
| foreach ($file in (Get-ChildItem ${{ env.NuGetDirectory }} -Recurse -Include *.*nupkg)) { | |
| dotnet nuget push $file --skip-duplicate --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json | |
| } |