Skip to content

Commit 084e2db

Browse files
Merge pull request #335 from CommunityToolkit/llama/workflow-improvements
De-duplicate our WinUI2/3 workflow definitions with a matrix
2 parents b35b8fb + 5976599 commit 084e2db

File tree

2 files changed

+22
-86
lines changed

2 files changed

+22
-86
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
]
1010
},
1111
"xamlstyler.console": {
12-
"version": "3.2008.4",
12+
"version": "3.2206.4",
1313
"commands": [
1414
"xstyler"
1515
]

.github/workflows/build.yml

Lines changed: 21 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ jobs:
2424

2525
# Steps represent a sequence of tasks that will be executed as part of the job
2626
steps:
27-
# Needed until XAML Styler updates to .NET 6
28-
- name: Install .NET Core 3.1 SDK
27+
- name: Install .NET 6 SDK
2928
uses: actions/setup-dotnet@v1
3029
with:
31-
dotnet-version: '3.1.x'
30+
dotnet-version: '6.0.x'
3231

3332
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
3433
- name: Checkout Repository
@@ -41,84 +40,16 @@ jobs:
4140
- name: Check XAML Styling
4241
run: powershell -version 5.1 -command "./ApplyXamlStyling.ps1 -Passive" -ErrorAction Stop
4342

44-
# This workflow contains a single job called "Build-WinUI-2"
45-
Build-WinUI-2:
43+
# Build both Uno.UI/WinUI2/UWP and Uno.WinUI/WinUI3/WindowsAppSDK versions of our packages using a matrix
44+
build:
4645
needs: [Xaml-Style-Check]
4746
runs-on: windows-latest
4847

49-
# Steps represent a sequence of tasks that will be executed as part of the job
50-
steps:
51-
- name: Install .NET 6 SDK
52-
uses: actions/setup-dotnet@v1
53-
with:
54-
dotnet-version: '6.0.202'
55-
56-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
57-
- name: Checkout Repository
58-
uses: actions/checkout@v2
59-
60-
# Restore Tools from Manifest list in the Repository
61-
- name: Restore dotnet tools
62-
run: dotnet tool restore
63-
64-
- name: Run Uno Check to Install Dependencies
65-
run: dotnet tool run uno-check --ci --fix --non-interactive --skip wsl --skip androidemulator --verbose
66-
67-
- name: Add msbuild to PATH
68-
uses: microsoft/[email protected]
69-
70-
- name: Enable all TargetFrameworks
71-
working-directory: ./common/Scripts/
72-
run: powershell -version 5.1 -command "./UseTargetFrameworks.ps1 all" -ErrorAction Stop
73-
74-
- name: Generate solution
75-
run: powershell -version 5.1 -command "./GenerateAllSolution.ps1" -ErrorAction Stop
76-
77-
- name: MSBuild
78-
# working-directory: ./
79-
run: msbuild.exe Toolkit.Labs.All.sln /restore -p:Configuration=Release
80-
81-
# Build All Packages
82-
- name: pack experiments
83-
working-directory: ./common/Scripts/
84-
run: ./PackEachExperiment.ps1 all
85-
86-
# Push Packages to our DevOps Artifacts Feed
87-
- name: Add source
88-
if: ${{github.ref == 'refs/heads/main'}}
89-
run: dotnet nuget add source "https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" --name LabsFeed --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
90-
91-
- name: Push packages
92-
if: ${{github.ref == 'refs/heads/main'}}
93-
run: dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate
94-
95-
# Run tests
96-
- name: Setup VSTest Path
97-
uses: darenm/Setup-VSTest@v1
98-
99-
- name: Install Testspace Module
100-
uses: testspace-com/setup-testspace@v1
101-
with:
102-
domain: ${{ github.repository_owner }}
103-
104-
- name: Run SourceGenerators tests
105-
run: vstest.console.exe ./common/CommunityToolkit.Labs.Core.SourceGenerators.Tests/CommunityToolkit.Labs.Core.SourceGenerators.Tests/bin/Release/net6.0/CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx"
106-
107-
- name: Run experiment tests against UWP
108-
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=UWP.trx"
109-
110-
- name: Run experiment tests against WinAppSDK
111-
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=WinAppSdk.trx"
112-
113-
- name: Create test reports
114-
run: |
115-
testspace '[WinUI2]./TestResults/*.trx'
116-
if: always()
117-
118-
# This workflow contains a single job called "Build-WinUI-3"
119-
Build-WinUI-3:
120-
needs: [Xaml-Style-Check]
121-
runs-on: windows-latest
48+
# See https://docs.github.com/actions/using-jobs/using-a-matrix-for-your-jobs
49+
strategy:
50+
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them both to run to completion.
51+
matrix:
52+
platform: [WinUI2, WinUI3]
12253

12354
# Steps represent a sequence of tasks that will be executed as part of the job
12455
steps:
@@ -148,12 +79,12 @@ jobs:
14879
- name: Generate solution
14980
run: powershell -version 5.1 -command "./GenerateAllSolution.ps1" -ErrorAction Stop
15081

151-
- name: Enable WinUI 3
82+
- name: Enable Uno.WinUI (in WinUI3 matrix only)
15283
working-directory: ./common/Scripts/
15384
run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
85+
if: ${{ matrix.platform == 'WinUI3' }}
15486

15587
- name: MSBuild
156-
# working-directory: ./
15788
run: msbuild.exe Toolkit.Labs.All.sln /restore /nowarn:MSB4011 -p:Configuration=Release
15889

15990
# Build All Packages
@@ -180,21 +111,24 @@ jobs:
180111
domain: ${{ github.repository_owner }}
181112

182113
- name: Run SourceGenerators tests
114+
id: test-generator
183115
run: vstest.console.exe ./common/CommunityToolkit.Labs.Core.SourceGenerators.Tests/CommunityToolkit.Labs.Core.SourceGenerators.Tests/bin/Release/net6.0/CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx"
184116

185117
- name: Run experiment tests against UWP
118+
id: test-uwp
186119
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=UWP.trx"
187120

188121
- name: Run experiment tests against WinAppSDK
122+
id: test-winappsdk
189123
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=WinAppSdk.trx"
190124

191125
- name: Create test reports
192126
run: |
193-
testspace '[WinUI3]./TestResults/*.trx'
194-
if: always()
127+
testspace '[${{ matrix.platform }}]./TestResults/*.trx'
128+
if: ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}
195129

196-
# Test/temp job to build a single experiment to ensure our changes work for both our main types of solutions at the moment
197-
experiment:
130+
# Test job to build a single experiment to ensure our changes work for both our main types of solutions at the moment
131+
new-experiment:
198132
needs: [Xaml-Style-Check]
199133
runs-on: windows-latest
200134

@@ -239,15 +173,17 @@ jobs:
239173
domain: ${{ github.repository_owner }}
240174

241175
- name: Run tests in the generated experiment against UWP
176+
id: test-uwp
242177
run: vstest.console.exe ./labs/CiTestExp/**/CiTestExp.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=CiTestExpUWP.trx"
243178

244179
- name: Run tests in the generated experiment against WinAppSDK
180+
id: test-winappsdk
245181
run: vstest.console.exe ./labs/CiTestExp/**/CiTestExp.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=CiTestExpWinAppSdk.trx"
246182

247183
- name: Create test reports
248184
run: |
249185
testspace '[New Experiment]./TestResults/*.trx'
250-
if: always()
186+
if: ${{ always() && (steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}
251187

252188
wasm-linux:
253189
needs: [Xaml-Style-Check]

0 commit comments

Comments
 (0)