flutter_ci.yaml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. # the following step is required to avoid running out of space
  47. - name: Maximize build space
  48. if: matrix.os == 'ubuntu-latest'
  49. run: |
  50. sudo rm -rf /usr/share/dotnet
  51. sudo rm -rf /opt/ghc
  52. sudo rm -rf "/usr/local/share/boost"
  53. sudo rm -rf "$AGENT_TOOLSDIRECTORY"
  54. - name: Checkout source code
  55. uses: actions/checkout@v2
  56. - name: Install Rust toolchain
  57. id: rust_toolchain
  58. uses: actions-rs/toolchain@v1
  59. with:
  60. toolchain: ${{ env.RUST_TOOLCHAIN }}
  61. target: ${{ matrix.target }}
  62. override: true
  63. profile: minimal
  64. - name: Install flutter
  65. id: flutter
  66. uses: subosito/flutter-action@v2
  67. with:
  68. channel: "stable"
  69. flutter-version: ${{ env.FLUTTER_VERSION }}
  70. cache: true
  71. - uses: Swatinem/rust-cache@v2
  72. with:
  73. prefix-key: ${{ matrix.os }}
  74. workspaces: |
  75. frontend/rust-lib
  76. - uses: davidB/rust-cargo-make@v1
  77. with:
  78. version: '0.36.6'
  79. - name: Install prerequisites
  80. working-directory: frontend
  81. run: |
  82. cargo install --force duckscript_cli
  83. if [ "$RUNNER_OS" == "Linux" ]; then
  84. sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
  85. sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
  86. sudo apt-get update
  87. sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev
  88. sudo apt-get install keybinder-3.0 libnotify-dev
  89. elif [ "$RUNNER_OS" == "Windows" ]; then
  90. vcpkg integrate install
  91. elif [ "$RUNNER_OS" == "macOS" ]; then
  92. echo 'do nothing'
  93. fi
  94. cargo make appflowy-flutter-deps-tools
  95. shell: bash
  96. - name: Enable Flutter Desktop
  97. run: |
  98. if [ "$RUNNER_OS" == "Linux" ]; then
  99. flutter config --enable-linux-desktop
  100. elif [ "$RUNNER_OS" == "macOS" ]; then
  101. flutter config --enable-macos-desktop
  102. elif [ "$RUNNER_OS" == "Windows" ]; then
  103. git config --system core.longpaths true
  104. flutter config --enable-windows-desktop
  105. fi
  106. shell: bash
  107. - name: Build AppFlowy
  108. working-directory: frontend
  109. run: |
  110. cargo make --profile ${{ matrix.flutter_profile }} appflowy-dev
  111. - name: Flutter Analyzer
  112. working-directory: frontend/appflowy_flutter
  113. run: |
  114. flutter analyze .
  115. - name: Run Flutter unit tests
  116. working-directory: frontend
  117. run: |
  118. cargo make dart_unit_test
  119. - name: Upload coverage to Codecov
  120. uses: Wandalen/[email protected]
  121. with:
  122. action: codecov/codecov-action@v3
  123. with: |
  124. name: appflowy
  125. flags: appflowy_flutter_unit_test
  126. fail_ci_if_error: true
  127. verbose: true
  128. os: ${{ matrix.os }}
  129. token: ${{ secrets.CODECOV_TOKEN }}
  130. attempt_limit: 20
  131. attempt_delay: 10000