From b5697d67de725955d3ba0586b0b4a1ef6df0460e Mon Sep 17 00:00:00 2001 From: Kould Date: Tue, 16 Jul 2024 12:00:45 +0800 Subject: [PATCH] chore: add .github --- .github/ISSUE_TEMPLATE/bug-report.md | 22 ++++++++ .github/ISSUE_TEMPLATE/feature-request.md | 19 +++++++ .github/ISSUE_TEMPLATE/question.md | 12 +++++ .github/workflows/ci.yml | 65 +++++++++++++++++++++++ src/inmem/mutable.rs | 42 --------------- 5 files changed, 118 insertions(+), 42 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug-report.md create mode 100644 .github/ISSUE_TEMPLATE/feature-request.md create mode 100644 .github/ISSUE_TEMPLATE/question.md create mode 100644 .github/workflows/ci.yml diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..cc648e9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,22 @@ +--- +name: "\U0001F41B Bug Report" +about: Something isn't working as expected + +--- + +## Bug Report + +**What version of Elsm are you using?** + + +**What version of Rust are you using?** + + +**What's the status of the running?** + +**What did you do?** + + +**What did you expect to see?** + +**What did you see instead?** diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..cb6e994 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,19 @@ +--- +name: "\U0001F680 Feature Request" +about: I have a suggestion + +--- + +## Feature Request + +**Is your feature request related to a problem? Please describe:** + + +**Describe the feature you'd like:** + + +**Describe alternatives you've considered:** + + +**Teachability, Documentation, Adoption, Migration Strategy:** + diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..047e5b0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,12 @@ +--- +name: "\U0001F914 Question" +about: Usage question that isn't answered in docs or discussion + +--- + +## Question + +Before asking a question, make sure you have: + +- Reviewed relevant Rust information: Google your error messages and look at official docs. +- Searched open and closed [GitHub issues](https://github.com/from-the-basement/elsm/issues) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..391f9a7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: CI + +on: + push: + pull_request: + +env: + CARGO_TERM_COLOR: always + CARGO_REGISTRIES_MY_REGISTRY_INDEX: https://github.com/rust-lang/crates.io-index + +jobs: + # 1 + check: + name: Rust project check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install latest + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: rustfmt, clippy + + - name: Install Protoc + uses: arduino/setup-protoc@v2 + + # `cargo check` command here will use installed `nightly` + # as it is set as an "override" for current directory + + - name: Run cargo check + uses: actions-rs/cargo@v1 + with: + command: check + + - name: Run cargo build + uses: actions-rs/cargo@v1 + with: + command: build + + - name: Run cargo test + uses: actions-rs/cargo@v1 + with: + command: test + # 2 + fmt: + name: Rust fmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install latest nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + components: rustfmt, clippy + + # `cargo check` command here will use installed `nightly` + # as it is set as an "override" for current directory + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check diff --git a/src/inmem/mutable.rs b/src/inmem/mutable.rs index 28b66ee..2a59a49 100644 --- a/src/inmem/mutable.rs +++ b/src/inmem/mutable.rs @@ -157,46 +157,4 @@ mod tests { } ) } - - #[test] - fn range() { - let mutable = Mutable::::new(); - - mutable.insert("1".into(), 0_u32.into()); - mutable.insert("2".into(), 0_u32.into()); - mutable.insert("2".into(), 1_u32.into()); - mutable.insert("3".into(), 1_u32.into()); - mutable.insert("4".into(), 0_u32.into()); - - let mut scan = mutable.scan((Bound::Unbounded, Bound::Unbounded), 0_u32.into()); - - assert_eq!( - scan.next().unwrap().key(), - &Timestamped::new("1".into(), 0_u32.into()) - ); - assert_eq!( - scan.next().unwrap().key(), - &Timestamped::new("2".into(), 0_u32.into()) - ); - assert_eq!( - scan.next().unwrap().key(), - &Timestamped::new("4".into(), 0_u32.into()) - ); - - let lower = "1".to_string(); - let upper = "4".to_string(); - let mut scan = mutable.scan( - (Bound::Included(&lower), Bound::Included(&upper)), - 1_u32.into(), - ); - - assert_eq!( - scan.next().unwrap().key(), - &Timestamped::new("2".into(), 1_u32.into()) - ); - assert_eq!( - scan.next().unwrap().key(), - &Timestamped::new("3".into(), 1_u32.into()) - ); - } }