Open J4CKVVH173 opened 1 year ago
Hey, I am having the same issue with a Windows environment. Were you able to resolve this?
I found I need to follow the full set of instructions not just the gitlab-specific elements.
I'm using an image with grcov pre-installed. My CI job works as expected, here's what it looks like:
cargo coverage:
stage: test
variables:
CARGO_TEST_OPTS: "--workspace"
TEST_BIN_ARGS: ""
LLVM_PROFILE_FILE: "target/coverage/%p-%m.profraw"
RUSTFLAGS: "-Cinstrument-coverage"
script:
- mkdir -p target/coverage
- rustup component add llvm-tools-preview
- cargo build
- cargo test ${CARGO_TEST_OPTS} -- ${TEST_BIN_ARGS}
- grcov target/coverage -b target/debug -o target/coverage --output-types cobertura
artifacts:
paths:
- target/coverage
reports:
coverage_report:
coverage_format: cobertura
path: target/coverage/cobertura.xml
Without the build step, the profraw
files weren't getting generated.
I've found out that it's important to add extra keys to rust test runner and after this grcov
worked
LLVM_PROFILE_FILE='target/coverage/%p-%m.profraw' RUSTFLAGS='-C instrument-coverage' cargo test
- test runner for Docker rust:1.71
I try to configurate gitlab ci-cd for rust and I would like to have a test's coverage. I used the instruction from
grcov
but when I try to rungrcov target/coverage --binary-path target/debug -s . -o target/coverage --keep-only 'src/*' --output-types html,cobertura
I get this rust's panic message:A panic occurred at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/grcov-0.8.19/src/producer.rs:544: No input files found
. I can't understand where I messed up.Full gitlab-ci sript body