Skip to content

Commit 410e098

Browse files
committed
Run example tests under "other" in CI
1 parent 719a9b6 commit 410e098

6 files changed

Lines changed: 42 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ jobs:
3838
[
3939
cargo-dylint,
4040
cargo-dylint-cargo-lib,
41-
dylint_examples,
4241
expensive-alpine,
4342
expensive-boundary_toolchains,
4443
expensive-custom_toolchain,
@@ -94,6 +93,7 @@ jobs:
9493
cargo install cargo-supply-chain || true
9594
cargo install cargo-udeps --locked || true
9695
cargo install cargo-unmaintained || true
96+
cargo install nested_workspace || true
9797
cargo install rustdoc-prettier || true
9898
go install github.com/rhysd/actionlint/cmd/actionlint@latest
9999
@@ -158,7 +158,9 @@ jobs:
158158
fi
159159
cargo test -p "$PACKAGE" "$TEST" -- --nocapture
160160
else
161-
cargo test --all-features --workspace --exclude cargo-dylint --exclude dylint_examples --exclude expensive --exclude scheduled -- --nocapture
161+
cargo nw fetch
162+
163+
cargo test --all-features --workspace --exclude cargo-dylint --exclude expensive --exclude scheduled -- --nocapture
162164
163165
pushd driver
164166
cargo test --all-features -- --nocapture

Cargo.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ hex = "0.4"
4141
home = "=0.5.9"
4242
if_chain = "1.0"
4343
log = "0.4"
44+
nested_workspace = "0.3"
4445
once_cell = "1.21"
4546
predicates = "3.1"
4647
regex = "1.11"

examples/Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ edition = "2024"
66
license = "MIT OR Apache-2.0"
77
publish = false
88

9+
[build-dependencies]
10+
nested_workspace = { workspace = true }
11+
912
[dev-dependencies]
1013
cargo-util = { workspace = true }
1114
cargo_metadata = { workspace = true }
15+
nested_workspace = { workspace = true }
1216
toml = { workspace = true }
1317
toml_edit = { workspace = true }
1418
walkdir = { workspace = true }
@@ -20,3 +24,15 @@ dylint_internal = { version = "=4.1.0", path = "../internal", features = [
2024

2125
[lints]
2226
workspace = true
27+
28+
[package.metadata.nested_workspace]
29+
roots = [
30+
"general",
31+
"supplementary",
32+
"restriction",
33+
"testing/clippy",
34+
"testing/straggler",
35+
"experimental/derive_opportunity",
36+
"experimental/missing_doc_comment_openai",
37+
"experimental/overscoped_allow",
38+
]

examples/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
nested_workspace::build().unwrap();
3+
}

examples/src/lib.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
11
#[cfg(all(not(coverage), test))]
22
mod test {
33
use cargo_metadata::MetadataCommand;
4-
use dylint_internal::{
5-
CommandExt, clippy_utils::toolchain_channel, examples::iter, rustup::SanitizeEnvironment,
6-
};
4+
use dylint_internal::{CommandExt, clippy_utils::toolchain_channel, examples::iter};
75
use std::{ffi::OsStr, fs::read_to_string, process::Command};
86
use toml_edit::{DocumentMut, Item};
97
use walkdir::WalkDir;
108

119
#[test]
1210
fn examples() {
13-
for path in iter(false).unwrap() {
14-
let path = path.unwrap();
15-
let file_name = path.file_name().unwrap();
16-
// smoelius: Pass `--lib --tests` to `cargo test` to avoid the potential filename
17-
// collision associated with building the examples.
18-
dylint_internal::cargo::test(&format!("example `{}`", file_name.to_string_lossy()))
19-
.build()
20-
.sanitize_environment()
21-
.current_dir(path)
22-
.args(["--lib", "--tests"])
23-
.success()
24-
.unwrap();
25-
}
11+
nested_workspace::test().args(["--lib", "--tests"]).unwrap();
2612
}
2713

2814
#[test]

0 commit comments

Comments
 (0)