feat: basic workflows for rust

This commit is contained in:
sevki 2024-03-15 09:15:41 +00:00 committed by Sevki
parent 95e3bbd6bf
commit 1ef3ed6d79
5 changed files with 62 additions and 0 deletions

18
.github/workflows/release-please.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: Release Please
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
release-type: rust

21
.github/workflows/rust.yml vendored Normal file
View file

@ -0,0 +1,21 @@
name: Rust
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

8
Cargo.toml Normal file
View file

@ -0,0 +1,8 @@
[package]
name = "okrust"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

14
src/lib.rs Normal file
View file

@ -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);
}
}