cross-platform.yml 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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-latest
  71. timeout-minutes: 40
  72. steps:
  73. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
  74. - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68
  75. with:
  76. dotnet-version: 10.0.x
  77. - run: dotnet workload install ios --skip-manifest-update
  78. - name: Build simulator application without signing credentials
  79. shell: pwsh
  80. run: ./tools/Build-CrossPlatform.ps1 -Target ios-simulator
  81. - name: Archive simulator application
  82. run: |
  83. app=$(find artifacts/cross-platform -maxdepth 2 -type d -name '*.app' -print -quit)
  84. test -n "$app"
  85. tar -czf artifacts/cross-platform/PCL-Communist-ios-simulator.tar.gz -C "$(dirname "$app")" "$(basename "$app")"
  86. - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
  87. with:
  88. name: preview-ios-simulator
  89. path: artifacts/cross-platform/PCL-Communist-ios-simulator.tar.gz
  90. if-no-files-found: error