From a8404f96d40fbc82bfbf2a4908940824252c711d Mon Sep 17 00:00:00 2001 From: ekneg54 Date: Mon, 9 Sep 2024 11:29:44 +0200 Subject: [PATCH] add rust tests to pipeline --- .github/workflows/testing.yml | 6 ++++++ rust/lib.rs | 10 ++-------- rust/tests/mod.rs | 5 +++++ 3 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 rust/tests/mod.rs diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index c785383f8..fa54b279f 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -4,6 +4,12 @@ on: workflow_call: jobs: + rust: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Perform tests for rust modules + run: cargo test python: runs-on: ubuntu-22.04 strategy: diff --git a/rust/lib.rs b/rust/lib.rs index 963805300..1779a7d5f 100644 --- a/rust/lib.rs +++ b/rust/lib.rs @@ -1,3 +1,5 @@ +#[cfg(test)] +mod tests; use pyo3::prelude::*; /// Formats the sum of two numbers as string. @@ -12,11 +14,3 @@ fn rust(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(sum_as_string, m)?)?; Ok(()) } - -#[cfg(test)] -mod tests { - #[test] - fn it_works() { - assert_eq!("4", "4"); - } -} diff --git a/rust/tests/mod.rs b/rust/tests/mod.rs new file mode 100644 index 000000000..d84a168fa --- /dev/null +++ b/rust/tests/mod.rs @@ -0,0 +1,5 @@ +#[cfg(test)] +#[test] +fn it_works() { + assert_eq!("4", "4"); +}