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,97 @@ 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+ - name : Format Date/Time of Commit for Package Version
238+ run : |
239+ echo "VERSION_DATE=$(git log -1 --format=%cd --date=format:%y%m%d)" >> $env:GITHUB_ENV
240+
241+ - name : Restore dotnet tools
242+ run : dotnet tool restore
243+
244+ - name : Run Uno Check to Install Dependencies
245+ run : >
246+ dotnet tool run uno-check
247+ --ci
248+ --fix
249+ --non-interactive
250+ --skip wsl
251+ --skip androidemulator
252+ --skip vswinworkloads
253+ --verbose
254+
255+ - name : Add msbuild to PATH
256+ uses : microsoft/setup-msbuild@v2
257+ with :
258+ vs-version : ' [17.9,)'
259+
260+ # Build and pack component nupkg
261+ - name : Build and pack component packages
262+ 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
263+
264+ - name : Validate package names
265+ if : ${{ env.VERSION_PROPERTY != '' }}
266+ 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
267+
268+ # Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config)
269+ - name : Push Pull Request Packages (if not fork)
270+ if : ${{ env.IS_PR == 'true' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
271+ run : |
272+ dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json `
273+ --name PullRequests `
274+ --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
275+ dotnet nuget push "*.nupkg" --api-key dummy --source PullRequests --skip-duplicate
276+
277+ - name : Push packages (main)
278+ if : ${{ github.ref == 'refs/heads/main' }}
279+ run : |
280+ dotnet nuget update source LabsFeed `
281+ --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
282+ dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate
283+
284+ # 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.
285+ - name : Upload Packages as Artifacts
286+ uses : actions/upload-artifact@v4
287+ if : ${{ env.IS_PR == 'false' || github.event.pull_request.head.repo.full_name != github.repository }}
288+ with :
289+ name : nuget-packages-winui${{ matrix.winui }}
290+ if-no-files-found : error
291+ path : |
292+ ./*.nupkg
293+
294+ - name : Artifact - Diagnostic Logs
295+ uses : actions/upload-artifact@v4
296+ if : ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
297+ with :
298+ name : build-logs-winui${{ matrix.winui }}
299+ path : ./*.*log
300+
235301 wasm-linux :
236302 runs-on : ubuntu-latest
237303 env :
0 commit comments