Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add workflow support #2

Merged
merged 8 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[env]
CARGO_WORKSPACE_DIR = { value = "", relative = true }

[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "target-cpu=native"]
10 changes: 10 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This is used for tracking in GitHub project.
# See https://github.com/marketplace/actions/auto-assign-action

# Set to true to add reviewers to pull requests
addReviewers: false

# Set to true to add assignees to pull requests
addAssignees: author

runOnDraft: true
193 changes: 193 additions & 0 deletions .github/workflows/yocto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
name: Build Y-Octo

on:
workflow_dispatch:
push:
branches: [master]
paths:
- "Cargo.toml"
- "packages/**"
- ".github/workflows/yocto.yml"
pull_request:
branches: [master]
paths:
- "Cargo.toml"
- "packages/**"
- ".github/workflows/yocto.yml"

# 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:
lint:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
override: true

- uses: Swatinem/rust-cache@v2

- name: Install required cargo components
uses: taiki-e/install-action@v2
with:
tool: clippy-sarif,sarif-fmt

- name: Build & Check
run: |
cargo vendor > .cargo/config
cargo clippy --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
RUSTDOCFLAGS="-D rustdoc::broken-intra-doc-links" cargo doc --workspace --all-features --no-deps
env:
CARGO_TERM_COLOR: always

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true

test:
name: test & collect coverage
runs-on: ubuntu-latest
continue-on-error: true
env:
RUSTFLAGS: -D warnings
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2

- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Collect coverage data
run: cargo llvm-cov nextest --lcov --output-path lcov.info
- name: Upload coverage data to codecov
uses: codecov/codecov-action@v3
with:
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
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2023-08-19
- uses: Swatinem/rust-cache@v2

- 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
continue-on-error: true
env:
RUSTFLAGS: --cfg loom
RUST_BACKTRACE: full
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Install latest nextest release
uses: taiki-e/install-action@nextest

- name: Loom Thread Test
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
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2023-08-19
components: miri
- uses: Swatinem/rust-cache@v2

- 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
continue-on-error: true
env:
RUSTFLAGS: -D warnings
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-08-19
- uses: Swatinem/rust-cache@v2

- name: fuzzing
working-directory: ./packages/y-octo
run: |
cargo install cargo-fuzz
cargo +nightly-2023-08-19 fuzz run apply_update -- -max_total_time=30
cargo +nightly-2023-08-19 fuzz run codec_doc_any_struct -- -max_total_time=30
cargo +nightly-2023-08-19 fuzz run codec_doc_any -- -max_total_time=30
cargo +nightly-2023-08-19 fuzz run decode_bytes -- -max_total_time=30
cargo +nightly-2023-08-19 fuzz run i32_decode -- -max_total_time=30
cargo +nightly-2023-08-19 fuzz run i32_encode -- -max_total_time=30
cargo +nightly-2023-08-19 fuzz run ins_del_text -- -max_total_time=30
cargo +nightly-2023-08-19 fuzz run sync_message -- -max_total_time=30
cargo +nightly-2023-08-19 fuzz run u64_decode -- -max_total_time=30
cargo +nightly-2023-08-19 fuzz run u64_encode -- -max_total_time=30
cargo +nightly-2023-08-19 fuzz run apply_update -- -max_total_time=30

- name: upload fuzz artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: fuzz-artifact
path: ./packages/y-octo/fuzz/artifacts/**/*
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Y-Octo

Y-Octo is a high-performance CRDT implementation compatible with [yjs](https://github.com/yjs/yjs).
[![codecov]](https://codecov.io/gh/toeverything/y-octo)

Y-Octo aims to provide a thread-safe, high-performance CRDT implementation on multiple platforms and offers binary compatibility and interoperability with [yjs](https://github.com/yjs/yjs).
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].

[codecov]: https://codecov.io/gh/toeverything/y-octo/graph/badge.svg?token=9AQY5Q1BYH
[yjs]: https://github.com/yjs/yjs
6 changes: 3 additions & 3 deletions packages/y-octo/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "jwst-codec-fuzz"
name = "y-octo-fuzz"
version = "0.0.0"
publish = false
edition = "2021"
Expand All @@ -14,9 +14,9 @@ libfuzzer-sys = "0.4.6"
lib0 = "0.16.5"
yrs = "0.16.5"

jwst-codec-util = { path = "../../jwst-codec-util" }
y-octo-utils = { path = "../../y-octo-utils" }

[dependencies.jwst-codec]
[dependencies.y-octo]
path = ".."

# Prevent this from interfering with workspaces
Expand Down
1 change: 1 addition & 0 deletions packages/y-octo/src/doc/common/somr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ impl<T> Somr<T> {
}
}

#[allow(dead_code)]
pub fn get_mut(&self) -> Option<&mut T> {
if !self.is_owned() || self.dangling() {
return None;
Expand Down
Loading