flutter_ci.yaml 4.0 KB

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