Skip to content

Commit

Permalink
Merge pull request #45 from dzcode-io/44-add-rust-support
Browse files Browse the repository at this point in the history
added blank cargo package
  • Loading branch information
ZibanPirate authored Jan 1, 2024
2 parents b98d673 + 3439504 commit eb6bd07
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 16 deletions.
32 changes: 18 additions & 14 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
# Add 'data' to any changes within '_data' folder or any subfolders
data:
- _data/**/*
- changed-files:
- any-glob-to-any-file: "_data/**"

# Add 'schemas' to any changes within '_schemas' folder or any subfolders
schemas:
- _schemas/**/*
- changed-files:
- any-glob-to-any-file: "_schemas/**"

# Add 'csharp' to any changes within 'csharp' folder or any subfolders
csharp:
- csharp/**/*
- changed-files:
- any-glob-to-any-file: "csharp/**"

# Add 'java' to any changes within 'java' folder or any subfolders
java:
- java/**/*
- changed-files:
- any-glob-to-any-file: "java/**"

# Add 'javascript' to any changes within 'javascript' folder or any subfolders
javascript:
- javascript/**/*
- changed-files:
- any-glob-to-any-file: "javascript/**"

# Add 'php' to any changes within 'php' folder or any subfolders
php:
- php/**/*
- changed-files:
- any-glob-to-any-file: "php/**"

# Add 'python' to any changes within 'python' folder or any subfolders
python:
- python/**/*
- changed-files:
- any-glob-to-any-file: "python/**"

rust:
- changed-files:
- any-glob-to-any-file: "rust/**"
5 changes: 3 additions & 2 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: "Pull Request Labeler"
on:
- pull_request_target
- pull_request

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@main
- uses: actions/checkout@v4
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
26 changes: 26 additions & 0 deletions .github/workflows/rust-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Rust Checks"

on:
pull_request:
paths:
- ".github/workflows/rust-checks.yml"
- "rust/**"

env:
CARGO_TERM_COLOR: always

jobs:
build_and_test:
name: kuliya - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v3
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cd rust && cargo build --verbose
- run: cd rust && cargo test --verbose
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ You can find more about each language by clicking on the language name
| [Python](./python) | n/a | n/a | n/a | n/a |
| [Java](./java) | n/a | n/a | n/a | n/a |
| [C#](./csharp) | n/a | n/a | n/a | n/a |
| [Rust](./rust) | WIP | WIP | WIP | n/a |

## Contributing

Expand Down
1 change: 1 addition & 0 deletions rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
7 changes: 7 additions & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "kuliya"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
13 changes: 13 additions & 0 deletions rust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# kuliya for Rust

Algeria's college hierarchy dataset as Cargo package

# Get started

WIP

# Contribute

Please install Rust compiler using https://rustup.rs/

Feel free to ask for help in [#kuliya](https://dzcode.slack.com/archives/C01C0155CKC) group chat
14 changes: 14 additions & 0 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}

0 comments on commit eb6bd07

Please sign in to comment.