rust_ci.yaml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. name: Rust-CI
  2. on:
  3. push:
  4. branches:
  5. - "main"
  6. - "develop"
  7. - "release/*"
  8. paths:
  9. - "frontend/rust-lib/**"
  10. - "shared-lib/**"
  11. pull_request:
  12. branches:
  13. - "main"
  14. - "develop"
  15. - "release/*"
  16. paths:
  17. - "frontend/rust-lib/**"
  18. - "shared-lib/**"
  19. env:
  20. CARGO_TERM_COLOR: always
  21. RUST_TOOLCHAIN: "1.65"
  22. FLUTTER_VERSION: "3.7.5"
  23. jobs:
  24. test-on-ubuntu:
  25. runs-on: ubuntu-latest
  26. steps:
  27. - name: Checkout source code
  28. uses: actions/checkout@v2
  29. - name: Install Rust toolchain
  30. id: rust_toolchain
  31. uses: actions-rs/toolchain@v1
  32. with:
  33. toolchain: ${{ env.RUST_TOOLCHAIN }}
  34. override: true
  35. components: rustfmt, clippy
  36. profile: minimal
  37. - name: Install flutter
  38. id: flutter
  39. uses: subosito/flutter-action@v2
  40. with:
  41. channel: "stable"
  42. flutter-version: ${{ env.FLUTTER_VERSION }}
  43. cache: true
  44. - name: Install prerequisites
  45. working-directory: frontend
  46. run: |
  47. cargo install --force cargo-make
  48. cargo install --force duckscript_cli
  49. - uses: Swatinem/rust-cache@v2
  50. with:
  51. prefix-key: ${{ matrix.job.os }}
  52. - name: Build FlowySDK
  53. working-directory: frontend
  54. run: |
  55. cargo make --profile development-linux-x86_64 appflowy-core-dev
  56. - name: rustfmt rust-lib
  57. run: cargo fmt --all -- --check
  58. working-directory: frontend/rust-lib/
  59. - name: clippy rust-lib
  60. run: cargo clippy --features="rev-sqlite"
  61. working-directory: frontend/rust-lib
  62. - name: Run rust-lib tests
  63. working-directory: frontend/rust-lib
  64. run: RUST_LOG=info cargo test --no-default-features --features="rev-sqlite"
  65. - name: rustfmt shared-lib
  66. run: cargo fmt --all -- --check
  67. working-directory: shared-lib
  68. - name: clippy shared-lib
  69. run: cargo clippy -- -D warnings
  70. working-directory: shared-lib
  71. - name: Run shared-lib tests
  72. working-directory: shared-lib
  73. run: RUST_LOG=info cargo test --no-default-features