Skip to content

Commit

Permalink
Don't litter with so many coverage profile files
Browse files Browse the repository at this point in the history
Put them in a coverage-profiles directory instead of the toplevel.

Also, tell grcov to put the generated HTML directly in
public/coverage, not a temporary directory which we move later.
  • Loading branch information
federicomenaquintero committed Feb 18, 2022
1 parent 6d1a7bd commit a904ea2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,13 @@ coverage:
variables:
RUSTFLAGS: "-Zinstrument-coverage"
RUSTDOCFLAGS: "-Zinstrument-coverage"
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
LLVM_PROFILE_FILE: "coverage-profiles/coverage-%p-%m.profraw"
script:
- cargo +nightly test --no-fail-fast || true
after_script:
- source ./.gitlab-ci/env.sh
- grcov . --binary-path ./target/debug/ --source-dir . --output-type cobertura --llvm --branch --ignore-not-existing --ignore "*cargo*" -o coverage.xml
- grcov . --binary-path ./target/debug/ --source-dir . --output-type html --llvm --branch --ignore-not-existing --ignore "build.rs" --output-path ./target/debug/coverage/
- mkdir -p public/coverage
- cp -r target/debug/coverage/* public/coverage
- grcov coverage-profiles --binary-path ./target/debug/ --source-dir . --output-type cobertura --llvm --branch --ignore-not-existing --ignore "*cargo*" -o coverage.xml
- grcov coverage-profiles --binary-path ./target/debug/ --source-dir . --output-type html --llvm --branch --ignore-not-existing --ignore "build.rs" --output-path public/coverage
- grep -Eo 'line-rate="[^"]+"' coverage.xml | head -n 1 | grep -Eo '[0-9.]+' | awk '{ print "Coverage:", $1 * 100 }'
coverage: '/Coverage: \d+\.\d+/'
artifacts:
Expand Down

0 comments on commit a904ea2

Please sign in to comment.