|
| 1 | + |
| 2 | +# https://docs.github.com/actions/using-workflows/about-workflows |
| 3 | +# https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions |
| 4 | + |
| 5 | +name: CI |
| 6 | + |
| 7 | +# Controls when the action will run. |
| 8 | +on: |
| 9 | + # Triggers the workflow on push or pull request events but only for the main or release branches |
| 10 | + push: |
| 11 | + branches: [ main, 'dev', 'feature/*' ] |
| 12 | + pull_request: |
| 13 | + branches: [ main, 'dev', 'feature/*' ] |
| 14 | + |
| 15 | + # Allows you to run this workflow manually from the Actions tab (with inputs!) |
| 16 | + # https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#onworkflow_dispatchinputs |
| 17 | + workflow_dispatch: |
| 18 | + inputs: |
| 19 | + diagnostics: |
| 20 | + description: 'Enable diagnostics (binlogs, dumps, etc) for this run' |
| 21 | + required: false |
| 22 | + default: false |
| 23 | + type: boolean |
| 24 | + verbosity: |
| 25 | + description: 'MSBuild verbosity (quiet, minimal, normal, detailed, diagnostic)' |
| 26 | + required: true |
| 27 | + default: 'normal' |
| 28 | + type: choice |
| 29 | + options: |
| 30 | + - quiet |
| 31 | + - minimal |
| 32 | + - normal |
| 33 | + - detailed |
| 34 | + - diagnostic |
| 35 | + configuration: |
| 36 | + description: 'Build configuration to use' |
| 37 | + required: true |
| 38 | + default: 'Debug' |
| 39 | + type: choice |
| 40 | + options: |
| 41 | + - Debug |
| 42 | + - Release |
| 43 | + merge_group: |
| 44 | + |
| 45 | +env: |
| 46 | + DOTNET_VERSION: ${{ '9.0.x' }} |
| 47 | + CONFIGURATION: ${{ github.event.inputs.configuration || 'Debug' }} |
| 48 | + VERBOSITY: ${{ github.event.inputs.verbosity || 'normal' }} |
| 49 | + IS_MAIN: ${{ github.ref == 'refs/heads/main' }} |
| 50 | + IS_PR: ${{ startsWith(github.ref, 'refs/pull/') }} |
| 51 | + |
| 52 | +jobs: |
| 53 | + # Check XAML Styling before trying to do anything else as a gate |
| 54 | + Xaml-Style-Check: |
| 55 | + runs-on: windows-2022 |
| 56 | + |
| 57 | + steps: |
| 58 | + - name: Install .NET SDK v${{ env.DOTNET_VERSION }} |
| 59 | + uses: actions/setup-dotnet@v5.1.0 |
| 60 | + with: |
| 61 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 62 | + |
| 63 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 64 | + - name: Checkout Repository |
| 65 | + uses: actions/checkout@v6.0.2 |
| 66 | + with: |
| 67 | + submodules: recursive |
| 68 | + |
| 69 | + # Restore Tools from Manifest list in the Repository |
| 70 | + - name: Restore dotnet tools |
| 71 | + run: dotnet tool restore |
| 72 | + |
| 73 | + - name: Check XAML Styling |
| 74 | + run: powershell -version 5.1 -command "./ApplyXamlStyling.ps1 -Passive" -ErrorAction Stop |
| 75 | + |
| 76 | + build: |
| 77 | + needs: [Xaml-Style-Check] |
| 78 | + runs-on: windows-2022 |
| 79 | + |
| 80 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 81 | + steps: |
| 82 | + # give UWP more room to breathe |
| 83 | + - name: Configure Pagefile |
| 84 | + uses: al-cheb/configure-pagefile-action@v1.5 |
| 85 | + with: |
| 86 | + minimum-size: 32GB |
| 87 | + maximum-size: 32GB |
| 88 | + disk-root: "C:" |
| 89 | + |
| 90 | + - name: Enable User-Mode Dumps collecting |
| 91 | + if: (github.event.inputs.diagnostics || 'false') == 'true' |
| 92 | + shell: powershell |
| 93 | + run: | |
| 94 | + New-Item '${{ github.workspace }}\CrashDumps' -Type Directory |
| 95 | + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpFolder' -Type ExpandString -Value '${{ github.workspace }}\CrashDumps' |
| 96 | + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpCount' -Type DWord -Value '10' |
| 97 | + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpType' -Type DWord -Value '2' |
| 98 | +
|
| 99 | + - name: Install .NET SDK v${{ env.DOTNET_VERSION }} |
| 100 | + uses: actions/setup-dotnet@v5.1.0 |
| 101 | + with: |
| 102 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 103 | + |
| 104 | + - name: .NET Info (if diagnostics) |
| 105 | + if: (github.event.inputs.diagnostics || 'false') == 'true' |
| 106 | + run: dotnet --info |
| 107 | + |
| 108 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 109 | + - name: Checkout Repository |
| 110 | + uses: actions/checkout@v6.0.2 |
| 111 | + with: |
| 112 | + submodules: recursive |
| 113 | + |
| 114 | + # Restore Tools from Manifest list in the Repository |
| 115 | + - name: Restore dotnet tools |
| 116 | + run: dotnet tool restore |
| 117 | + |
| 118 | + - name: Add msbuild to PATH |
| 119 | + uses: microsoft/setup-msbuild@v2 |
| 120 | + with: |
| 121 | + vs-version: '[17.9,)' |
| 122 | + |
| 123 | + # Build solution |
| 124 | + - name: MSBuild |
| 125 | + run: > |
| 126 | + msbuild.exe /restore |
| 127 | + /p:Configuration=${{ env.CONFIGURATION }} |
| 128 | + /p:Platform=x64 |
| 129 | + /m |
| 130 | + ${{ github.event.inputs.diagnostics == 'true' && '/bl' || '' }} |
| 131 | + /v:${{ env.VERBOSITY }} |
| 132 | + XamlStudio.slnx |
| 133 | +
|
| 134 | + # Run tests |
| 135 | + - name: Setup VSTest Path |
| 136 | + uses: darenm/setup-vstest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44 |
| 137 | + |
| 138 | + - name: Run XAML Studio Unit Tests |
| 139 | + id: test-platform |
| 140 | + run: vstest.console.exe ./XamlStudio.Toolkit.UnitTests/**/XamlStudio.Toolkit.UnitTests.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=XamlStudio.trx" /Blame |
| 141 | + |
| 142 | + - name: Artifact - Diagnostic Logs |
| 143 | + uses: actions/upload-artifact@v6 |
| 144 | + if: ${{ (github.event.inputs.diagnostics || 'false') == 'true' && always() }} |
| 145 | + with: |
| 146 | + name: build-logs-xaml-studio |
| 147 | + path: ./**/*.*log |
| 148 | + |
| 149 | + - name: Artifact - ILC Repro |
| 150 | + uses: actions/upload-artifact@v6 |
| 151 | + if: ${{ (github.event.inputs.diagnostics || 'false') == 'true' && always() }} |
| 152 | + with: |
| 153 | + name: ilc-repro |
| 154 | + path: ./*.zip |
| 155 | + |
| 156 | + # https://github.com/dorny/paths-filter#custom-processing-of-changed-files |
| 157 | + - name: Detect If any Dump Files |
| 158 | + id: detect-dump |
| 159 | + if: always() |
| 160 | + working-directory: ${{ github.workspace }} |
| 161 | + run: | |
| 162 | + echo "DUMP_FILE=$(Get-ChildItem .\CrashDumps\*.dmp -ErrorAction SilentlyContinue)" >> $env:GITHUB_OUTPUT |
| 163 | +
|
| 164 | + - name: Artifact - WER crash dumps |
| 165 | + uses: actions/upload-artifact@v6 |
| 166 | + if: ${{ (github.event.inputs.diagnostics || 'false') == 'true' && always() }} |
| 167 | + with: |
| 168 | + name: CrashDumps-xaml-studio |
| 169 | + path: '${{ github.workspace }}/CrashDumps' |
| 170 | + |
| 171 | + - name: Analyze Dump |
| 172 | + if: ${{ steps.detect-dump.outputs.DUMP_FILE != '' && (github.event.inputs.diagnostics || 'false') == 'true' && always() }} |
| 173 | + run: | |
| 174 | + dotnet tool install --global dotnet-dump |
| 175 | + dotnet-dump analyze ${{ steps.detect-dump.outputs.DUMP_FILE }} -c "clrstack" -c "pe -lines" -c "exit" |
0 commit comments