rust_ci.yaml 2.1 KB

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