Repository navigation
141 lines (117 loc) · 6.03 KB
/
Copy pathbuild.yml
File metadata and controls
141 lines (117 loc) · 6.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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 10, version: '10.0.x' }
- { name: .NET 11, version: '11.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: |
# WinUI needs the Windows-only XAML and MSIX tooling, the other platforms build everything else
$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: Spec compliance report
if: ${{ !cancelled() && runner.os == 'Windows' && matrix.dotnet.name == '.NET 8' }}
run: dotnet run --project Source/Tools/HtmlRenderer.SpecCompliance --configuration Release --no-build -- report --output spec-compliance.md --summary $env:GITHUB_STEP_SUMMARY
- name: Upload spec compliance report
if: ${{ !cancelled() && runner.os == 'Windows' && matrix.dotnet.name == '.NET 8' }}
uses: actions/upload-artifact@v7
with:
name: Spec compliance report
path: spec-compliance.md
if-no-files-found: ignore
- 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: Create HtmlRenderer.WinUI NuGet package
if: runner.os == 'Windows'
run: dotnet pack Source/HtmlRenderer.WinUI/HtmlRenderer.WinUI.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
}