Skip to content

Commit

Permalink
Run doctests as part of CI pipeline (#9939)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored Feb 12, 2024
1 parent a50e278 commit 341c269
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[profile.ci]
# Print out output for failing tests as soon as they fail, and also at the end
# of the run (for easy scrollability).
failure-output = "immediate-final"
# Do not cancel the test run on the first failure.
fail-fast = false

status-level = "skip"
13 changes: 11 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,17 @@ jobs:
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: "Install cargo insta"
uses: taiki-e/install-action@v2
with:
tool: cargo-insta
- uses: Swatinem/rust-cache@v2
- name: "Run tests"
shell: bash
run: cargo nextest run --workspace --status-level skip --failure-output immediate-final --no-fail-fast -j 12
env:
NEXTEST_PROFILE: "ci"
run: cargo insta test --all-features --unreferenced reject --test-runner nextest

# Check for broken links in the documentation.
- run: cargo doc --all --no-deps
env:
Expand Down Expand Up @@ -148,7 +155,9 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: "Run tests"
shell: bash
run: cargo nextest run --workspace --status-level skip --failure-output immediate-final --no-fail-fast -j 12
run: |
cargo nextest run --all-features --profile ci
cargo test --all-features --doc
cargo-test-wasm:
name: "cargo test (wasm)"
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ license = { workspace = true }

[lib]
bench = false
doctest = false

[[bench]]
name = "linter"
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_diagnostics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repository = { workspace = true }
license = { workspace = true }

[lib]
doctest = false

[dependencies]
ruff_text_size = { path = "../ruff_text_size" }
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_index/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repository = { workspace = true }
license = { workspace = true }

[lib]
doctest = false

[dependencies]
ruff_macros = { path = "../ruff_macros" }
Expand Down
4 changes: 3 additions & 1 deletion crates/ruff_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ pub fn derive_message_formats(_attr: TokenStream, item: TokenStream) -> TokenStr
///
/// Good:
///
/// ```rust
/// ```ignroe
/// use ruff_macros::newtype_index;
///
/// #[newtype_index]
/// #[derive(Ord, PartialOrd)]
/// struct MyIndex;
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_notebook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repository = { workspace = true }
license = { workspace = true }

[lib]
doctest = false

[dependencies]
ruff_diagnostics = { path = "../ruff_diagnostics" }
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_python_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repository = { workspace = true }
license = { workspace = true }

[lib]
doctest = false

[dependencies]
ruff_python_ast = { path = "../ruff_python_ast" }
Expand Down
3 changes: 3 additions & 0 deletions crates/ruff_python_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ documentation = { workspace = true }
repository = { workspace = true }
license = { workspace = true }

[lib]
doctest= false

[dependencies]
ruff_cache = { path = "../ruff_cache" }
ruff_formatter = { path = "../ruff_formatter" }
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_python_index/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repository = { workspace = true }
license = { workspace = true }

[lib]
doctest = false

[dependencies]
ruff_python_ast = { path = "../ruff_python_ast" }
Expand Down
3 changes: 3 additions & 0 deletions crates/ruff_python_literal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ documentation = { workspace = true }
repository = { workspace = true }
license = { workspace = true }

[lib]
doctest = false

[dependencies]
bitflags = { workspace = true }
hexf-parse = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_python_resolver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repository = { workspace = true }
license = { workspace = true }

[lib]
doctest = false

[dependencies]
log = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_python_semantic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repository = { workspace = true }
license = { workspace = true }

[lib]
doctest = false

[dependencies]
ruff_index = { path = "../ruff_index" }
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ description = "WebAssembly bindings for Ruff"

[lib]
crate-type = ["cdylib", "rlib"]
doctest = false

[features]
default = ["console_error_panic_hook"]
Expand Down

0 comments on commit 341c269

Please sign in to comment.