🧪 [Experiment] DependencyPropertyGenerator #1891
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.github.com/actions/using-workflows/about-workflows | |
# https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions | |
name: CI | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
merge_group: | |
env: | |
DOTNET_VERSION: ${{ '9.0.x' }} | |
ENABLE_DIAGNOSTICS: false | |
#COREHOST_TRACE: 1 | |
MSBUILD_VERBOSITY: normal | |
COREHOST_TRACEFILE: corehosttrace.log | |
IS_MAIN: ${{ github.ref == 'refs/heads/main' }} | |
IS_PR: ${{ startsWith(github.ref, 'refs/pull/') }} | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "Xaml-Style-Check" | |
Xaml-Style-Check: | |
runs-on: windows-latest-large | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Install .NET SDK v${{ env.DOTNET_VERSION }} | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# Restore Tools from Manifest list in the Repository | |
- name: Restore dotnet tools | |
run: dotnet tool restore | |
- name: Check XAML Styling | |
run: powershell -version 5.1 -command "./ApplyXamlStyling.ps1 -Passive" -ErrorAction Stop | |
# Build both Uno.UI/WinUI2/UWP and Uno.WinUI/WinUI3/WindowsAppSDK versions of our packages using a matrix | |
build: | |
needs: [Xaml-Style-Check] | |
runs-on: windows-latest | |
# See https://docs.github.com/actions/using-jobs/using-a-matrix-for-your-jobs | |
strategy: | |
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion. | |
matrix: | |
winui: [2, 3] # Temporary until we can get Uno/Wasm working | |
multitarget: ['uwp', 'wasdk'] # Temporary until we can get Uno/Wasm working | |
exclude: | |
# WinUI 2 not supported on wasdk | |
- winui: 2 | |
multitarget: wasdk | |
# WinUI 3 not supported on uwp | |
- winui: 3 | |
multitarget: uwp | |
env: | |
MULTI_TARGET_DIRECTORY: tooling/MultiTarget | |
# faux-ternary expression to select which platforms to build for each platform vs. duplicating step below. | |
TARGET_PLATFORMS: ${{ matrix.platform != 'WinUI3' && 'all-wasdk' || 'all-uwp' }} | |
TEST_PLATFORM: ${{ matrix.platform != 'WinUI3' && 'UWP' || 'WinAppSdk' }} | |
VERSION_PROPERTY: ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Configure Pagefile | |
uses: al-cheb/[email protected] | |
with: | |
minimum-size: 32GB | |
maximum-size: 32GB | |
disk-root: "C:" | |
- name: Enable User-Mode Dumps collecting | |
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '' }} | |
shell: powershell | |
run: | | |
New-Item '${{ github.workspace }}\CrashDumps' -Type Directory | |
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpFolder' -Type ExpandString -Value '${{ github.workspace }}\CrashDumps' | |
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpCount' -Type DWord -Value '10' | |
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpType' -Type DWord -Value '2' | |
- name: Install .NET SDK v${{ env.DOTNET_VERSION }} | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: .NET Info (if diagnostics) | |
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} | |
run: dotnet --info | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# Restore Tools from Manifest list in the Repository | |
- name: Restore dotnet tools | |
run: dotnet tool restore | |
- name: Run Uno Check to Install Dependencies | |
if: ${{ matrix.multitarget != 'wasdk' && matrix.multitarget != 'linuxgtk' && matrix.multitarget != 'wpf' }} | |
run: > | |
dotnet tool run uno-check | |
--ci | |
--fix | |
--target ${{ matrix.multitarget }} | |
--non-interactive | |
--skip wsl | |
--skip androidemulator | |
--skip vswinworkloads | |
--verbose | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
with: | |
vs-version: '[17.9,)' | |
# Generate full solution with all projects (sample gallery heads, components, tests) | |
- name: Generate solution with ${{ matrix.multitarget }} gallery, components and tests | |
run: powershell -version 5.1 -command "./tooling/Build-Toolkit-Components.ps1 -Components DependencyPropertyGenerator -Release -MultiTargets ${{ matrix.multitarget }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -WinUIMajorVersion ${{ matrix.winui }}" -ErrorAction Stop | |
- name: Artifact - Diagnostic Logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} | |
with: | |
name: build-logs-${{ matrix.multitarget }}-winui${{ matrix.winui }} | |
path: ./**/*.*log | |
- name: Artifact - ILC Repro | |
uses: actions/upload-artifact@v4 | |
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} | |
with: | |
name: ilc-repro | |
path: ./*.zip | |
# https://github.com/dorny/paths-filter#custom-processing-of-changed-files | |
- name: Detect If any Dump Files | |
uses: dorny/[email protected] | |
id: filter | |
with: | |
list-files: shell | |
filters: | | |
dump: | |
- added: '${{ github.workspace }}/CrashDumps/*.dmp' | |
- name: Artifact - WER crash dumps | |
uses: actions/upload-artifact@v4 | |
if: ${{ steps.filter.outputs.dump == 'true' && (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} | |
with: | |
name: CrashDumps-${{ matrix.platform }} | |
path: '${{ github.workspace }}/CrashDumps' | |
- name: Analyze Dump | |
if: ${{ steps.filter.outputs.dump == 'true' && (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} | |
run: | | |
dotnet tool install --global dotnet-dump | |
dotnet-dump analyze ${{ steps.filter.outputs.dump_files }} -c "clrstack" -c "pe -lines" -c "exit" | |
package: | |
runs-on: windows-latest | |
needs: [build] | |
strategy: | |
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion. | |
matrix: | |
winui: [2, 3] # Temporary until we can get Uno/Wasm working | |
env: | |
VERSION_PROPERTY: ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }} | |
steps: | |
- name: Install .NET SDK v${{ env.DOTNET_VERSION }} | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: .NET Info (if diagnostics) | |
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} | |
run: dotnet --info | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Format Date/Time of Commit for Package Version | |
run: | | |
echo "VERSION_DATE=$(git log -1 --format=%cd --date=format:%y%m%d)" >> $env:GITHUB_ENV | |
- name: Restore dotnet tools | |
run: dotnet tool restore | |
- name: Run Uno Check to Install Dependencies | |
run: > | |
dotnet tool run uno-check | |
--ci | |
--fix | |
--non-interactive | |
--skip wsl | |
--skip androidemulator | |
--skip vswinworkloads | |
--verbose | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
with: | |
vs-version: '[17.9,)' | |
- name: Define excluded MultiTargets (WinUI 2) | |
if: ${{ matrix.winui == '2' }} | |
run: | | |
echo "EXCLUDED_MULTITARGETS=wasdk" >> $env:GITHUB_ENV | |
- name: Define excluded MultiTargets (WinUI 3) | |
if: ${{ matrix.winui == '3' }} | |
run: | | |
echo "EXCLUDED_MULTITARGETS=uwp" >> $env:GITHUB_ENV | |
# Build and pack component nupkg | |
- name: Build and pack component packages | |
run: ./tooling/Build-Toolkit-Components.ps1 -Components DependencyPropertyGenerator -MultiTargets uwp,wasdk -ExcludeMultiTargets ${{ env.EXCLUDED_MULTITARGETS }} -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 | |
- name: Validate package names | |
if: ${{ env.VERSION_PROPERTY != '' }} | |
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 | |
# Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config) | |
- name: Push Pull Request Packages (if not fork) | |
if: ${{ env.IS_PR == 'true' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} | |
run: | | |
dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json ` | |
--name PullRequests ` | |
--username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }} | |
dotnet nuget push "*.nupkg" --api-key dummy --source PullRequests --skip-duplicate | |
- name: Push packages (main) | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
dotnet nuget update source LabsFeed ` | |
--username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }} | |
dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate | |
# 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. | |
- name: Upload Packages as Artifacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ env.IS_PR == 'false' || github.event.pull_request.head.repo.full_name != github.repository }} | |
with: | |
name: nuget-packages-winui${{ matrix.winui }} | |
if-no-files-found: error | |
path: | | |
./*.nupkg | |
- name: Artifact - Diagnostic Logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} | |
with: | |
name: build-logs-winui${{ matrix.winui }} | |
path: ./*.*log |