Unify MSVC hostlib build steps and add arm64 support #48
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: build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| LINUX_SYSROOT_CACHE_KEY: linux-sysroot-bionic-amd64 | |
| # Keep the job graph below in sync with the Mermaid workflow diagram in DEVELOPMENT.md. | |
| jobs: | |
| windows-hostlibs: | |
| runs-on: windows-2025-vs2026 | |
| env: | |
| CONAN_HOME: ${{ github.workspace }}/build/conan | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x64 | |
| rid: win-x64 | |
| hostlibs_flavor: default | |
| pgo: "True" | |
| - arch: arm64 | |
| rid: win-arm64 | |
| hostlibs_flavor: default | |
| pgo: "True" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Restore HostLibs cache | |
| id: cache_hostlibs | |
| uses: actions/cache@v5 | |
| with: | |
| path: artifacts\hostlibs | |
| key: hostlibs-windows-${{ matrix.hostlibs_flavor }}-${{ matrix.rid }}-${{ hashFiles('native/hostlibs/**') }} | |
| - name: Install uv | |
| if: steps.cache_hostlibs.outputs.cache-hit != 'true' | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install Task | |
| if: steps.cache_hostlibs.outputs.cache-hit != 'true' | |
| uses: ./.github/actions/install-task | |
| - name: Build and deploy HostLibs | |
| shell: powershell | |
| if: steps.cache_hostlibs.outputs.cache-hit != 'true' | |
| run: task build-hostlibs ARCH=${{ matrix.arch }} PGO=${{ matrix.pgo }} | |
| - name: Upload hostlibs artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: hostlibs-${{ matrix.hostlibs_flavor }}-${{ matrix.rid }} | |
| path: artifacts\hostlibs | |
| if-no-files-found: error | |
| windows-matrix-test: | |
| runs-on: windows-2025-vs2026 | |
| needs: | |
| - windows-hostlibs | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Download HostLibs artifact (default win-x64) | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: hostlibs-default-win-x64 | |
| path: artifacts\hostlibs | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Run matrix integration build | |
| shell: powershell | |
| run: task matrix | |
| windows-skia: | |
| runs-on: windows-2025-vs2026 | |
| env: | |
| CONAN_HOME: ${{ github.workspace }}/build/conan | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x64 | |
| rid: win-x64 | |
| - arch: arm64 | |
| rid: win-arm64 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Restore SkiaSharp cache | |
| id: cache_skia | |
| uses: actions/cache@v5 | |
| with: | |
| path: artifacts\skiasharp | |
| key: skiasharp-windows-${{ matrix.rid }}-${{ hashFiles('native/skiasharp/**', 'scripts/libHarfBuzzSharp.vcxproj.in') }} | |
| - name: Install LLVM | |
| if: steps.cache_skia.outputs.cache-hit != 'true' | |
| uses: ./.github/actions/install-llvm | |
| - name: Install uv | |
| if: steps.cache_skia.outputs.cache-hit != 'true' | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install Task | |
| if: steps.cache_skia.outputs.cache-hit != 'true' | |
| uses: ./.github/actions/install-task | |
| - name: Build and deploy SkiaSharp | |
| shell: powershell | |
| if: steps.cache_skia.outputs.cache-hit != 'true' | |
| run: task build-skiasharp ARCH=${{ matrix.arch }} | |
| - name: Upload skiasharp artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: skiasharp-${{ matrix.rid }} | |
| path: artifacts\skiasharp | |
| if-no-files-found: error | |
| windows-angle: | |
| runs-on: windows-2025-vs2026 | |
| env: | |
| CONAN_HOME: ${{ github.workspace }}/build/conan | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x64 | |
| rid: win-x64 | |
| - arch: arm64 | |
| rid: win-arm64 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Restore ANGLE cache | |
| id: cache_angle | |
| uses: actions/cache@v5 | |
| with: | |
| path: artifacts\angle | |
| key: angle-windows-${{ matrix.rid }}-${{ hashFiles('native/angle/**') }} | |
| - name: Install uv | |
| if: steps.cache_angle.outputs.cache-hit != 'true' | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install Task | |
| if: steps.cache_angle.outputs.cache-hit != 'true' | |
| uses: ./.github/actions/install-task | |
| - name: Install depot_tools | |
| if: steps.cache_angle.outputs.cache-hit != 'true' | |
| shell: powershell | |
| run: | | |
| git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git "$env:RUNNER_TEMP\depot_tools" | |
| "$env:RUNNER_TEMP\depot_tools" | Out-File -FilePath $env:GITHUB_PATH -Append | |
| - name: Build and deploy ANGLE | |
| shell: powershell | |
| if: steps.cache_angle.outputs.cache-hit != 'true' | |
| run: task build-angle ARCH=${{ matrix.arch }} | |
| - name: Upload ANGLE artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: angle-${{ matrix.rid }} | |
| path: artifacts\angle | |
| if-no-files-found: error | |
| windows-link-avalonia: | |
| runs-on: windows-2025-vs2026 | |
| needs: | |
| - windows-hostlibs | |
| - windows-skia | |
| - windows-angle | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Install LLVM | |
| uses: ./.github/actions/install-llvm | |
| - name: Download HostLibs artifact (win-x64) | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: hostlibs-default-win-x64 | |
| path: artifacts\hostlibs | |
| - name: Download HostLibs artifact (win-arm64) | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: hostlibs-default-win-arm64 | |
| path: artifacts\hostlibs | |
| - name: Download SkiaSharp artifact (win-x64) | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: skiasharp-win-x64 | |
| path: artifacts\skiasharp | |
| - name: Download SkiaSharp artifact (win-arm64) | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: skiasharp-win-arm64 | |
| path: artifacts\skiasharp | |
| - name: Download ANGLE artifact (win-x64) | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: angle-win-x64 | |
| path: artifacts\angle | |
| - name: Download ANGLE artifact (win-arm64) | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: angle-win-arm64 | |
| path: artifacts\angle | |
| - name: Link Avalonia apphost templates for Windows | |
| shell: powershell | |
| run: task link-avalonia TARGET_OS=windows | |
| - name: Upload Windows Avalonia apphost artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: avalonia-host-windows | |
| path: artifacts\avalonia-host | |
| if-no-files-found: error | |
| - name: Run Avalonia App Host package tests | |
| shell: powershell | |
| run: task avalonia-test | |
| linux-sysroot: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Build and cache Linux sysroot | |
| uses: ./.github/actions/sysroot-cache | |
| with: | |
| cache-key: ${{ env.LINUX_SYSROOT_CACHE_KEY }} | |
| linux-hostlibs: | |
| runs-on: ubuntu-latest | |
| env: | |
| CONAN_HOME: ${{ github.workspace }}/build/conan | |
| needs: | |
| - linux-sysroot | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Restore Linux sysroot | |
| id: restore_sysroot | |
| uses: ./.github/actions/sysroot-restore | |
| with: | |
| cache-key: ${{ env.LINUX_SYSROOT_CACHE_KEY }} | |
| - name: Restore HostLibs cache | |
| id: cache_hostlibs | |
| uses: actions/cache@v5 | |
| with: | |
| path: artifacts/hostlibs | |
| key: hostlibs-linux-linux-x64-${{ env.LINUX_SYSROOT_CACHE_KEY }}-${{ hashFiles('native/hostlibs/**') }} | |
| - name: Build and deploy HostLibs | |
| if: steps.cache_hostlibs.outputs.cache-hit != 'true' | |
| run: task build-hostlibs SYSROOT="${{ steps.restore_sysroot.outputs.sysroot-path }}" | |
| - name: Upload hostlibs artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: hostlibs-default-linux-x64 | |
| path: artifacts/hostlibs | |
| if-no-files-found: error | |
| linux-matrix-test: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - linux-sysroot | |
| - linux-hostlibs | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Restore Linux sysroot | |
| uses: ./.github/actions/sysroot-restore | |
| with: | |
| cache-key: ${{ env.LINUX_SYSROOT_CACHE_KEY }} | |
| - name: Install LLVM | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y llvm | |
| - name: Download HostLibs artifact (linux-x64) | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: hostlibs-default-linux-x64 | |
| path: artifacts/hostlibs | |
| - name: Run matrix integration build | |
| run: task matrix | |
| linux-skia: | |
| runs-on: ubuntu-latest | |
| env: | |
| CONAN_HOME: ${{ github.workspace }}/build/conan | |
| needs: | |
| - linux-sysroot | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Restore Linux sysroot | |
| id: restore_sysroot | |
| uses: ./.github/actions/sysroot-restore | |
| with: | |
| cache-key: ${{ env.LINUX_SYSROOT_CACHE_KEY }} | |
| - name: Restore SkiaSharp cache | |
| id: cache_skia | |
| uses: actions/cache@v5 | |
| with: | |
| path: artifacts/skiasharp | |
| key: skiasharp-linux-linux-x64-${{ env.LINUX_SYSROOT_CACHE_KEY }}-${{ hashFiles('native/skiasharp/**', 'scripts/libHarfBuzzSharp.vcxproj.in') }} | |
| - name: Build and deploy SkiaSharp | |
| if: steps.cache_skia.outputs.cache-hit != 'true' | |
| run: task build-skiasharp SYSROOT="${{ steps.restore_sysroot.outputs.sysroot-path }}" | |
| - name: Upload skia artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: skiasharp-linux-x64 | |
| path: artifacts/skiasharp | |
| if-no-files-found: error | |
| linux-link-avalonia: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - linux-sysroot | |
| - linux-hostlibs | |
| - linux-skia | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Restore Linux sysroot | |
| id: restore_sysroot | |
| uses: ./.github/actions/sysroot-restore | |
| with: | |
| cache-key: ${{ env.LINUX_SYSROOT_CACHE_KEY }} | |
| - name: Download HostLibs artifact (linux-x64) | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: hostlibs-default-linux-x64 | |
| path: artifacts/hostlibs | |
| - name: Download SkiaSharp artifact (linux-x64) | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: skiasharp-linux-x64 | |
| path: artifacts/skiasharp | |
| - name: Link Avalonia apphost templates for Linux | |
| run: task link-avalonia TARGET_OS=linux SYSROOT="${{ steps.restore_sysroot.outputs.sysroot-path }}" | |
| - name: Run Avalonia App Host package tests | |
| run: task avalonia-test SYSROOT="${{ steps.restore_sysroot.outputs.sysroot-path }}" | |
| - name: Upload Linux Avalonia apphost artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: avalonia-host-linux | |
| path: artifacts/avalonia-host | |
| if-no-files-found: error | |
| pack-avalonia: | |
| runs-on: windows-2025-vs2026 | |
| needs: | |
| - windows-link-avalonia | |
| - linux-link-avalonia | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Download Windows Avalonia apphost artifact | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: avalonia-host-windows | |
| path: artifacts\avalonia-host | |
| - name: Download Linux Avalonia apphost artifact | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: avalonia-host-linux | |
| path: artifacts\avalonia-host | |
| - name: Pack Avalonia apphost packages | |
| shell: powershell | |
| run: task pack-avalonia | |
| - name: Verify meta package dependencies | |
| shell: powershell | |
| run: | | |
| $nupkg = Get-ChildItem "artifacts\packages\Release\ChsBuffer.Avalonia.AppHost.*.nupkg" | Where-Object { $_.Name -notmatch '\.(win-x64|win-arm64|linux-x64|Build)\.' } | Select-Object -First 1 | |
| if (-not $nupkg) { throw "Meta package not found" } | |
| $tmp = Join-Path $env:RUNNER_TEMP "meta-check" | |
| Expand-Archive $nupkg.FullName $tmp -Force | |
| $nuspec = Get-Content (Get-ChildItem "$tmp\*.nuspec").FullName -Raw | |
| @('ChsBuffer.Avalonia.AppHost.win-x64','ChsBuffer.Avalonia.AppHost.win-arm64','ChsBuffer.Avalonia.AppHost.linux-x64','ChsBuffer.Avalonia.AppHost.Build') | ForEach-Object { | |
| if ($nuspec -notmatch "id=`"$_`"") { throw "Meta package missing dependency: $_" } | |
| } | |
| Write-Host "Meta package dependencies verified." | |
| - name: Upload nuget packages | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: nuget-packages-avalonia | |
| path: artifacts\packages\Release | |
| if-no-files-found: error |