flutter_ci.yaml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. concurrency:
  25. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  26. cancel-in-progress: true
  27. jobs:
  28. build:
  29. if: github.event.pull_request.draft != true
  30. strategy:
  31. fail-fast: false
  32. matrix:
  33. os: [ubuntu-latest, macos-latest, windows-latest]
  34. include:
  35. - os: ubuntu-latest
  36. flutter_profile: development-linux-x86_64
  37. target: x86_64-unknown-linux-gnu
  38. - os: macos-latest
  39. flutter_profile: development-mac-x86_64
  40. target: x86_64-apple-darwin
  41. - os: windows-latest
  42. flutter_profile: development-windows-x86
  43. target: x86_64-pc-windows-msvc
  44. runs-on: ${{ matrix.os }}
  45. steps:
  46. - name: Checkout source code
  47. uses: actions/checkout@v2
  48. - name: Install Rust toolchain
  49. id: rust_toolchain
  50. uses: actions-rs/toolchain@v1
  51. with:
  52. toolchain: ${{ env.RUST_TOOLCHAIN }}
  53. target: ${{ matrix.target }}
  54. override: true
  55. profile: minimal
  56. - name: Install flutter
  57. id: flutter
  58. uses: subosito/flutter-action@v2
  59. with:
  60. channel: "stable"
  61. flutter-version: ${{ env.FLUTTER_VERSION }}
  62. cache: true
  63. - uses: Swatinem/rust-cache@v2
  64. with:
  65. prefix-key: ${{ matrix.os }}
  66. workspaces: |
  67. frontend/rust-lib
  68. - uses: davidB/rust-cargo-make@v1
  69. with:
  70. version: '0.36.6'
  71. - name: Install prerequisites
  72. working-directory: frontend
  73. run: |
  74. cargo install --force duckscript_cli
  75. if [ "$RUNNER_OS" == "Linux" ]; then
  76. sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
  77. sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
  78. sudo apt-get update
  79. sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev
  80. sudo apt-get install keybinder-3.0
  81. elif [ "$RUNNER_OS" == "Windows" ]; then
  82. vcpkg integrate install
  83. elif [ "$RUNNER_OS" == "macOS" ]; then
  84. echo 'do nothing'
  85. fi
  86. cargo make appflowy-flutter-deps-tools
  87. shell: bash
  88. - name: Enable Flutter Desktop
  89. run: |
  90. if [ "$RUNNER_OS" == "Linux" ]; then
  91. flutter config --enable-linux-desktop
  92. elif [ "$RUNNER_OS" == "macOS" ]; then
  93. flutter config --enable-macos-desktop
  94. elif [ "$RUNNER_OS" == "Windows" ]; then
  95. git config --system core.longpaths true
  96. flutter config --enable-windows-desktop
  97. fi
  98. shell: bash
  99. - name: Build AppFlowy
  100. working-directory: frontend
  101. run: |
  102. cargo make --profile ${{ matrix.flutter_profile }} appflowy-dev
  103. - name: Flutter Analyzer
  104. working-directory: frontend/appflowy_flutter
  105. run: |
  106. flutter analyze .
  107. - name: Run Flutter unit tests
  108. working-directory: frontend
  109. run: |
  110. cargo make dart_unit_test
  111. - name: Upload coverage to Codecov
  112. uses: Wandalen/[email protected]
  113. with:
  114. action: codecov/codecov-action@v3
  115. with: |
  116. name: appflowy
  117. flags: appflowy_flutter_unit_test
  118. fail_ci_if_error: true
  119. verbose: true
  120. os: ${{ matrix.os }}
  121. attempt_limit: 5
  122. attempt_delay: 10000