1515 # Allows you to run this workflow manually from the Actions tab
1616 workflow_dispatch :
1717
18+ env :
19+ DOTNET_VERSION : ${{ '6.0.x' }}
20+ ENABLE_DIAGNOSTICS : false
21+ # COREHOST_TRACE: 1
22+ COREHOST_TRACEFILE : corehosttrace.log
1823
1924# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2025jobs :
@@ -24,14 +29,14 @@ jobs:
2429
2530 # Steps represent a sequence of tasks that will be executed as part of the job
2631 steps :
27- - name : Install .NET 6 SDK
28- uses : actions/setup-dotnet@v1
32+ - name : Install .NET SDK v${{ env.DOTNET_VERSION }}
33+ uses : actions/setup-dotnet@v3
2934 with :
30- dotnet-version : ' 6.0.x '
35+ dotnet-version : ${{ env.DOTNET_VERSION }}
3136
3237 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
3338 - name : Checkout Repository
34- uses : actions/checkout@v2
39+ uses : actions/checkout@v3
3540
3641 # Restore Tools from Manifest list in the Repository
3742 - name : Restore dotnet tools
@@ -51,16 +56,25 @@ jobs:
5156 matrix :
5257 platform : [WinUI2, WinUI3]
5358
59+ env :
60+ # faux-ternary expression to select which platforms to build for each platform vs. duplicating step below.
61+ TARGET_PLATFORMS : ${{ matrix.platform != 'WinUI3' && 'all' || 'all-uwp' }}
62+ TEST_PLATFORM : ${{ matrix.platform != 'WinUI3' && 'UWP' || 'WinAppSdk' }}
63+
5464 # Steps represent a sequence of tasks that will be executed as part of the job
5565 steps :
56- - name : Install .NET 6 SDK
57- uses : actions/setup-dotnet@v1
66+ - name : Install .NET SDK v${{ env.DOTNET_VERSION }}
67+ uses : actions/setup-dotnet@v3
5868 with :
59- dotnet-version : ' 6.0.202'
69+ dotnet-version : ${{ env.DOTNET_VERSION }}
70+
71+ - name : .NET Info (if diagnostics)
72+ if : ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
73+ run : dotnet --info
6074
6175 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
6276 - name : Checkout Repository
63- uses : actions/checkout@v2
77+ uses : actions/checkout@v3
6478
6579 # Restore Tools from Manifest list in the Repository
6680 - name : Restore dotnet tools
@@ -70,17 +84,18 @@ jobs:
7084 run : dotnet tool run uno-check --ci --fix --non-interactive --skip wsl --skip androidemulator --verbose
7185
7286 - name : Add msbuild to PATH
73- uses : microsoft/setup-msbuild@v1.0.3
87+ uses : microsoft/setup-msbuild@v1.3.1
7488
75- - name : Enable all TargetFrameworks
76- working-directory : ./common/Scripts /
77- run : powershell -version 5.1 -command "./UseTargetFrameworks.ps1 all " -ErrorAction Stop
89+ - name : Enable ${{ env.TARGET_PLATFORMS }} TargetFrameworks
90+ working-directory : ./common/MultiTarget /
91+ run : powershell -version 5.1 -command "./UseTargetFrameworks.ps1 ${{ env.TARGET_PLATFORMS }} " -ErrorAction Stop
7892
79- - name : Generate solution
80- run : powershell -version 5.1 -command "./GenerateAllSolution.ps1" -ErrorAction Stop
93+ - name : Generate solution w/ ${{ env.TEST_PLATFORM }} Tests
94+ working-directory : ./
95+ run : powershell -version 5.1 -command "./common/GenerateAllSolution.ps1 -IncludeHeads ${{ env.TEST_PLATFORM }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}" -ErrorAction Stop
8196
8297 - name : Enable Uno.WinUI (in WinUI3 matrix only)
83- working-directory : ./common/Scripts /
98+ working-directory : ./common/MultiTarget /
8499 run : powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
85100 if : ${{ matrix.platform == 'WinUI3' }}
86101
@@ -94,11 +109,11 @@ jobs:
94109
95110 # Push Packages to our DevOps Artifacts Feed
96111 - name : Add source
97- if : ${{github.ref == 'refs/heads/main'}}
112+ if : ${{ github.ref == 'refs/heads/main' }}
98113 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 }}
99114
100115 - name : Push packages
101- if : ${{github.ref == 'refs/heads/main'}}
116+ if : ${{ github.ref == 'refs/heads/main' }}
102117 run : dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate
103118
104119 # Run tests
@@ -112,56 +127,82 @@ jobs:
112127
113128 - name : Run SourceGenerators tests
114129 id : test-generator
115- 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"
130+ run : vstest.console.exe ./common/CommunityToolkit.Tooling.SampleGen. Tests/bin/Release/net6.0/CommunityToolkit.Tooling.SampleGen .Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx"
116131
117- - name : Run experiment tests against UWP
118- id : test-uwp
119- run : vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=UWP.trx"
120-
121- - name : Run experiment tests against WinAppSDK
122- id : test-winappsdk
123- run : vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=WinAppSdk.trx"
132+ - name : Run experiment tests against ${{ env.TEST_PLATFORM }}
133+ id : test-platform
134+ run : vstest.console.exe ./common/**/CommunityToolkit.Tests.${{ env.TEST_PLATFORM }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PLATFORM }}.trx"
124135
125136 - name : Create test reports
126137 run : |
127138 testspace '[${{ matrix.platform }}]./TestResults/*.trx'
128- if : ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}
139+ if : ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-platform.conclusion == 'success') }}
140+
141+ - name : Artifact - Diagnostic Logs
142+ uses : actions/upload-artifact@v3
143+ if : ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
144+ with :
145+ name : build-logs
146+ path : ./**/*.*log
129147
130148 # Test job to build a single experiment to ensure our changes work for both our main types of solutions at the moment
131149 new-experiment :
132- needs : [Xaml-Style-Check]
150+ # TODO: We should only run this if something in the common or template folder changed...
133151 runs-on : windows-latest
152+ env :
153+ PROJECT_DIRECTORY : template/ProjectTemplate
154+ TEST_PROJECT_NAME : CiTestExp
155+ TEST_PROJECT_DIRECTORY : components/CiTestExp
134156
135157 steps :
136- - name : Install .NET 6 SDK
137- uses : actions/setup-dotnet@v1
158+ - name : Install .NET SDK v${{ env.DOTNET_VERSION }}
159+ uses : actions/setup-dotnet@v3
138160 with :
139- dotnet-version : ' 6.0.202'
161+ dotnet-version : ${{ env.DOTNET_VERSION }}
162+
163+ - name : .NET Info (if diagnostics)
164+ if : ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
165+ run : dotnet --info
166+
167+ - name : Enable git long paths
168+ run : git config --system core.longpaths true
140169
141170 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
142171 - name : Checkout Repository
143- uses : actions/checkout@v2
172+ uses : actions/checkout@v3
144173
145174 - name : Add msbuild to PATH
146- 175+ 176+
177+ - name : Add project heads to ProjectTemplate
178+ working-directory : ./${{ env.PROJECT_DIRECTORY }}
179+ run : ${{ github.workspace }}/common/ProjectHeads/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
147180
148181 # Build and use template for creating new experiments
149182 - name : Build ProjectTemplate
150- working-directory : ./template/lab
183+ working-directory : ./${{ env.PROJECT_DIRECTORY }}
151184 run : msbuild.exe ProjectTemplate.sln /restore /nowarn:MSB4011 -p:Configuration=Debug
152185
186+ - name : Clean environment
187+ working-directory : ./
188+ run : git clean -xdf
189+
153190 # Create a new experiment from the template and test using that
154191 - name : Install template
155- working-directory : ./template/lab
192+ working-directory : ${{ env.PROJECT_DIRECTORY }}
156193 run : dotnet new --install ./
157194
158195 - name : Create new experiment
159- working-directory : ./labs
160- run : dotnet new labexp -n CiTestExp
196+ working-directory : ./components
197+ run : dotnet new labexp -n ${{ env.TEST_PROJECT_NAME }}
198+
199+ - name : Add project heads to ${{ env.TEST_PROJECT_NAME }}
200+ working-directory : ./${{ env.TEST_PROJECT_DIRECTORY }}
201+ run : ${{ github.workspace }}/common/ProjectHeads/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.TEST_PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
161202
162203 - name : MSBuild
163- working-directory : ./labs/CiTestExp
164- run : msbuild.exe CiTestExp .sln /restore /nowarn:MSB4011 -p:Configuration=Release
204+ working-directory : ./${{ env.TEST_PROJECT_DIRECTORY }}
205+ run : msbuild.exe ${{ env.TEST_PROJECT_NAME }} .sln /restore /nowarn:MSB4011 -p:Configuration=Release
165206
166207 # Run tests
167208 - name : Setup VSTest Path
@@ -174,42 +215,64 @@ jobs:
174215
175216 - name : Run tests in the generated experiment against UWP
176217 id : test-uwp
177- run : vstest.console.exe ./labs/CiTestExp /**/CiTestExp. Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=CiTestExpUWP .trx"
218+ run : vstest.console.exe ./components/${{ env.TEST_PROJECT_NAME }} /**/${{ env.TEST_PROJECT_NAME }}. Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PROJECT_NAME }}UWP .trx"
178219
179220 - name : Run tests in the generated experiment against WinAppSDK
180221 id : test-winappsdk
181- run : vstest.console.exe ./labs/CiTestExp /**/CiTestExp. Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=CiTestExpWinAppSdk .trx"
222+ run : vstest.console.exe ./components/${{ env.TEST_PROJECT_NAME }} /**/${{ env.TEST_PROJECT_NAME }}. Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PROJECT_NAME }}WinAppSdk .trx"
182223
183224 - name : Create test reports
184225 run : |
185226 testspace '[New Experiment]./TestResults/*.trx'
186227 if : ${{ always() && (steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}
187228
229+ - name : Artifact - Diagnostic Logs
230+ uses : actions/upload-artifact@v3
231+ if : ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
232+ with :
233+ name : new-experiment-logs
234+ path : ./**/*.*log
235+
188236 wasm-linux :
189- needs : [Xaml-Style-Check]
190237 runs-on : ubuntu-latest
191238
192239 steps :
193- - name : Install .NET 6 SDK
194- uses : actions/setup-dotnet@v1
240+ - name : Install .NET SDK v${{ env.DOTNET_VERSION }}
241+ uses : actions/setup-dotnet@v3
195242 with :
196- dotnet-version : ' 6.0.201'
243+ dotnet-version : ${{ env.DOTNET_VERSION }}
244+
245+ - name : .NET Info (if diagnostics)
246+ if : ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
247+ run : dotnet --info
197248
198249 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
199250 - name : Checkout Repository
200- uses : actions/checkout@v2
251+ uses : actions/checkout@v3
252+
253+ # Restore Tools from Manifest list in the Repository
254+ - name : Restore dotnet tools
255+ run : dotnet tool restore
201256
202257 - name : Generate solution
203258 shell : pwsh
204- run : ./GenerateAllSolution.ps1
259+ working-directory : ./
260+ run : ./common/GenerateAllSolution.ps1${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
205261
206262 - name : Install ninja for WASM native dependencies
207263 run : sudo apt-get install ninja-build
208264
209265 # Issue with Comment Links currently, see: https://github.com/mrlacey/CommentLinks/issues/38
210- # See launch.json configuration file for analogous command we're emulating here to build LINK: ../../.vscode/launch.json:CommunityToolkit.Labs .Wasm.csproj
266+ # See launch.json configuration file for analogous command we're emulating here to build LINK: ../../.vscode/launch.json:CommunityToolkit.App .Wasm.csproj
211267 - name : dotnet build
212- working-directory : ./platforms/CommunityToolkit.Labs. Wasm/
213- run : dotnet build /r /bl /p:UnoSourceGeneratorUseGenerationHost=true /p:UnoSourceGeneratorUseGenerationController=false -p:TargetFrameworks=netstandard2.0 -p:TargetFramework=net5.0
268+ working-directory : ./common/ProjectHeads/AllComponents/ Wasm/
269+ run : dotnet build /r /bl /p:UnoSourceGeneratorUseGenerationHost=true /p:UnoSourceGeneratorUseGenerationController=false
214270
215271 # TODO: Do we want to run tests here? Can we do that on linux easily?
272+
273+ - name : Artifact - Diagnostic Logs
274+ uses : actions/upload-artifact@v3
275+ if : ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
276+ with :
277+ name : linux-logs
278+ path : ./**/*.*log
0 commit comments