rust_ci.yaml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.70"
  22. FLUTTER_VERSION: "3.10.1"
  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: 'ubuntu-latest'
  52. workspaces: |
  53. frontend/rust-lib
  54. - name: Build FlowySDK
  55. working-directory: frontend
  56. run: |
  57. cargo make --profile development-linux-x86_64 appflowy-core-dev
  58. - name: Run rust-lib tests
  59. working-directory: frontend/rust-lib
  60. run: RUST_LOG=info RUST_BACKTRACE=1 cargo test --no-default-features --features="rev-sqlite"
  61. - name: rustfmt rust-lib
  62. run: cargo fmt --all -- --check
  63. working-directory: frontend/rust-lib/
  64. - name: clippy rust-lib
  65. run: cargo clippy --features="rev-sqlite"
  66. working-directory: frontend/rust-lib
  67. - name: rustfmt shared-lib
  68. run: cargo fmt --all -- --check
  69. working-directory: shared-lib
  70. - name: clippy shared-lib
  71. run: cargo clippy -- -D warnings
  72. working-directory: shared-lib
  73. - name: Run shared-lib tests
  74. working-directory: shared-lib
  75. run: RUST_LOG=info cargo test --no-default-features