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

Commit

Permalink
New doctest parameter allows us to disable documentation testing
Browse files Browse the repository at this point in the history
There are some issues with documentation tests, see
taiki-e/cargo-llvm-cov#2 and
rust-lang/rust#79417
  • Loading branch information
lpenz committed Jan 27, 2022
1 parent d885320 commit 33e8f1d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
- `output_type`: output type, one of `html`, `text`, `json` or `lcov`.
- `output_path`: output path.
- `test_args`: arguments to pass to the test - `--nocapture` for example.
- `doctest`: if `true` (the default) the documentation tests are also run.


If neither `output_type` and `output_path` are defined, the action by
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ inputs:
default: ''
test_args:
description: Arguments to pass to the test
doctest:
description: Run documentation testing; true or false
default: true
outputs:
report:
description: Name of report file, for compatibility with rust-grcov
Expand Down
11 changes: 10 additions & 1 deletion entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ if [ -n "$INPUT_OUTPUT_TYPE" ]; then
OUTPUT_ARGS+=( "--$INPUT_OUTPUT_TYPE" )
fi

DOCTEST="${INPUT_DOCTEST:-true}"

if [ -n "$INPUT_OUTPUT_PATH" ]; then
OUTPUT_PATH="$INPUT_OUTPUT_PATH"
OUTPUT_ARGS+=( --output-path "$OUTPUT_PATH" )
Expand All @@ -51,9 +53,16 @@ RUSTDOCFLAGS="$RUSTFLAGS"
RUST_BACKTRACE=1

cargo llvm-cov --workspace clean

# Run regular test:
cargo llvm-cov --workspace --all-features --no-fail-fast --no-report -- "${TEST_ARGS[@]}"
cargo llvm-cov --workspace --all-features --no-fail-fast --no-report --doc -- "${TEST_ARGS[@]}"
if [ "$DOCTEST" = "true" ]; then
# Run doc tests:
cargo llvm-cov --workspace --all-features --no-fail-fast --no-report --doc -- "${TEST_ARGS[@]}"
fi
# Generate report including doc tests:
cargo llvm-cov --no-run --doctests "${OUTPUT_ARGS[@]}"
# Print summary including doc tests:
cargo llvm-cov --no-run --doctests

if [ -n "$OUTPUT_PATH" ]; then
Expand Down

0 comments on commit 33e8f1d

Please sign in to comment.