Skip to content

Commit 311c497

Browse files
committed
Split packaging into separate build step for matrix build, use latest submodule fixes
1 parent 00d76f3 commit 311c497

File tree

2 files changed

+96
-56
lines changed

2 files changed

+96
-56
lines changed

.github/workflows/build.yml

Lines changed: 95 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,13 @@ jobs:
6666
winui: [2, 3]
6767
multitarget: ['uwp', 'wasdk', 'wasm', 'wpf', 'linuxgtk', 'macos', 'ios', 'android']
6868
exclude:
69+
# WinUI 2 not supported on wasdk
6970
- winui: 2
7071
multitarget: wasdk
72+
# WinUI 3 not supported on uwp
7173
- winui: 3
7274
multitarget: uwp
7375

74-
env:
75-
VERSION_PROPERTY: ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}
76-
7776
# Steps represent a sequence of tasks that will be executed as part of the job
7877
steps:
7978
- name: Configure Pagefile
@@ -129,57 +128,21 @@ jobs:
129128
with:
130129
vs-version: '[17.9,)'
131130

132-
- name: Enable ${{ matrix.multitarget }} TargetFrameworks
133-
working-directory: ./${{ env.MULTI_TARGET_DIRECTORY }}
134-
run: powershell -version 5.1 -command "./UseTargetFrameworks.ps1 -Include ${{ matrix.multitarget }}" -ErrorAction Stop
135-
136-
- name: Set WinUI Version
137-
working-directory: ./${{ env.MULTI_TARGET_DIRECTORY }}
138-
run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 ${{ matrix.winui }}" -ErrorAction Stop
139-
140-
- name: Generate solution with ${{ matrix.multitarget }} gallery and tests
131+
# Generate full solution with all projects (sample gallery heads, components, tests)
132+
- name: Generate solution with ${{ matrix.multitarget }} gallery, components and tests
141133
working-directory: ./
142-
run: powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -IncludeHeads ${{ matrix.multitarget }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}" -ErrorAction Stop
143-
144-
- name: Format Date/Time of Commit for Package Version
145-
if: ${{ env.IS_RELEASE == 'false' }}
146-
run: |
147-
echo "VERSION_DATE=$(git log -1 --format=%cd --date=format:%y%m%d)" >> $env:GITHUB_ENV
148-
149-
# Semver regex: https://regex101.com/r/Ly7O1x/3/
150-
- name: Format Date/Time of Release Package Version
151-
if: ${{ env.IS_RELEASE == 'true' }}
152-
run: |
153-
$ref = "${{ github.ref }}"
154-
$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-]+)*))?$"
155-
echo "VERSION_DATE=$($matches['patch'])" >> $env:GITHUB_ENV
156-
echo "VERSION_PROPERTY=$($matches['prerelease'])" >> $env:GITHUB_ENV
134+
run: powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -MultiTargets ${{ matrix.multitarget }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -WinUIMajorVersion ${{ matrix.winui }}" -ErrorAction Stop
157135

136+
# Build solution
158137
- name: MSBuild
159138
run: >
160139
msbuild.exe /restore /nowarn:MSB4011
161140
/p:Configuration=Release
162141
/m
163-
/p:DateForVersion=${{ env.VERSION_DATE }}
164-
/p:PreviewVersion=${{ env.VERSION_PROPERTY }}
165142
${{ env.ENABLE_DIAGNOSTICS == 'true' && '/bl' || '' }}
166143
/v:${{ env.MSBUILD_VERBOSITY }}
167144
CommunityToolkit.AllComponents.sln
168145
169-
# Build All Packages
170-
- name: pack experiments
171-
working-directory: ./tooling/Scripts/
172-
run: ./PackEachExperiment.ps1 -date ${{ env.VERSION_DATE }}${{ env.VERSION_PROPERTY != '' && format(' -postfix {0}', env.VERSION_PROPERTY) || '' }}
173-
174-
# Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config)
175-
- name: Push Pull Request Packages (if not fork)
176-
if: ${{ env.IS_PR == 'true' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
177-
run: |
178-
dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json `
179-
--name PullRequests `
180-
--username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
181-
dotnet nuget push "**/*.nupkg" --api-key dummy --source PullRequests --skip-duplicate
182-
183146
# Run tests
184147
- name: Setup VSTest Path
185148
uses: darenm/setup-vstest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44
@@ -193,21 +156,22 @@ jobs:
193156
id: test-generator
194157
run: vstest.console.exe ./tooling/CommunityToolkit.Tooling.SampleGen.Tests/bin/Release/net6.0/CommunityToolkit.Tooling.SampleGen.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx"
195158

196-
- name: Run experiment tests against ${{ matrix.multitarget }}
159+
- name: Run component tests against ${{ matrix.multitarget }}
197160
if: ${{ matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk' }}
198161
id: test-platform
199162
run: vstest.console.exe ./tooling/**/CommunityToolkit.Tests.${{ matrix.multitarget }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ matrix.multitarget }}.trx" /Blame
200163

201164
- name: Create test reports
165+
if: ${{ matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk' }}
202166
run: |
203-
testspace '[${{ matrix.platform }}]./TestResults/*.trx'
167+
testspace '[${{ matrix.multitarget }}]./TestResults/*.trx'
204168
if: ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-platform.conclusion == 'success') }}
205169

206170
- name: Artifact - Diagnostic Logs
207171
uses: actions/upload-artifact@v4
208172
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
209173
with:
210-
name: build-logs-${{ matrix.platform }}
174+
name: build-logs-${{ matrix.multitarget }}-winui${{ matrix.winui }}
211175
path: ./**/*.*log
212176

213177
- name: Artifact - ILC Repro
@@ -229,7 +193,7 @@ jobs:
229193
uses: actions/upload-artifact@v4
230194
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
231195
with:
232-
name: CrashDumps-${{ matrix.platform }}
196+
name: CrashDumps-${{ matrix.multitarget }}-winui${{ matrix.winui }}
233197
path: '${{ github.workspace }}/CrashDumps'
234198

235199
- name: Analyze Dump
@@ -238,11 +202,80 @@ jobs:
238202
dotnet tool install --global dotnet-dump
239203
dotnet-dump analyze ${{ steps.detect-dump.outputs.DUMP_FILE }} -c "clrstack" -c "pe -lines" -c "exit"
240204
205+
package:
206+
needs: [build]
207+
strategy:
208+
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion.
209+
matrix:
210+
winui: [2, 3]
211+
212+
env:
213+
VERSION_PROPERTY: ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}
214+
215+
steps:
216+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
217+
uses: actions/setup-dotnet@v4
218+
with:
219+
dotnet-version: ${{ env.DOTNET_VERSION }}
220+
221+
- name: .NET Info (if diagnostics)
222+
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
223+
run: dotnet --info
224+
225+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
226+
- name: Checkout Repository
227+
uses: actions/checkout@v4
228+
with:
229+
submodules: recursive
230+
231+
# Semver regex: https://regex101.com/r/Ly7O1x/3/
232+
- name: Format Date/Time of Release Package Version
233+
if: ${{ env.IS_RELEASE == 'true' }}
234+
run: |
235+
$ref = "${{ github.ref }}"
236+
$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-]+)*))?$"
237+
echo "VERSION_DATE=$($matches['patch'])" >> $env:GITHUB_ENV
238+
echo "VERSION_PROPERTY=$($matches['prerelease'])" >> $env:GITHUB_ENV
239+
240+
- name: Format Date/Time of Commit for Package Version
241+
if: ${{ env.IS_RELEASE == 'false' }}
242+
run: |
243+
echo "VERSION_DATE=$(git log -1 --format=%cd --date=format:%y%m%d)" >> $env:GITHUB_ENV
244+
245+
- name: Run Uno Check to Install Dependencies
246+
run: >
247+
dotnet tool run uno-check
248+
--ci
249+
--fix
250+
--non-interactive
251+
--skip wsl
252+
--skip androidemulator
253+
--skip vswinworkloads
254+
--verbose
255+
256+
- name: Add msbuild to PATH
257+
uses: microsoft/setup-msbuild@v2
258+
with:
259+
vs-version: '[17.9,)'
260+
261+
# Build and pack component nupkg
262+
- name: Build and pack component packages
263+
run: ./tooling/Build-Toolkit-Components.ps1 -MultiTargets all -WinUIMajorVersion ${{ matrix.winui }} -DateForVersion ${{ env.VERSION_DATE }} ${{ env.VERSION_PROPERTY != '' && format(' -PreviewVersion {0}', env.VERSION_PROPERTY) || '' }} -EnableBinlogs ${{ env.ENABLE_DIAGNOSTICS }} -Verbose ${{ env.ENABLE_DIAGNOSTICS }} -BinlogOutput ./ -NupkgOutput ./ -Release
264+
265+
# Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config)
266+
- name: Push Pull Request Packages (if not fork)
267+
if: ${{ env.IS_PR == 'true' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
268+
run: |
269+
dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json `
270+
--name PullRequests `
271+
--username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
272+
dotnet nuget push "./*.nupkg" --api-key dummy --source PullRequests --skip-duplicate
273+
241274
- name: Upload Package List
242275
uses: actions/upload-artifact@v4
243276
if: ${{ env.IS_PR == 'false' }}
244277
with:
245-
name: nuget-list-${{ matrix.platform }}
278+
name: nuget-list-${{ matrix.winui }}
246279
if-no-files-found: error
247280
path: |
248281
${{ github.workspace }}/.github/workflows/SignClientFileList.txt
@@ -252,13 +285,20 @@ jobs:
252285
uses: actions/upload-artifact@v4
253286
if: ${{ env.IS_PR == 'false' || github.event.pull_request.head.repo.full_name != github.repository }}
254287
with:
255-
name: nuget-packages-${{ matrix.platform }}
288+
name: nuget-packages-winui${{ matrix.winui }}
256289
if-no-files-found: error
257290
path: |
258-
**/*.nupkg
291+
./*.nupkg
292+
293+
- name: Artifact - Diagnostic Logs
294+
uses: actions/upload-artifact@v4
295+
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
296+
with:
297+
name: build-logs-winui${{ matrix.winui }}
298+
path: ./*.*log
259299

260300
sign:
261-
needs: [build]
301+
needs: [package]
262302
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/rel/') }}
263303
runs-on: windows-latest
264304
permissions:
@@ -267,7 +307,7 @@ jobs:
267307
strategy:
268308
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them both to run to completion.
269309
matrix:
270-
platform: [WinUI2, WinUI3]
310+
winui: [2, 3]
271311

272312
steps:
273313
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
@@ -278,13 +318,13 @@ jobs:
278318
- name: Download Package List
279319
uses: actions/download-artifact@v4
280320
with:
281-
name: nuget-list-${{ matrix.platform }}
321+
name: nuget-list-${{ matrix.winui }}
282322
path: ./
283323

284-
- name: Download built packages for ${{ matrix.platform }}
324+
- name: Download built packages for WinUI ${{ matrix.winui }}
285325
uses: actions/download-artifact@v4
286326
with:
287-
name: nuget-packages-${{ matrix.platform }}
327+
name: nuget-packages-winui${{ matrix.winui }}
288328
path: ./packages
289329

290330
- name: Install Signing Tool

0 commit comments

Comments
 (0)