Split Avalonia apphost packaging by OS #18
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 | |
| # Keep the job graph below in sync with the Mermaid workflow diagram in README.md. | |
| jobs: | |
| windows-hostlibs: | |
| runs-on: windows-2025-vs2026 | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x64 | |
| rid: win-x64 | |
| runtime_version: "10.0" | |
| - arch: arm64 | |
| rid: win-arm64 | |
| runtime_version: "10.0" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Compute hostlibs cache key | |
| id: hostlibs_key | |
| shell: powershell | |
| run: | | |
| $key = python .\scripts\cache_key.py --kind hostlibs --arch ${{ matrix.arch }} --os windows --runtime-version ${{ matrix.runtime_version }} | |
| "key=$key" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| # `lookup-only` is intentional here: `actions/cache` still runs its post step, | |
| # so a cache miss in this job will save the built output for downstream restore jobs. | |
| - name: Lookup hostlibs cache | |
| id: cache_hostlibs | |
| uses: actions/cache@v4 | |
| with: | |
| lookup-only: true | |
| path: artifacts\hostlibs\${{ matrix.runtime_version }}\${{ matrix.rid }} | |
| key: ${{ steps.hostlibs_key.outputs.key }} | |
| - name: Checkout runtime deps | |
| if: steps.cache_hostlibs.outputs.cache-hit != 'true' | |
| shell: powershell | |
| run: python .\scripts\checkout-deps.py runtime ${{ matrix.runtime_version }} | |
| - name: Build hostlibs for Windows | |
| shell: powershell | |
| if: steps.cache_hostlibs.outputs.cache-hit != 'true' | |
| run: python .\scripts\build-hostlibs.py all -v --arch ${{ matrix.arch }} --version ${{ matrix.runtime_version }} | |
| - name: Upload hostlibs artifact | |
| if: steps.cache_hostlibs.outputs.cache-hit != 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: hostlibs-${{ matrix.runtime_version }}-${{ 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@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Compute hostlibs cache key (10.0 win-x64) | |
| id: hostlibs_key | |
| shell: powershell | |
| run: | | |
| $key = python .\scripts\cache_key.py --kind hostlibs --arch x64 --os windows --runtime-version 10.0 | |
| "key=$key" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| - name: Restore hostlibs cache (10.0 win-x64) | |
| uses: actions/cache@v4 | |
| with: | |
| fail-on-cache-miss: true | |
| path: artifacts\hostlibs\10.0\win-x64 | |
| key: ${{ steps.hostlibs_key.outputs.key }} | |
| - name: Run matrix integration build | |
| shell: powershell | |
| run: python .\scripts\pipeline.py matrix -v | |
| windows-skia: | |
| runs-on: windows-2025-vs2026 | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x64 | |
| rid: win-x64 | |
| skiasharp_version: 2.88.9 | |
| - arch: arm64 | |
| rid: win-arm64 | |
| skiasharp_version: 2.88.9 | |
| - arch: x64 | |
| rid: win-x64 | |
| skiasharp_version: 3.119.2 | |
| - arch: arm64 | |
| rid: win-arm64 | |
| skiasharp_version: 3.119.2 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Install LLVM | |
| uses: ./.github/actions/install-llvm | |
| - name: Compute skia cache key | |
| id: skia_key | |
| shell: powershell | |
| run: | | |
| $key = python .\scripts\cache_key.py --kind skiasharp --skiasharp-version ${{ matrix.skiasharp_version }} --arch ${{ matrix.arch }} --os windows | |
| "key=$key" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| - name: Lookup skia cache | |
| id: cache_skia | |
| uses: actions/cache@v4 | |
| with: | |
| lookup-only: true | |
| path: artifacts\skiasharp\${{ matrix.skiasharp_version }}\${{ matrix.rid }} | |
| key: ${{ steps.skia_key.outputs.key }} | |
| - name: Checkout Skia deps | |
| if: steps.cache_skia.outputs.cache-hit != 'true' | |
| shell: powershell | |
| run: python .\scripts\checkout-deps.py skiasharp ${{ matrix.skiasharp_version }} | |
| - name: Build SkiaSharp and HarfBuzz for Windows | |
| shell: powershell | |
| if: steps.cache_skia.outputs.cache-hit != 'true' | |
| run: python .\scripts\build-skia-harfbuzz.py -v -a ${{ matrix.arch }} --os windows --version ${{ matrix.skiasharp_version }} | |
| - name: Upload skiasharp artifact | |
| if: steps.cache_skia.outputs.cache-hit != 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: skiasharp-${{ matrix.skiasharp_version }}-${{ matrix.rid }} | |
| path: artifacts\skiasharp\${{ matrix.skiasharp_version }}\${{ matrix.rid }} | |
| if-no-files-found: error | |
| windows-link-avalonia: | |
| runs-on: windows-2025-vs2026 | |
| needs: | |
| - windows-hostlibs | |
| - windows-skia | |
| strategy: | |
| matrix: | |
| include: | |
| - avalonia_target: "11.0" | |
| skiasharp_version: "2.88.9" | |
| - avalonia_target: "12.0" | |
| skiasharp_version: "3.119.2" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Compute hostlibs cache keys | |
| id: hostlibs_keys | |
| shell: powershell | |
| run: | | |
| $keyX64 = python .\scripts\cache_key.py --kind hostlibs --arch x64 --os windows --runtime-version 10.0 | |
| "key_x64=$keyX64" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| $keyArm64 = python .\scripts\cache_key.py --kind hostlibs --arch arm64 --os windows --runtime-version 10.0 | |
| "key_arm64=$keyArm64" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| - name: Restore hostlibs cache (10.0 win-x64) | |
| uses: actions/cache@v4 | |
| with: | |
| fail-on-cache-miss: true | |
| path: artifacts\hostlibs\10.0\win-x64 | |
| key: ${{ steps.hostlibs_keys.outputs.key_x64 }} | |
| - name: Restore hostlibs cache (10.0 win-arm64) | |
| uses: actions/cache@v4 | |
| with: | |
| fail-on-cache-miss: true | |
| path: artifacts\hostlibs\10.0\win-arm64 | |
| key: ${{ steps.hostlibs_keys.outputs.key_arm64 }} | |
| - name: Compute skia cache keys | |
| id: skia_keys | |
| shell: powershell | |
| run: | | |
| $keySkiaX64 = python .\scripts\cache_key.py --kind skiasharp --skiasharp-version ${{ matrix.skiasharp_version }} --arch x64 --os windows | |
| "key_skia_x64=$keySkiaX64" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| $keySkiaArm64 = python .\scripts\cache_key.py --kind skiasharp --skiasharp-version ${{ matrix.skiasharp_version }} --arch arm64 --os windows | |
| "key_skia_arm64=$keySkiaArm64" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| - name: Restore skia cache (win-x64) | |
| uses: actions/cache@v4 | |
| with: | |
| fail-on-cache-miss: true | |
| path: artifacts\skiasharp\${{ matrix.skiasharp_version }}\win-x64 | |
| key: ${{ steps.skia_keys.outputs.key_skia_x64 }} | |
| - name: Restore skia cache (win-arm64) | |
| uses: actions/cache@v4 | |
| with: | |
| fail-on-cache-miss: true | |
| path: artifacts\skiasharp\${{ matrix.skiasharp_version }}\win-arm64 | |
| key: ${{ steps.skia_keys.outputs.key_skia_arm64 }} | |
| - name: Link Avalonia apphost templates for Windows | |
| shell: powershell | |
| run: python .\scripts\pipeline.py link-avalonia -v --target ${{ matrix.avalonia_target }} --os windows | |
| - name: Upload Windows Avalonia apphost artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: avalonia-host-${{ matrix.avalonia_target }}-windows | |
| path: artifacts\avalonia-host\${{ matrix.avalonia_target }} | |
| if-no-files-found: error | |
| - name: Run Avalonia App Host package tests | |
| shell: powershell | |
| run: python .\scripts\pipeline.py avalonia-test -v --target ${{ matrix.avalonia_target }} | |
| linux-hostlibs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Compute hostlibs cache key | |
| id: hostlibs_key | |
| run: | | |
| key=$(python ./scripts/cache_key.py --kind hostlibs --arch x64 --os linux --runtime-version 10.0) | |
| echo "key=$key" >> "$GITHUB_OUTPUT" | |
| - name: Lookup hostlibs cache | |
| id: cache_hostlibs | |
| uses: actions/cache@v4 | |
| with: | |
| lookup-only: true | |
| path: artifacts/hostlibs/10.0/linux-x64 | |
| key: ${{ steps.hostlibs_key.outputs.key }} | |
| - name: Checkout runtime deps | |
| if: steps.cache_hostlibs.outputs.cache-hit != 'true' | |
| run: python ./scripts/checkout-deps.py runtime 10.0 | |
| - name: Install runtime native dependencies | |
| if: steps.cache_hostlibs.outputs.cache-hit != 'true' | |
| working-directory: ./repo/runtime-10.0 | |
| run: sudo ./eng/common/native/install-dependencies.sh linux | |
| - name: Build hostlibs for Linux x64 | |
| if: steps.cache_hostlibs.outputs.cache-hit != 'true' | |
| run: python ./scripts/build-hostlibs.py -v --os linux --arch x64 --version 10.0 | |
| - name: Upload hostlibs artifact | |
| if: steps.cache_hostlibs.outputs.cache-hit != 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: hostlibs-10.0-linux-x64 | |
| path: artifacts/hostlibs | |
| if-no-files-found: error | |
| linux-matrix-test: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - linux-hostlibs | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Compute hostlibs cache key (10.0 linux-x64) | |
| id: hostlibs_key | |
| run: | | |
| key=$(python ./scripts/cache_key.py --kind hostlibs --arch x64 --os linux --runtime-version 10.0) | |
| echo "key=$key" >> "$GITHUB_OUTPUT" | |
| - name: Restore hostlibs cache (10.0 linux-x64) | |
| uses: actions/cache@v4 | |
| with: | |
| fail-on-cache-miss: true | |
| path: artifacts/hostlibs/10.0/linux-x64 | |
| key: ${{ steps.hostlibs_key.outputs.key }} | |
| - name: Run matrix integration build | |
| run: python ./scripts/pipeline.py matrix -v | |
| linux-skia: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - rid: linux-x64 | |
| arch: x64 | |
| skiasharp_version: 2.88.9 | |
| - rid: linux-x64 | |
| arch: x64 | |
| skiasharp_version: 3.119.2 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Compute skia cache key | |
| id: skia_key | |
| run: | | |
| key=$(python ./scripts/cache_key.py --kind skiasharp --skiasharp-version ${{ matrix.skiasharp_version }} --arch ${{ matrix.arch }} --os linux) | |
| echo "key=$key" >> "$GITHUB_OUTPUT" | |
| - name: Lookup skia cache | |
| id: cache_skia | |
| uses: actions/cache@v4 | |
| with: | |
| lookup-only: true | |
| path: artifacts/skiasharp/${{ matrix.skiasharp_version }}/${{ matrix.rid }} | |
| key: ${{ steps.skia_key.outputs.key }} | |
| - name: Checkout Skia deps | |
| if: steps.cache_skia.outputs.cache-hit != 'true' | |
| run: python ./scripts/checkout-deps.py skiasharp ${{ matrix.skiasharp_version }} | |
| - name: Build SkiaSharp and HarfBuzz for Linux | |
| if: steps.cache_skia.outputs.cache-hit != 'true' | |
| run: python ./scripts/build-skia-harfbuzz.py -v --os linux --arch ${{ matrix.arch }} --version ${{ matrix.skiasharp_version }} | |
| - name: Upload skia artifact | |
| if: steps.cache_skia.outputs.cache-hit != 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: skiasharp-${{ matrix.skiasharp_version }}-${{ matrix.rid }} | |
| path: artifacts/skiasharp/${{ matrix.skiasharp_version }}/${{ matrix.rid }} | |
| if-no-files-found: error | |
| linux-link-avalonia: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - linux-hostlibs | |
| - linux-skia | |
| strategy: | |
| matrix: | |
| include: | |
| - avalonia_target: "11.0" | |
| skiasharp_version: "2.88.9" | |
| - avalonia_target: "12.0" | |
| skiasharp_version: "3.119.2" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Install libfontconfig1-dev | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libfontconfig1-dev | |
| - name: Compute hostlibs cache key | |
| id: hostlibs_key | |
| run: | | |
| key=$(python ./scripts/cache_key.py --kind hostlibs --arch x64 --os linux --runtime-version 10.0) | |
| echo "key=$key" >> "$GITHUB_OUTPUT" | |
| - name: Restore hostlibs cache (10.0 linux-x64) | |
| uses: actions/cache@v4 | |
| with: | |
| fail-on-cache-miss: true | |
| path: artifacts/hostlibs/10.0/linux-x64 | |
| key: ${{ steps.hostlibs_key.outputs.key }} | |
| - name: Compute skia cache key | |
| id: skia_key | |
| run: | | |
| key=$(python ./scripts/cache_key.py --kind skiasharp --skiasharp-version ${{ matrix.skiasharp_version }} --arch x64 --os linux) | |
| echo "key=$key" >> "$GITHUB_OUTPUT" | |
| - name: Restore skia cache (linux-x64) | |
| uses: actions/cache@v4 | |
| with: | |
| fail-on-cache-miss: true | |
| path: artifacts/skiasharp/${{ matrix.skiasharp_version }}/linux-x64 | |
| key: ${{ steps.skia_key.outputs.key }} | |
| - name: Link Avalonia apphost templates for Linux | |
| run: python ./scripts/pipeline.py link-avalonia -v --target ${{ matrix.avalonia_target }} --os linux | |
| - name: Run Avalonia App Host package tests | |
| run: python ./scripts/pipeline.py avalonia-test -v --target ${{ matrix.avalonia_target }} | |
| - name: Upload Linux Avalonia apphost artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: avalonia-host-${{ matrix.avalonia_target }}-linux | |
| path: artifacts/avalonia-host/${{ matrix.avalonia_target }} | |
| if-no-files-found: error | |
| pack-avalonia: | |
| runs-on: windows-2025-vs2026 | |
| needs: | |
| - windows-link-avalonia | |
| - linux-link-avalonia | |
| strategy: | |
| matrix: | |
| include: | |
| - avalonia_target: "11.0" | |
| - avalonia_target: "12.0" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Download Windows Avalonia apphost artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: avalonia-host-${{ matrix.avalonia_target }}-windows | |
| path: artifacts\avalonia-host\${{ matrix.avalonia_target }} | |
| - name: Download Linux Avalonia apphost artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: avalonia-host-${{ matrix.avalonia_target }}-linux | |
| path: artifacts\avalonia-host\${{ matrix.avalonia_target }} | |
| - name: Pack Avalonia apphost ${{ matrix.avalonia_target }} | |
| shell: powershell | |
| run: python .\scripts\pipeline.py pack-avalonia -v --target ${{ matrix.avalonia_target }} --mode all | |
| - name: Upload nuget packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-packages-avalonia-${{ matrix.avalonia_target }} | |
| path: artifacts\packages\Release | |
| if-no-files-found: error |