flutter_ci.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. name: Flutter-CI
  2. on:
  3. push:
  4. branches:
  5. - "main"
  6. - "develop"
  7. - "release/*"
  8. paths:
  9. - ".github/workflows/flutter_ci.yaml"
  10. - "frontend/**"
  11. - "!frontend/appflowy_tauri/**"
  12. pull_request:
  13. branches:
  14. - "main"
  15. - "develop"
  16. - "release/*"
  17. paths:
  18. - ".github/workflows/flutter_ci.yaml"
  19. - "frontend/**"
  20. - "!frontend/appflowy_tauri/**"
  21. env:
  22. FLUTTER_VERSION: "3.10.1"
  23. RUST_TOOLCHAIN: "1.65"
  24. jobs:
  25. build:
  26. strategy:
  27. fail-fast: false
  28. matrix:
  29. os: [ubuntu-latest, macos-latest, windows-latest]
  30. include:
  31. - os: ubuntu-latest
  32. flutter_profile: development-linux-x86_64
  33. target: x86_64-unknown-linux-gnu
  34. - os: macos-latest
  35. flutter_profile: development-mac-x86_64
  36. target: x86_64-apple-darwin
  37. - os: windows-latest
  38. flutter_profile: development-windows-x86
  39. target: x86_64-pc-windows-msvc
  40. runs-on: ${{ matrix.os }}
  41. steps:
  42. - name: Checkout source code
  43. uses: actions/checkout@v2
  44. - name: Install Rust toolchain
  45. id: rust_toolchain
  46. uses: actions-rs/toolchain@v1
  47. with:
  48. toolchain: ${{ env.RUST_TOOLCHAIN }}
  49. target: ${{ matrix.target }}
  50. override: true
  51. profile: minimal
  52. - name: Install flutter
  53. id: flutter
  54. uses: subosito/flutter-action@v2
  55. with:
  56. channel: "stable"
  57. flutter-version: ${{ env.FLUTTER_VERSION }}
  58. cache: true
  59. - uses: Swatinem/rust-cache@v2
  60. with:
  61. prefix-key: ${{ matrix.job.os }}
  62. - name: Install prerequisites
  63. working-directory: frontend
  64. run: |
  65. cargo install --force cargo-make
  66. cargo install --force duckscript_cli
  67. if [ "$RUNNER_OS" == "Linux" ]; then
  68. sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
  69. sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
  70. sudo apt-get update
  71. sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev
  72. sudo apt-get install keybinder-3.0
  73. elif [ "$RUNNER_OS" == "Windows" ]; then
  74. vcpkg integrate install
  75. elif [ "$RUNNER_OS" == "macOS" ]; then
  76. echo 'do nothing'
  77. fi
  78. cargo make appflowy-flutter-deps-tools
  79. shell: bash
  80. - name: Enable Flutter Desktop
  81. run: |
  82. if [ "$RUNNER_OS" == "Linux" ]; then
  83. flutter config --enable-linux-desktop
  84. elif [ "$RUNNER_OS" == "macOS" ]; then
  85. flutter config --enable-macos-desktop
  86. elif [ "$RUNNER_OS" == "Windows" ]; then
  87. git config --system core.longpaths true
  88. flutter config --enable-windows-desktop
  89. fi
  90. shell: bash
  91. - name: Build AppFlowy
  92. working-directory: frontend
  93. run: |
  94. cargo make --profile ${{ matrix.flutter_profile }} appflowy-dev
  95. - name: Flutter Analyzer
  96. working-directory: frontend/appflowy_flutter
  97. run: |
  98. flutter analyze .
  99. - name: Run Flutter unit tests
  100. working-directory: frontend
  101. run: |
  102. cargo make dart_unit_test