Skip to content
This repository was archived by the owner on Feb 17, 2024. It is now read-only.

Commit c588135

Browse files
committed
New doctest parameter allows us to disable documentation testing
There are some issues with documentation tests, see taiki-e/cargo-llvm-cov#2 and rust-lang/rust#79417
1 parent d885320 commit c588135

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
- `output_type`: output type, one of `html`, `text`, `json` or `lcov`.
4646
- `output_path`: output path.
4747
- `test_args`: arguments to pass to the test - `--nocapture` for example.
48+
- `doctest`: if `true` (the default) the documentation tests are also run.
4849

4950

5051
If neither `output_type` and `output_path` are defined, the action by

action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ inputs:
1616
default: ''
1717
test_args:
1818
description: Arguments to pass to the test
19+
doctest:
20+
description: Run documentation testing; true or false
21+
default: true
1922
outputs:
2023
report:
2124
description: Name of report file, for compatibility with rust-grcov

entrypoint

+10-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ if [ -n "$INPUT_OUTPUT_TYPE" ]; then
2525
OUTPUT_ARGS+=( "--$INPUT_OUTPUT_TYPE" )
2626
fi
2727

28+
DOCTEST="${INPUT_DOCTEST:-true}"
29+
2830
if [ -n "$INPUT_OUTPUT_PATH" ]; then
2931
OUTPUT_PATH="$INPUT_OUTPUT_PATH"
3032
OUTPUT_ARGS+=( --output-path "$OUTPUT_PATH" )
@@ -51,9 +53,16 @@ RUSTDOCFLAGS="$RUSTFLAGS"
5153
RUST_BACKTRACE=1
5254

5355
cargo llvm-cov --workspace clean
56+
57+
# Run regular test:
5458
cargo llvm-cov --workspace --all-features --no-fail-fast --no-report -- "${TEST_ARGS[@]}"
55-
cargo llvm-cov --workspace --all-features --no-fail-fast --no-report --doc -- "${TEST_ARGS[@]}"
59+
if [ "$DOCTEST" = "true" ]; then
60+
# Run doc tests:
61+
cargo llvm-cov --workspace --all-features --no-fail-fast --no-report --doc -- "${TEST_ARGS[@]}"
62+
fi
63+
# Generate report including doc tests:
5664
cargo llvm-cov --no-run --doctests "${OUTPUT_ARGS[@]}"
65+
# Print summary including doc tests:
5766
cargo llvm-cov --no-run --doctests
5867

5968
if [ -n "$OUTPUT_PATH" ]; then

0 commit comments

Comments
 (0)