#57 - fix for winui crash #355
Workflow file for this run
This file contains hidden or 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
| name: "01 - Build, Test, Publish" | |
| on: | |
| push: | |
| # run on all commits | |
| pull_request: | |
| # run on all pull requests | |
| workflow_dispatch: | |
| # allows you to run this workflow manually from the Actions tab | |
| jobs: | |
| build_test_publish: | |
| # prevent duplicate builds for a commit which is a pull request | |
| # (this is needed because the workflow is triggered on both push and pull_request events) | |
| # we do this by making sure that the pull request ref is null when the event is a push | |
| if: github.event_name != 'push' || github.event.pull_request == null | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: powershell | |
| env: | |
| BUILD_PATH: ${{ github.workspace }}/src | |
| PUBLISH_PATH: ${{ github.workspace }}/.build/app/net9.0-windows | |
| TARGET_FRAMEWORK: net9.0-windows | |
| CONFIG_NAME: Release | |
| PLATFORM_NAME: x64 | |
| RUNTIME_NAME: win-x64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # needed for gitversion to work | |
| fetch-depth: 0 | |
| - name: setup | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: get vs components | |
| working-directory: ${{ env.BUILD_PATH }} | |
| if: false # disabled by default - enable for debugging | |
| run: | | |
| Install-Module -Name "VSSetup" -Scope "CurrentUser" -Force | |
| $vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" | |
| $vsInstaller = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installer.exe" | |
| write-host "components before" | |
| write-host "-----------------" | |
| (Get-VSSetupInstance | Select-VSSetupInstance -Product *).packages | Select-Object -ExpandProperty Id | Sort-Object | |
| $installationPath = & $vsWhere -latest -property installationPath | |
| & $vsInstaller modify --installPath $installationPath --add maui-windows --noUpdateInstaller --passive | |
| & $vsInstaller modify --installPath $installationPath --add Microsoft.VisualStudio.ComponentGroup.UWP.Support --noUpdateInstaller --passive | |
| # Workload: WinUI application development | |
| # ID: Microsoft.VisualStudio.Workload.Universal | |
| # Description: Build applications for the Windows platform using WinUI with C# or optionally C++. | |
| & $vsInstaller modify --installPath $installationPath --add Microsoft.VisualStudio.Workload.Universal --includeRecommended --includeOptional --noUpdateInstaller --passive | |
| write-host "components after" | |
| write-host "----------------" | |
| (Get-VSSetupInstance | Select-VSSetupInstance -Product *).packages | Select-Object -ExpandProperty Id | Sort-Object | |
| - name: dotnet info | |
| working-directory: ${{ env.BUILD_PATH }} | |
| run: | | |
| dotnet --info | |
| - name: dotnet workload list | |
| working-directory: ${{ env.BUILD_PATH }} | |
| run: | | |
| dotnet workload list | |
| - name: dotnet workload search | |
| working-directory: ${{ env.BUILD_PATH }} | |
| run: | | |
| dotnet workload search | |
| - name: dotnet restore | |
| working-directory: ${{ env.BUILD_PATH }} | |
| run: | | |
| dotnet restore ` | |
| --p:PublishReadyToRun=true ` | |
| --p:RuntimeIdentifier="${{ env.RUNTIME_NAME }}" | |
| - name: dotnet build | |
| working-directory: ${{ env.BUILD_PATH }} | |
| run: | | |
| dotnet build ` | |
| --p:Configuration="${{ env.CONFIG_NAME }}" ` | |
| --p:Platform="${{ env.PLATFORM_NAME }}" ` | |
| --p:WindowsAppSDKSelfContained=false ` | |
| --p:PublishSingleFile=false ` | |
| --p:PublishReadyToRun=false ` | |
| --p:PublishTrimmed=false ` | |
| --no-restore | |
| - name: dotnet test | |
| working-directory: ${{ env.BUILD_PATH }} | |
| run: | | |
| dotnet test ` | |
| --p:Configuration="${{ env.CONFIG_NAME }}" ` | |
| --p:Platform="${{ env.PLATFORM_NAME }}" ` | |
| --no-build ` | |
| --filter "TestCategory!=Performance" | |
| - name: dotnet publish (winforms) | |
| working-directory: ${{ env.BUILD_PATH }} | |
| run: | | |
| dotnet publish "./FancyMouse/FancyMouse.csproj" ` | |
| --p:Configuration="${{ env.CONFIG_NAME }}" ` | |
| --p:Platform="${{ env.PLATFORM_NAME }}" ` | |
| --p:RuntimeIdentifier="${{ env.RUNTIME_NAME }}" ` | |
| --output "${{ env.PUBLISH_PATH }}/FancyMouse.WinForms" | |
| - name: dotnet publish (winui3) | |
| working-directory: ${{ env.BUILD_PATH }} | |
| run: | | |
| dotnet publish "./FancyMouse.WinUI3/FancyMouse.WinUI3.csproj" ` | |
| --p:Configuration="${{ env.CONFIG_NAME }}" ` | |
| --p:Platform="${{ env.PLATFORM_NAME }}" ` | |
| --p:RuntimeIdentifier="${{ env.RUNTIME_NAME }}" ` | |
| --p:WindowsAppSDKSelfContained=false ` | |
| --p:PublishSingleFile=false ` | |
| --p:PublishReadyToRun=false ` | |
| --p:PublishTrimmed=false ` | |
| --self-contained false ` | |
| --output "${{ env.PUBLISH_PATH }}/FancyMouse.WinUI3" | |
| - name: upload release (winforms) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: FancyMouse-v0.0.0-preview | |
| path: ${{ env.PUBLISH_PATH }}/FancyMouse.WinForms | |
| - name: upload release (winui3) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: FancyMouse.WinUI3-v0.0.0-preview | |
| path: ${{ env.PUBLISH_PATH }}/FancyMouse.WinUI3 | |
| - name: upload test images | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-images | |
| path: ${{ env.BUILD_PATH }}/FancyMouse.Common.UnitTests/${{ env.PLATFORM_NAME }}/${{ env.CONFIG_NAME }}/${{ env.TARGET_FRAMEWORK }}/*_actual.png | |
| #- name: dotnet tool jb inspectcode | |
| # working-directory: ${{ env.BUILD_PATH }} | |
| # run: | | |
| # dotnet new tool-manifest | |
| # dotnet tool install jetbrains.resharper.globaltools | |
| # dotnet tool run jb inspectcode "./FancyMouse.sln" -output="../.build/out/jb-inspectcode.xml" --no-build | |
| #- name: upload jb-inspectcode.xml | |
| # uses: actions/upload-artifact@v3 | |
| # with: | |
| # name: jb-inspectcode.xml | |
| # path: .build/out/jb-inspectcode.xml |