From eb7c784a8a15f3dcbd2598ba48a8f5d2429045e2 Mon Sep 17 00:00:00 2001 From: Aron Zwaan Date: Fri, 24 May 2024 15:21:04 +0200 Subject: [PATCH 1/2] Test examples in CI [build should fail on purpose] --- .github/workflows/rust.yml | 12 ++++++++++++ scopegraphs/examples/records.rs | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 23e1acd..dbc76ca 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -76,6 +76,12 @@ jobs: command: test args: --all-features + - name: Run cargo examples tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features --examples + test-stable: name: Test Stable runs-on: ubuntu-latest @@ -92,3 +98,9 @@ jobs: with: command: test args: --all-features + + - name: Run cargo examples tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features --examples diff --git a/scopegraphs/examples/records.rs b/scopegraphs/examples/records.rs index 226bf38..3061655 100644 --- a/scopegraphs/examples/records.rs +++ b/scopegraphs/examples/records.rs @@ -817,3 +817,12 @@ in a.b.a.x; Ok(()) } + +#[cfg(test)] +mod tests { + + #[test] + pub fn test_fail() { + panic!("test in example!") + } +} From fe898787822ee9813bcabc3495a4c242a20516ef Mon Sep 17 00:00:00 2001 From: Aron Zwaan Date: Fri, 24 May 2024 15:23:06 +0200 Subject: [PATCH 2/2] Also add tests for nightly, remove failing test --- .github/workflows/rust.yml | 6 ++++++ scopegraphs/examples/records.rs | 9 --------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index dbc76ca..3743a20 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -59,6 +59,12 @@ jobs: command: test args: --all-features + - name: Run cargo examples tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features --examples + test-beta: name: Test Beta runs-on: ubuntu-latest diff --git a/scopegraphs/examples/records.rs b/scopegraphs/examples/records.rs index 3061655..226bf38 100644 --- a/scopegraphs/examples/records.rs +++ b/scopegraphs/examples/records.rs @@ -817,12 +817,3 @@ in a.b.a.x; Ok(()) } - -#[cfg(test)] -mod tests { - - #[test] - pub fn test_fail() { - panic!("test in example!") - } -}