7272
7373 env :
7474 MULTI_TARGET_DIRECTORY : tooling/MultiTarget
75- # faux-ternary expression to select which platforms to build for each platform vs. duplicating step below.
76- TARGET_PLATFORMS : ${{ matrix.platform != 'WinUI3' && 'all-wasdk' || 'all-uwp' }}
77- TEST_PLATFORM : ${{ matrix.platform != 'WinUI3' && 'UWP' || 'WinAppSdk' }}
7875 VERSION_PROPERTY : ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}
7976
8077 # Steps represent a sequence of tasks that will be executed as part of the job
@@ -132,19 +129,25 @@ jobs:
132129 uses : microsoft/setup-msbuild@v2
133130 with :
134131 vs-version : ' [17.9,)'
135-
132+
133+ # Get changed components
136134 - name : Get changed components
137135 run : |
138- echo "CHANGED_COMPONENTS_LIST=$(./tooling/Get-Changed-Components.ps1)" >> $env:GITHUB_ENV
136+ $changedComponents = $(./tooling/Get-Changed-Components.ps1)
137+ $buildableChangedComponents = $(./tooling/MultiTarget/Filter-Supported-Components.ps1 -Components $changedComponents -MultiTargets ${{ matrix.multitarget }} -WinUIMajorVersion ${{ matrix.winui }})
138+ $hasBuildableComponents = $buildableChangedComponents.Count -gt 0
139+ echo "CHANGED_COMPONENTS_LIST=$buildableChangedComponents" >> $env:GITHUB_ENV
140+ echo "HAS_BUILDABLE_COMPONENTS=$hasBuildableComponents" >> $env:GITHUB_ENV
139141
140142 # Generate full solution with all projects (sample gallery heads, components, tests)
141143 - name : Generate solution with ${{ matrix.multitarget }} gallery, components and tests
142144 working-directory : ./
145+ if : ${{ env.HAS_BUILDABLE_COMPONENTS == 'true' }}
143146 run : powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -MultiTargets ${{ matrix.multitarget }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -Components ${{ env.CHANGED_COMPONENTS_LIST }} -WinUIMajorVersion ${{ matrix.winui }}" -ErrorAction Stop
144147
145148 # Build solution
146149 - name : MSBuild (With diagnostics)
147- if : ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
150+ if : ${{ env.ENABLE_DIAGNOSTICS == 'true' && env.HAS_BUILDABLE_COMPONENTS == 'true' }}
148151 run : >
149152 msbuild.exe /restore /nowarn:MSB4011
150153 /p:Configuration=Release
@@ -154,20 +157,21 @@ jobs:
154157 CommunityToolkit.AllComponents.sln
155158
156159 - name : MSBuild
157- if : ${{ env.ENABLE_DIAGNOSTICS == 'false' }}
160+ if : ${{ env.ENABLE_DIAGNOSTICS == 'false' && env.HAS_BUILDABLE_COMPONENTS == 'true' }}
158161 run : msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release
159162
160163 # Run tests
161164 - name : Setup VSTest Path
162165 uses : darenm/setup-vstest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44
163166
164167 - name : Install Testspace Module
168+ if : ${{ env.HAS_BUILDABLE_COMPONENTS == 'true' }}
165169 uses : testspace-com/setup-testspace@v1
166170 with :
167171 domain : ${{ github.repository_owner }}
168172
169173 - name : Run component tests against ${{ matrix.multitarget }}
170- if : ${{ matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk' }}
174+ if : ${{ ( matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk') && env.HAS_BUILDABLE_COMPONENTS == 'true ' }}
171175 id : test-platform
172176 run : vstest.console.exe ./tooling/**/CommunityToolkit.Tests.${{ matrix.multitarget }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ matrix.multitarget }}.trx" /Blame
173177
@@ -199,6 +203,7 @@ jobs:
199203 filters : |
200204 dump:
201205 - added: '${{ github.workspace }}/CrashDumps/*.dmp'
206+
202207 - name : Artifact - WER crash dumps
203208 uses : actions/upload-artifact@v4
204209 if : ${{ steps.filter.outputs.dump == 'true' && (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
@@ -266,27 +271,32 @@ jobs:
266271 # Get changed components
267272 - name : Get changed components
268273 run : |
269- echo "CHANGED_COMPONENTS_LIST=$(./tooling/Get-Changed-Components.ps1)" >> $env:GITHUB_ENV
274+ $changedComponents = $(./tooling/Get-Changed-Components.ps1)
275+ $buildableChangedComponents = $(./tooling/MultiTarget/Filter-Supported-Components.ps1 -Components $changedComponents -MultiTargets ${{ matrix.multitarget }} -WinUIMajorVersion ${{ matrix.winui }})
276+ $hasBuildableComponents = $buildableChangedComponents.Count -gt 0
277+ echo "CHANGED_COMPONENTS_LIST=$buildableChangedComponents" >> $env:GITHUB_ENV
278+ echo "HAS_BUILDABLE_COMPONENTS=$hasBuildableComponents" >> $env:GITHUB_ENV
270279
271280 # Build and pack component nupkg
272281 - name : Build and pack component packages
282+ if : ${{ env.HAS_BUILDABLE_COMPONENTS == 'true' }}
273283 run : ./tooling/Build-Toolkit-Components.ps1 -MultiTargets all -Components ${{ env.CHANGED_COMPONENTS_LIST }} -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
274284
275285 - name : Validate package names
276- if : ${{ env.VERSION_PROPERTY != '' }}
286+ if : ${{ env.VERSION_PROPERTY != '' && env.HAS_BUILDABLE_COMPONENTS == 'true' }}
277287 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
278288
279289 # Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config)
280290 - name : Push Pull Request Packages (if not fork)
281- if : ${{ env.IS_PR == 'true' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
291+ if : ${{ env.IS_PR == 'true' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' && env.HAS_BUILDABLE_COMPONENTS == 'true' }}
282292 run : |
283293 dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json `
284294 --name PullRequests `
285295 --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
286296 dotnet nuget push "*.nupkg" --api-key dummy --source PullRequests --skip-duplicate
287297
288298 - name : Push packages (main)
289- if : ${{ github.ref == 'refs/heads/main' }}
299+ if : ${{ github.ref == 'refs/heads/main' && env.HAS_BUILDABLE_COMPONENTS == 'true' }}
290300 run : |
291301 dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json `
292302 --name LabsFeed `
@@ -296,7 +306,7 @@ jobs:
296306 # 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.
297307 - name : Upload Packages as Artifacts
298308 uses : actions/upload-artifact@v4
299- if : ${{ env.IS_PR == 'false' || github.event.pull_request.head.repo.full_name != github.repository }}
309+ if : ${{ ( env.IS_PR == 'false' || github.event.pull_request.head.repo.full_name != github.repository) && env.HAS_BUILDABLE_COMPONENTS == 'true' }}
300310 with :
301311 name : nuget-packages-winui${{ matrix.winui }}
302312 if-no-files-found : error
0 commit comments