mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +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\.]+%) Ignore sys crates when calculating coverage are those are fully generated anyway. 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
4a92966ed5
commit
01e1cfce54
3 changed files with 40 additions and 5 deletions
|
@ -81,7 +81,7 @@ stages:
|
|||
- .fdo.container-build@debian
|
||||
stage: container-base
|
||||
variables:
|
||||
FDO_DISTRIBUTION_PACKAGES: "build-essential curl python3-setuptools liborc-0.4-dev libglib2.0-dev libxml2-dev libgtk-3-dev libegl1-mesa libgles2-mesa libgl1-mesa-dri libgl1-mesa-glx libwayland-egl1-mesa xz-utils libssl-dev git wget ca-certificates ninja-build python3-pip flex bison libglib2.0-dev"
|
||||
FDO_DISTRIBUTION_PACKAGES: "build-essential curl python3-setuptools liborc-0.4-dev libglib2.0-dev libxml2-dev libgtk-3-dev libegl1-mesa libgles2-mesa libgl1-mesa-dri libgl1-mesa-glx libwayland-egl1-mesa xz-utils libssl-dev git wget ca-certificates ninja-build python3-pip flex bison libglib2.0-dev lcov"
|
||||
FDO_DISTRIBUTION_EXEC: 'bash ci/install-gst.sh && pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates'
|
||||
|
||||
.build-final-image:
|
||||
|
@ -191,9 +191,7 @@ plugins-update-nightly:
|
|||
variables:
|
||||
UPDATE_IMG: "nightly"
|
||||
|
||||
.cargo test:
|
||||
stage: "test"
|
||||
script:
|
||||
.cargo_test_var: &cargo_test
|
||||
- rustc --version
|
||||
# First build and test all the crates with their relevant features
|
||||
# Keep features in sync with below
|
||||
|
@ -229,6 +227,11 @@ plugins-update-nightly:
|
|||
cargo build --locked --color=always --manifest-path tutorials/Cargo.toml --bins --examples --all-features
|
||||
fi
|
||||
|
||||
.cargo test:
|
||||
stage: "test"
|
||||
script:
|
||||
- *cargo_test
|
||||
|
||||
test msrv:
|
||||
extends:
|
||||
- '.cargo test'
|
||||
|
@ -413,6 +416,31 @@ outdated:
|
|||
script:
|
||||
- cargo outdated --color=always --root-deps-only --exit-code 1 -v
|
||||
|
||||
coverage:
|
||||
extends:
|
||||
- '.cargo test'
|
||||
- .img-nightly
|
||||
stage: 'extras'
|
||||
variables:
|
||||
ALL_FEATURES: 'yes'
|
||||
RUSTFLAGS: "-Zinstrument-coverage"
|
||||
LLVM_PROFILE_FILE: "gstreamer-rs-%p-%m.profraw"
|
||||
script:
|
||||
- *cargo_test
|
||||
# generate html report
|
||||
- grcov . --binary-path ./target/debug/ -s . -t html --branch --ignore-not-existing --ignore "*target*" --ignore "*/sys/*" --ignore "examples/*" --ignore "tutorials/*" -o ./coverage/
|
||||
# generate cobertura report for gitlab integration
|
||||
- grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "*target*" --ignore "*/sys/*" --ignore "examples/*" --ignore "tutorials/*" -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
|
||||
|
||||
pages:
|
||||
extends: .img-stable
|
||||
stage: 'deploy'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
variables:
|
||||
GST_RS_IMG_TAG: '2020-12-31.0'
|
||||
GST_RS_IMG_TAG: '2021-01-11.0'
|
||||
GST_RS_STABLE: '1.49.0'
|
||||
GST_RS_MSRV: '1.48.0'
|
||||
|
|
|
@ -26,3 +26,10 @@ if [ "$RUST_IMAGE_FULL" = "1" ]; then
|
|||
cargo install --force cargo-deny
|
||||
cargo install --force cargo-outdated
|
||||
fi
|
||||
|
||||
# coverage tools
|
||||
if [ "$RUST_VERSION" = "nightly" ]; then
|
||||
cargo install grcov
|
||||
rustup component add llvm-tools-preview
|
||||
pip3 install lcov_cobertura
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue