Skip to content

Commit

Permalink
auto-update readme of crate
Browse files Browse the repository at this point in the history
  • Loading branch information
ZibanPirate committed Nov 21, 2024
1 parent 3832fb3 commit 3c63547
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 26 deletions.
39 changes: 24 additions & 15 deletions .github/workflows/rust-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,29 @@ jobs:
build_and_test:
name: kuliya - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
env:
CWD: "rust"
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }}
- run: rustup default ${{ matrix.toolchain }}
- run: rustup component add clippy
- run: cd rust && cargo clippy --all-features -- -Dwarnings
- run: cd rust && cargo build --verbose
- run: cd rust && cargo test --verbose
- run: cd rust && cargo test --verbose --lib --bins --tests --features serde_derive
- run: cd rust && cargo test --verbose --lib --bins --tests --no-default-features --features storage
- run: cd rust && cargo test --verbose --all-features
with:
fetch-depth: 0
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- run: cargo install cargo-readme
- run: cargo readme > README.md
working-directory: ${{ env.CWD }}
- run: cargo clippy --all-features -- -Dwarnings
working-directory: ${{ env.CWD }}
- run: cargo build --verbose
working-directory: ${{ env.CWD }}
- name: "is docs updated and generated files are committed"
run: exit $(git status --porcelain | wc -l)
- run: cargo test --verbose
working-directory: ${{ env.CWD }}
- run: cargo test --verbose --lib --bins --tests --features serde_derive
working-directory: ${{ env.CWD }}
- run: cargo test --verbose --lib --bins --tests --no-default-features --features storage
working-directory: ${{ env.CWD }}
- run: cargo test --verbose --all-features
working-directory: ${{ env.CWD }}
8 changes: 4 additions & 4 deletions .github/workflows/rust-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
name: cargo publish
runs-on: ubuntu-latest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
CWD: "rust"
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
CWD: "rust"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo test --all-features
working-directory: ${{ env.CWD }}
- run: cargo publish
working-directory: ${{ env.CWD }}
25 changes: 18 additions & 7 deletions rust/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# kuliya for Rust
# kuliya

Algeria's college hierarchy dataset as Cargo package
Algeria's college hierarchy dataset as a crate with useful APIs.

# Get started
Example

WIP
```rust
use kuliya::r#static::api::get_node_by_path;

# Contribute
let faculty_of_science_and_technology = get_node_by_path("umkb/fst");

Please install Rust compiler using https://rustup.rs/
assert_eq!(faculty_of_science_and_technology.is_some(), true);

Feel free to ask for help in [#kuliya](https://dzcode.slack.com/archives/C01C0155CKC) group chat
let faculty_of_science_and_technology = faculty_of_science_and_technology.unwrap();

assert_eq!(faculty_of_science_and_technology.name.ar, "كلية العلوم والتكنلوجيا");

// when the path is not found, the function returns None
let non_existing_node = get_node_by_path("umkb/fst/unknown");

assert_eq!(non_existing_node.is_none(), true);
```

License: MIT

0 comments on commit 3c63547

Please sign in to comment.