cross-platform.yml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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: pwsh
  38. run: powershell.exe -NoProfile -ExecutionPolicy Bypass -File ./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. - name: Upload Windows startup diagnostics on failure
  40. if: failure() && matrix.runtime == 'win-x64'
  41. uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
  42. with:
  43. name: preview-windows-startup-failure
  44. path: artifacts/cross-platform/windows-startup/*
  45. if-no-files-found: ignore
  46. - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
  47. with:
  48. name: preview-${{ matrix.runtime }}
  49. path: |
  50. artifacts/cross-platform/packages/*.tar.gz*
  51. artifacts/cross-platform/packages/*.zip*
  52. artifacts/cross-platform/qa/*.png
  53. artifacts/cross-platform/windows-startup/*
  54. if-no-files-found: error
  55. android:
  56. name: Android arm64 preview APK
  57. runs-on: ubuntu-latest
  58. timeout-minutes: 35
  59. steps:
  60. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
  61. - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68
  62. with:
  63. dotnet-version: 10.0.x
  64. - run: dotnet workload install android --skip-manifest-update
  65. - name: Install matching Android SDK and JDK
  66. 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
  67. - name: Build debug-signed preview APK
  68. shell: pwsh
  69. run: ./tools/Build-CrossPlatform.ps1 -Target android -AndroidSdkDirectory "$env:RUNNER_TEMP/android-sdk" -JavaSdkDirectory "$env:RUNNER_TEMP/jdk"
  70. - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
  71. with:
  72. name: preview-android-arm64
  73. path: artifacts/cross-platform/android-arm64/*-Signed.apk
  74. if-no-files-found: error
  75. ios:
  76. name: iPhone and iPad simulator preview
  77. runs-on: macos-26
  78. timeout-minutes: 40
  79. env:
  80. DEVELOPER_DIR: /Applications/Xcode_26.6.app/Contents/Developer
  81. steps:
  82. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
  83. - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68
  84. with:
  85. dotnet-version: 10.0.401
  86. - name: Install the iOS workload matching Xcode 26.6
  87. run: |
  88. xcodebuild -version
  89. dotnet workload install ios --version 10.0.401
  90. - name: Build simulator application without signing credentials
  91. shell: pwsh
  92. run: ./tools/Build-CrossPlatform.ps1 -Target ios-simulator
  93. - name: Archive simulator application
  94. run: |
  95. app=$(find artifacts/cross-platform -maxdepth 2 -type d -name '*.app' -print -quit)
  96. test -n "$app"
  97. tar -czf artifacts/cross-platform/PCL-Communist-ios-simulator.tar.gz -C "$(dirname "$app")" "$(basename "$app")"
  98. - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
  99. with:
  100. name: preview-ios-simulator
  101. path: artifacts/cross-platform/PCL-Communist-ios-simulator.tar.gz
  102. if-no-files-found: error