flutter_ci.yaml 3.4 KB

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