cross-platform.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. name: Cross-platform preview
  2. on:
  3. push:
  4. branches: [main]
  5. paths: ['CrossPlatform/**', 'tools/Build-CrossPlatform.ps1', 'tools/package_cross_platform.py', 'tools/Test-IsolatedProcess.ps1', '.github/workflows/cross-platform.yml']
  6. pull_request:
  7. paths: ['CrossPlatform/**', 'tools/Build-CrossPlatform.ps1', 'tools/package_cross_platform.py', 'tools/Test-IsolatedProcess.ps1', '.github/workflows/cross-platform.yml']
  8. workflow_dispatch:
  9. permissions:
  10. contents: read
  11. jobs:
  12. desktop:
  13. name: Desktop ${{ matrix.runtime }}
  14. strategy:
  15. fail-fast: false
  16. matrix:
  17. include:
  18. - {runner: windows-latest, runtime: win-x64}
  19. - {runner: ubuntu-latest, runtime: linux-x64}
  20. - {runner: macos-latest, runtime: osx-x64}
  21. - {runner: macos-latest, runtime: osx-arm64}
  22. runs-on: ${{ matrix.runner }}
  23. timeout-minutes: 25
  24. steps:
  25. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
  26. - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68
  27. with:
  28. dotnet-version: 10.0.x
  29. - name: Run core and responsive UI checks
  30. shell: pwsh
  31. run: ./tools/Build-CrossPlatform.ps1 -Target test
  32. - name: Publish self-contained application
  33. shell: pwsh
  34. run: ./tools/Build-CrossPlatform.ps1 -Target desktop -Runtime ${{ matrix.runtime }}
  35. - name: Check native Windows startup on an inactive desktop
  36. if: matrix.runtime == 'win-x64'
  37. shell: powershell
  38. run: ./tools/Test-IsolatedProcess.ps1 -Executable ./artifacts/cross-platform/win-x64/PCL.Communist.Desktop.exe -OutputDirectory ./artifacts/cross-platform/windows-startup -TimeoutSeconds 10 -ExpectMainWindow -ExpectedWindowTitle 'PCL Communist · 跨平台预览' -ExpectedWindowClassPrefix Avalonia
  39. - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
  40. with:
  41. name: preview-${{ matrix.runtime }}
  42. path: |
  43. artifacts/cross-platform/packages/*.tar.gz*
  44. artifacts/cross-platform/packages/*.zip*
  45. artifacts/cross-platform/qa/*.png
  46. artifacts/cross-platform/windows-startup/*
  47. if-no-files-found: error
  48. android:
  49. name: Android arm64 preview APK
  50. runs-on: ubuntu-latest
  51. timeout-minutes: 35
  52. steps:
  53. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
  54. - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68
  55. with:
  56. dotnet-version: 10.0.x
  57. - run: dotnet workload install android --skip-manifest-update
  58. - name: Install matching Android SDK and JDK
  59. run: dotnet build CrossPlatform/PCL.Communist.Android -t:InstallAndroidDependencies -f net10.0-android -p:AndroidSdkDirectory="$RUNNER_TEMP/android-sdk" -p:JavaSdkDirectory="$RUNNER_TEMP/jdk" -p:AcceptAndroidSDKLicenses=True
  60. - name: Build debug-signed preview APK
  61. shell: pwsh
  62. run: ./tools/Build-CrossPlatform.ps1 -Target android -AndroidSdkDirectory "$env:RUNNER_TEMP/android-sdk" -JavaSdkDirectory "$env:RUNNER_TEMP/jdk"
  63. - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
  64. with:
  65. name: preview-android-arm64
  66. path: artifacts/cross-platform/android-arm64/*-Signed.apk
  67. if-no-files-found: error
  68. ios:
  69. name: iPhone and iPad simulator preview
  70. runs-on: macos-26
  71. timeout-minutes: 40
  72. env:
  73. DEVELOPER_DIR: /Applications/Xcode_26.6.app/Contents/Developer
  74. steps:
  75. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
  76. - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68
  77. with:
  78. dotnet-version: 10.0.401
  79. - name: Install the iOS workload matching Xcode 26.6
  80. run: |
  81. xcodebuild -version
  82. dotnet workload install ios --version 10.0.401
  83. - name: Build simulator application without signing credentials
  84. shell: pwsh
  85. run: ./tools/Build-CrossPlatform.ps1 -Target ios-simulator
  86. - name: Archive simulator application
  87. run: |
  88. app=$(find artifacts/cross-platform -maxdepth 2 -type d -name '*.app' -print -quit)
  89. test -n "$app"
  90. tar -czf artifacts/cross-platform/PCL-Communist-ios-simulator.tar.gz -C "$(dirname "$app")" "$(basename "$app")"
  91. - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
  92. with:
  93. name: preview-ios-simulator
  94. path: artifacts/cross-platform/PCL-Communist-ios-simulator.tar.gz
  95. if-no-files-found: error