flutter_ci.yaml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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.70"
  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.os }}
  62. workspaces: |
  63. frontend/rust-lib
  64. - uses: davidB/rust-cargo-make@v1
  65. with:
  66. version: '0.36.6'
  67. - name: Install prerequisites
  68. working-directory: frontend
  69. run: |
  70. cargo install --force duckscript_cli
  71. if [ "$RUNNER_OS" == "Linux" ]; then
  72. sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
  73. sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
  74. sudo apt-get update
  75. sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev
  76. sudo apt-get install keybinder-3.0
  77. elif [ "$RUNNER_OS" == "Windows" ]; then
  78. vcpkg integrate install
  79. elif [ "$RUNNER_OS" == "macOS" ]; then
  80. echo 'do nothing'
  81. fi
  82. cargo make appflowy-flutter-deps-tools
  83. shell: bash
  84. - name: Enable Flutter Desktop
  85. run: |
  86. if [ "$RUNNER_OS" == "Linux" ]; then
  87. flutter config --enable-linux-desktop
  88. elif [ "$RUNNER_OS" == "macOS" ]; then
  89. flutter config --enable-macos-desktop
  90. elif [ "$RUNNER_OS" == "Windows" ]; then
  91. git config --system core.longpaths true
  92. flutter config --enable-windows-desktop
  93. fi
  94. shell: bash
  95. - name: Build AppFlowy
  96. working-directory: frontend
  97. run: |
  98. cargo make --profile ${{ matrix.flutter_profile }} appflowy-dev
  99. - name: Flutter Analyzer
  100. working-directory: frontend/appflowy_flutter
  101. run: |
  102. flutter analyze .
  103. - name: Run Flutter unit tests
  104. working-directory: frontend
  105. run: |
  106. cargo make dart_unit_test
  107. - uses: codecov/codecov-action@v3
  108. with:
  109. name: appflowy
  110. flags: appflowy_flutter_unit_test
  111. fail_ci_if_error: true
  112. verbose: true