mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-30 05:50:31 +00:00
ci: add coverage job
Uses the new llvm source-base coverage from nightly to generate coverage reports: - full html report as artifact - cobertura report for gitlab MR integration - output coverage summary for gitlab parsing Here is the regexp to set in gitlab as "Test coverage parsing": \s*lines\.*:\s*([\d\.]+%) Resources: - https://github.com/marco-c/rust-code-coverage-sample - https://github.com/mozilla/grcov/issues/468#issuecomment-691615245 - https://www.greycastle.se/how-to-show-flutter-test-coverage-in-gitlab-ci/
This commit is contained in:
parent
70d3eecbc5
commit
b92360db37
1 changed files with 25 additions and 0 deletions
|
@ -216,3 +216,28 @@ outdated:
|
|||
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
||||
script:
|
||||
- cargo outdated --root-deps-only --exit-code 1 -v
|
||||
|
||||
coverage:
|
||||
extends:
|
||||
- .img-nightly
|
||||
stage: 'extras'
|
||||
rules:
|
||||
- when: 'always'
|
||||
variables:
|
||||
RUSTFLAGS: "-Zinstrument-coverage"
|
||||
LLVM_PROFILE_FILE: "gst-plugins-rs-%p-%m.profraw"
|
||||
script:
|
||||
- cargo test --locked --color=always --all-features
|
||||
# generate html report
|
||||
- grcov . --binary-path ./target/debug/ -s . -t html --branch --ignore-not-existing --ignore "*target*" -o ./coverage/
|
||||
# generate cobertura report for gitlab integration
|
||||
- grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "*target*" -o lcov
|
||||
- python3 /usr/local/lib/python3.7/dist-packages/lcov_cobertura.py lcov
|
||||
# output coverage summary for gitlab parsing
|
||||
- lcov -r lcov "/*" 2&> out
|
||||
- grep lines out
|
||||
artifacts:
|
||||
paths:
|
||||
- 'coverage'
|
||||
reports:
|
||||
cobertura: coverage.xml
|
||||
|
|
Loading…
Reference in a new issue