5858
5959 # See https://docs.github.com/actions/using-jobs/using-a-matrix-for-your-jobs
6060 strategy :
61- fail-fast : false # prevent one matrix pipeline from being cancelled if one fails, we want them both to run to completion.
61+ fail-fast : false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion.
6262 matrix :
63- platform : [WinUI2, WinUI3]
63+ winui : [2, 3]
64+ multitarget : ['uwp', 'wasdk', 'wasm', 'wpf', 'linuxgtk', 'macos', 'ios', 'android']
65+ exclude :
66+ # WinUI 2 not supported on wasdk
67+ - winui : 2
68+ multitarget : wasdk
69+ # WinUI 3 not supported on uwp
70+ - winui : 3
71+ multitarget : uwp
6472
6573 env :
6674 MULTI_TARGET_DIRECTORY : tooling/MultiTarget
@@ -107,10 +115,12 @@ jobs:
107115 run : dotnet tool restore
108116
109117 - name : Run Uno Check to Install Dependencies
118+ if : ${{ matrix.multitarget != 'wasdk' && matrix.multitarget != 'linuxgtk' && matrix.multitarget != 'wpf' }}
110119 run : >
111120 dotnet tool run uno-check
112121 --ci
113122 --fix
123+ --target ${{ matrix.multitarget }}
114124 --non-interactive
115125 --skip wsl
116126 --skip androidemulator
@@ -122,23 +132,12 @@ jobs:
122132 with :
123133 vs-version : ' [17.9,)'
124134
125- - name : Enable ${{ env.TARGET_PLATFORMS }} TargetFrameworks
126- working-directory : ./${{ env.MULTI_TARGET_DIRECTORY }}
127- run : powershell -version 5.1 -command "./UseTargetFrameworks.ps1 ${{ env.TARGET_PLATFORMS }}" -ErrorAction Stop
128-
129- - name : Generate solution w/ ${{ env.TEST_PLATFORM }} Tests
135+ # Generate full solution with all projects (sample gallery heads, components, tests)
136+ - name : Generate solution with ${{ matrix.multitarget }} gallery, components and tests
130137 working-directory : ./
131- run : powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -IncludeHeads ${{ env.TEST_PLATFORM }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}" -ErrorAction Stop
132-
133- - name : Enable Uno.WinUI (in WinUI3 matrix only)
134- if : ${{ matrix.platform == 'WinUI3' }}
135- working-directory : ./${{ env.MULTI_TARGET_DIRECTORY }}
136- run : powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
137-
138- - name : Format Date/Time of Commit for Package Version
139- run : |
140- echo "VERSION_DATE=$(git log -1 --format=%cd --date=format:%y%m%d)" >> $env:GITHUB_ENV
138+ run : powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -MultiTargets ${{ matrix.multitarget }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -WinUIMajorVersion ${{ matrix.winui }}" -ErrorAction Stop
141139
140+ # Build solution
142141 - name : MSBuild (With diagnostics)
143142 if : ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
144143 run : >
@@ -151,32 +150,7 @@ jobs:
151150
152151 - name : MSBuild
153152 if : ${{ env.ENABLE_DIAGNOSTICS == 'false' }}
154- run : msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release
155-
156- # Build All Packages
157- - name : Pack experiments
158- working-directory : ./tooling/Scripts/
159- run : ./PackEachExperiment.ps1 -date ${{ env.VERSION_DATE }}${{ env.VERSION_PROPERTY != '' && format(' -postfix {0}', env.VERSION_PROPERTY) || '' }}
160-
161- - name : Validate package names
162- if : ${{ env.VERSION_PROPERTY != '' }}
163- run : powershell -version 5.1 -command "Get-ChildItem -Path '**/*.nupkg' | ForEach-Object { if (`$_.Name -notmatch '${{ env.VERSION_PROPERTY }}') { throw 'Nupkg name is missing trailing VERSION_PROPERTY' + `$_.Name } }" -ErrorAction Stop
164-
165- # Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config)
166- - name : Push PR packages (if not fork)
167- if : ${{ env.IS_PR == 'true' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
168- run : |
169- dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json `
170- --name PullRequests `
171- --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
172- dotnet nuget push "**/*.nupkg" --api-key dummy --source PullRequests --skip-duplicate
173-
174- - name : Push packages (main)
175- if : ${{ github.ref == 'refs/heads/main' }}
176- run : |
177- dotnet nuget update source LabsFeed `
178- --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
179- dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate
153+ run : msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release
180154
181155 # Run tests
182156 - name : Setup VSTest Path
@@ -187,20 +161,21 @@ jobs:
187161 with :
188162 domain : ${{ github.repository_owner }}
189163
190- - name : Run experiment tests against ${{ env.TEST_PLATFORM }}
164+ - name : Run component tests against ${{ matrix.multitarget }}
165+ if : ${{ matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk' }}
191166 id : test-platform
192- run : vstest.console.exe ./tooling/**/CommunityToolkit.Tests.${{ env.TEST_PLATFORM }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PLATFORM }}.trx" /Blame
167+ run : vstest.console.exe ./tooling/**/CommunityToolkit.Tests.${{ matrix.multitarget }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ matrix.multitarget }}.trx" /Blame
193168
194169 - name : Create test reports
195170 run : |
196- testspace '[${{ matrix.platform }}]./TestResults/*.trx'
197- if : ${{ always( ) && (steps.test-generator.conclusion == 'success' || steps.test-platform.conclusion == 'success') }}
171+ testspace '[${{ matrix.multitarget }}]./TestResults/*.trx'
172+ if : ${{ (matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk' ) && (steps.test-generator.conclusion == 'success' || steps.test-platform.conclusion == 'success') }}
198173
199174 - name : Artifact - Diagnostic Logs
200175 uses : actions/upload-artifact@v4
201176 if : ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
202177 with :
203- name : build-logs-${{ matrix.platform }}
178+ name : build-logs-${{ matrix.multitarget }}-winui${{ matrix.winui }}
204179 path : ./**/*.*log
205180
206181 - name : Artifact - ILC Repro
@@ -232,6 +207,106 @@ jobs:
232207 dotnet tool install --global dotnet-dump
233208 dotnet-dump analyze ${{ steps.filter.outputs.dump_files }} -c "clrstack" -c "pe -lines" -c "exit"
234209
210+ package :
211+ runs-on : windows-latest
212+ needs : [build]
213+ strategy :
214+ fail-fast : false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion.
215+ matrix :
216+ winui : [2, 3]
217+
218+ env :
219+ VERSION_PROPERTY : ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}
220+
221+ steps :
222+ - name : Install .NET SDK v${{ env.DOTNET_VERSION }}
223+ uses : actions/setup-dotnet@v4
224+ with :
225+ dotnet-version : ${{ env.DOTNET_VERSION }}
226+
227+ - name : .NET Info (if diagnostics)
228+ if : ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
229+ run : dotnet --info
230+
231+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
232+ - name : Checkout Repository
233+ uses : actions/checkout@v4
234+ with :
235+ submodules : recursive
236+
237+ # Semver regex: https://regex101.com/r/Ly7O1x/3/
238+ - name : Format Date/Time of Release Package Version
239+ if : ${{ env.IS_RELEASE == 'true' }}
240+ run : |
241+ $ref = "${{ github.ref }}"
242+ $ref -match "^refs/heads/rel/(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"
243+ echo "VERSION_DATE=$($matches['patch'])" >> $env:GITHUB_ENV
244+ echo "VERSION_PROPERTY=$($matches['prerelease'])" >> $env:GITHUB_ENV
245+
246+ - name : Format Date/Time of Commit for Package Version
247+ if : ${{ env.IS_RELEASE == 'false' }}
248+ run : |
249+ echo "VERSION_DATE=$(git log -1 --format=%cd --date=format:%y%m%d)" >> $env:GITHUB_ENV
250+ - name : Restore dotnet tools
251+ run : dotnet tool restore
252+
253+ - name : Run Uno Check to Install Dependencies
254+ run : >
255+ dotnet tool run uno-check
256+ --ci
257+ --fix
258+ --non-interactive
259+ --skip wsl
260+ --skip androidemulator
261+ --skip vswinworkloads
262+ --verbose
263+
264+ - name : Add msbuild to PATH
265+ uses : microsoft/setup-msbuild@v2
266+ with :
267+ vs-version : ' [17.9,)'
268+
269+ # Build and pack component nupkg
270+ - name : Build and pack component packages
271+ run : ./tooling/Build-Toolkit-Components.ps1 -MultiTargets all -WinUIMajorVersion ${{ matrix.winui }} -DateForVersion ${{ env.VERSION_DATE }} ${{ env.VERSION_PROPERTY != '' && format('-PreviewVersion "{0}"', env.VERSION_PROPERTY) || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-EnableBinlogs' || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-Verbose' || '' }} -BinlogOutput ./ -NupkgOutput ./ -Release
272+
273+ - name : Validate package names
274+ if : ${{ env.VERSION_PROPERTY != '' }}
275+ run : powershell -version 5.1 -command "Get-ChildItem -Path '*.nupkg' | ForEach-Object { if (`$_.Name -notmatch '${{ env.VERSION_PROPERTY }}') { throw 'Nupkg name is missing trailing VERSION_PROPERTY' + `$_.Name } }" -ErrorAction Stop
276+
277+ # Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config)
278+ - name : Push Pull Request Packages (if not fork)
279+ if : ${{ env.IS_PR == 'true' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
280+ run : |
281+ dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json `
282+ --name PullRequests `
283+ --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
284+ dotnet nuget push "*.nupkg" --api-key dummy --source PullRequests --skip-duplicate
285+
286+ - name : Push packages (main)
287+ if : ${{ github.ref == 'refs/heads/main' }}
288+ run : |
289+ dotnet nuget update source LabsFeed `
290+ --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
291+ dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate
292+
293+ # if we're not doing a PR build (or it's a PR from a fork) then we upload our packages so we can sign as a separate job or have available to test.
294+ - name : Upload Packages as Artifacts
295+ uses : actions/upload-artifact@v4
296+ if : ${{ env.IS_PR == 'false' || github.event.pull_request.head.repo.full_name != github.repository }}
297+ with :
298+ name : nuget-packages-winui${{ matrix.winui }}
299+ if-no-files-found : error
300+ path : |
301+ ./*.nupkg
302+
303+ - name : Artifact - Diagnostic Logs
304+ uses : actions/upload-artifact@v4
305+ if : ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
306+ with :
307+ name : build-logs-winui${{ matrix.winui }}
308+ path : ./*.*log
309+
235310 wasm-linux :
236311 runs-on : ubuntu-latest
237312 env :
0 commit comments