Refine Avalonia packaging and Linux build support #17
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 | |
| 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 | |
| - 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 }} | |
| "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 }} --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-pack-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: Install LLVM | |
| uses: ./.github/actions/install-llvm | |
| - 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 | |
| "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 | |
| "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: Pack Avalonia apphost ${{ matrix.avalonia_target }} | |
| shell: powershell | |
| run: python .\scripts\pipeline.py pack-avalonia -v --target ${{ matrix.avalonia_target }} | |
| - 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 | |
| # - name: Run Avalonia App Host package tests | |
| # shell: powershell | |
| # run: dotnet test --project .\tests\HostForge.AvaloniaAppHost.Tests\HostForge.AvaloniaAppHost.Tests.csproj -c Release -v:normal | |
| linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| submodules: false | |
| - name: Checkout runtime deps | |
| run: python ./scripts/checkout-deps.py runtime 10.0 | |
| - name: Install runtime native dependencies | |
| working-directory: ./repo/runtime-10.0 | |
| run: sudo ./eng/common/native/install-dependencies.sh linux | |
| - name: Build hostlibs for Linux x64 | |
| run: python ./scripts/build-hostlibs.py -v --os linux --arch x64 --version 10.0 | |
| - name: Run SimplePInvoke sample linux-x64 apphost | |
| run: ./repo/runtime-10.0/.dotnet/dotnet run --project samples/simple-pinvoke/SimplePInvoke.csproj -v:normal | |
| - name: Publish SimplePInvoke sample trimmed linux-x64 singlefilehost | |
| run: ./repo/runtime-10.0/.dotnet/dotnet publish samples/simple-pinvoke/SimplePInvoke.csproj -v:normal -p:"PublishTrimmed=true" | |
| - name: Run SimplePInvoke sample linux-x64 singlefilehost | |
| run: samples/simple-pinvoke/bin/Release/net10.0/linux-x64/publish/SimplePInvoke |