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

Commit 9ea7b56

Browse files
committed
Add a test_args input
1 parent d821b51 commit 9ea7b56

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
- `dependencies_debian`: Debian packages to install before running the tests.
4545
- `output_type`: output type, one of `html`, `text`, `json` or `lcov`.
4646
- `output_path`: output path.
47+
- `test_args`: arguments to pass to the test - `--nocapture` for example.
4748

4849

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

action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ inputs:
1414
output_path:
1515
description: Output path to pass to grcov and set as report variable
1616
default: ''
17+
test_args:
18+
description: Arguments to pass to the test
1719
outputs:
1820
report:
1921
description: Name of report file, for compatibility with rust-grcov

entrypoint

+13-7
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,25 @@ else
1313
}
1414
fi
1515

16-
ARGS=()
16+
TEST_ARGS=()
17+
if [ -n "$INPUT_TEST_ARGS" ]; then
18+
IFS=' ' read -r -a testargs <<< "$INPUT_TEST_ARGS"
19+
TEST_ARGS+=( "${testargs[@]}" )
20+
fi
21+
22+
OUTPUT_ARGS=()
1723

1824
if [ -n "$INPUT_OUTPUT_TYPE" ]; then
19-
ARGS+=( "--$INPUT_OUTPUT_TYPE" )
25+
OUTPUT_ARGS+=( "--$INPUT_OUTPUT_TYPE" )
2026
fi
2127

2228
if [ -n "$INPUT_OUTPUT_PATH" ]; then
2329
OUTPUT_PATH="$INPUT_OUTPUT_PATH"
24-
ARGS+=( --output-path "$OUTPUT_PATH" )
30+
OUTPUT_ARGS+=( --output-path "$OUTPUT_PATH" )
2531
elif [ -z "$INPUT_OUTPUT_TYPE" ]; then
2632
# Default if no output_type was specified either
2733
OUTPUT_PATH="lcov.info"
28-
ARGS+=( --lcov --output-path "$OUTPUT_PATH" )
34+
OUTPUT_ARGS+=( --lcov --output-path "$OUTPUT_PATH" )
2935
fi
3036

3137
export RUSTC_BOOTSTRAP
@@ -45,9 +51,9 @@ RUSTDOCFLAGS="$RUSTFLAGS"
4551
RUST_BACKTRACE=1
4652

4753
cargo llvm-cov --workspace clean
48-
cargo llvm-cov --workspace --all-features --no-fail-fast --no-report
49-
cargo llvm-cov --workspace --all-features --no-fail-fast --no-report --doc
50-
cargo llvm-cov --no-run --doctests "${ARGS[@]}"
54+
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[@]}"
56+
cargo llvm-cov --no-run --doctests "${OUTPUT_ARGS[@]}"
5157
cargo llvm-cov --no-run --doctests
5258

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

0 commit comments

Comments
 (0)