diff --git a/.github/workflows/y-octo-asan.yml b/.github/workflows/y-octo-asan.yml new file mode 100644 index 0000000..24285eb --- /dev/null +++ b/.github/workflows/y-octo-asan.yml @@ -0,0 +1,38 @@ +name: Address Sanitizer + +on: + workflow_dispatch: + push: + branches: [main] + pull_request: + branches: [main] + +# Cancels all previous workflow runs for pull requests that have not completed. +# See https://docs.github.com/en/actions/using-jobs/using-concurrency +concurrency: + # The concurrency group contains the workflow name and the branch name for + # pull requests or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +jobs: + memory_check: + name: memory check + runs-on: ubuntu-latest + continue-on-error: true + env: + RUSTFLAGS: -D warnings -Zsanitizer=address + ASAN_OPTIONS: detect_leaks=1 + CARGO_TERM_COLOR: always + steps: + - uses: actions/checkout@v3 + + - name: Setup Rust + uses: ./.github/actions/setup-rust + with: + toolchain: nightly-2023-08-19 + + - name: Memory Check + run: | + rustup component add rust-src --toolchain nightly-2023-08-19 + cargo +nightly-2023-08-19 test -Zbuild-std --target x86_64-unknown-linux-gnu -p y-octo --lib diff --git a/.github/workflows/y-octo-memory-test.yml b/.github/workflows/y-octo-memory-test.yml new file mode 100644 index 0000000..b86632c --- /dev/null +++ b/.github/workflows/y-octo-memory-test.yml @@ -0,0 +1,40 @@ +name: Memory Leak Detect + +on: + workflow_dispatch: + push: + branches: [main] + pull_request: + branches: [main] + +# Cancels all previous workflow runs for pull requests that have not completed. +# See https://docs.github.com/en/actions/using-jobs/using-concurrency +concurrency: + # The concurrency group contains the workflow name and the branch name for + # pull requests or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +jobs: + miri: + name: miri code check + runs-on: ubuntu-latest + continue-on-error: true + env: + RUST_BACKTRACE: full + CARGO_TERM_COLOR: always + MIRIFLAGS: -Zmiri-backtrace=full -Zmiri-tree-borrows + steps: + - uses: actions/checkout@v3 + + - name: Setup Rust + uses: ./.github/actions/setup-rust + with: + toolchain: nightly-2023-08-19 + components: miri + - name: Install latest nextest release + uses: taiki-e/install-action@nextest + + - name: Miri Code Check + run: | + cargo +nightly-2023-08-19 miri nextest run -p y-octo -j2 diff --git a/.github/workflows/y-octo.yml b/.github/workflows/y-octo.yml index a1b9722..fd72c5f 100644 --- a/.github/workflows/y-octo.yml +++ b/.github/workflows/y-octo.yml @@ -1,4 +1,4 @@ -name: Build Y-Octo +name: Lint & Test & Fuzzing on: workflow_dispatch: @@ -95,27 +95,6 @@ jobs: name: tests files: lcov.info - memory_check: - name: memory check - runs-on: ubuntu-latest - continue-on-error: true - env: - RUSTFLAGS: -D warnings -Zsanitizer=address - ASAN_OPTIONS: detect_leaks=1 - CARGO_TERM_COLOR: always - steps: - - uses: actions/checkout@v3 - - - name: Setup Rust - uses: ./.github/actions/setup-rust - with: - toolchain: nightly-2023-08-19 - - - name: Memory Check - run: | - rustup component add rust-src --toolchain nightly-2023-08-19 - cargo +nightly-2023-08-19 test -Zbuild-std --target x86_64-unknown-linux-gnu -p y-octo --lib - loom: name: loom thread test runs-on: ubuntu-latest @@ -136,29 +115,6 @@ jobs: run: | cargo nextest run -p y-octo --lib - miri: - name: miri code check - runs-on: ubuntu-latest - continue-on-error: true - env: - RUST_BACKTRACE: full - CARGO_TERM_COLOR: always - MIRIFLAGS: -Zmiri-backtrace=full -Zmiri-tree-borrows - steps: - - uses: actions/checkout@v3 - - - name: Setup Rust - uses: ./.github/actions/setup-rust - with: - toolchain: nightly-2023-08-19 - components: miri - - name: Install latest nextest release - uses: taiki-e/install-action@nextest - - - name: Miri Code Check - run: | - cargo +nightly-2023-08-19 miri nextest run -p y-octo -j2 - fuzzing: name: fuzzing runs-on: ubuntu-latest diff --git a/README.md b/README.md index c3cbc2c..cf8c002 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,87 @@ # Y-Octo -[![codecov]](https://codecov.io/gh/toeverything/y-octo) +[![docs]](https://docs.rs/crate/y-octo) +[![crates]](https://crates.io/crates/y-octo) Y-Octo is a high-performance CRDT implementation compatible with [yjs]. -Y-Octo aims to provide a thread-safe, high-performance CRDT implementation on multiple platforms and offers binary compatibility and interoperability with [yjs]. +### Introduction + +Y-Octo is a tiny, ultra-fast CRDT collaboration library built for all major platforms. Developers can use Y-Octo as the [Single source of truth](https://en.wikipedia.org/wiki/Single_source_of_truth) for their application state, naturally turning the application into a [local-first](https://www.inkandswitch.com/local-first/) collaborative app. + +Y-Octo also has interoperability and binary compatibility with [yjs]. Developers can use [yjs] to develop local-first web applications and collaborate with Y-Octo in native apps alongside web apps. + +### Code Robustness + +[![Lint & Test & Fuzzing]](https://github.com/toeverything/y-octo/actions/workflows/y-octo.yml) +[![Address Sanitizer]](https://github.com/toeverything/y-octo/actions/workflows/asan.yml) +[![Memory Leak Detect]](https://github.com/toeverything/y-octo/actions/workflows/memory-test.yml) +[![codecov]](https://codecov.io/gh/toeverything/y-octo) + +### Features + +- βœ… Collaborative Text + - βœ… Read and write styled Unicode compatible data. + - 🚧 Add, modify and delete text styles. + - 🚧 Embedded JS data types and collaborative types. + - βœ… Collaborative types of thread-safe. +- Collaborative Array + - βœ… Add, modify, and delete basic JS data types. + - βœ… Recursively add, modify, and delete collaborative types. + - βœ… Collaborative types of thread-safe. + - 🚧 Recursive event subscription +- Collaborative Map + - βœ… Add, modify, and delete basic JS data types. + - βœ… Recursively add, modify, and delete collaborative types. + - βœ… Collaborative types of thread-safe. + - 🚧 Recursive event subscription +- 🚧 Collaborative Xml (Fragment / Element) +- βœ… Collaborative Doc Container + - βœ… YATA CRDT state apply/diff compatible with [yjs] + - βœ… State sync of thread-safe. + - βœ… Store all collaborative types and JS data types + - βœ… Update event subscription. + - 🚧 Sub Document. +- βœ… Yjs binary encoding + - βœ… Awareness encoding. + - βœ… Primitive type encoding. + - βœ… Sync Protocol encoding. + - βœ… Yjs update v1 encoding. + - 🚧 Yjs update v2 encoding. + +### Testing & Linting + +Put everything to the test! We've established various test suites, but we're continually striving to enhance our coverage: + +- Rust Tests +- Node Tests +- Smoke Tests +- eslint, clippy + +### Related projects + +- [OctoBase]: The open-source embedded database based on Y-Octo. +- [yjs]: Shared data types for building collaborative software in web. + +## Maintainers + +- [DarkSky](https://github.com/darkskygit) +- [liuyi](https://github.com/forehalo) +- [X1a0t](https://github.com/thorseraq) +- [LongYinan](https://github.com/Brooooooklyn) + +## License + +Y-Octo are [MIT licensed]. [codecov]: https://codecov.io/gh/toeverything/y-octo/graph/badge.svg?token=9AQY5Q1BYH +[crates]: https://img.shields.io/crates/v/y-octo.svg +[docs]: https://img.shields.io/crates/v/y-octo.svg [yjs]: https://github.com/yjs/yjs +[Lint & Test & Fuzzing]: https://github.com/toeverything/y-octo/actions/workflows/y-octo.yml/badge.svg +[Address Sanitizer]: https://github.com/toeverything/y-octo/actions/workflows/y-octo-asan.yml/badge.svg +[Memory Leak Detect]: https://github.com/toeverything/y-octo/actions/workflows/y-octo-memory-test.yml/badge.svg +[OctoBase]: https://github.com/toeverything/octobase +[BlockSuite]: https://github.com/toeverything/blocksuite +[AFFiNE]: https://github.com/toeverything/affine +[MIT licensed]: ./LICENSE