ci: generate cobertura report directly

grcov 0.8.0 now has cobertura support so we no longer need to to export
to lcov format and then convert.

Extract the summary from the generated html so the metric matches the
one from the html report (for some reason the cobertura ones are
differents).

The new gitlab summary parsing regexp is now:
  <abbr .*>(\d+.\d+) %<\/abbr>
This commit is contained in:
Guillaume Desmottes 2021-04-22 16:01:04 +02:00
parent ba0b9801e3
commit c3946eef7c
3 changed files with 6 additions and 8 deletions

View file

@ -83,7 +83,7 @@ stages:
- .fdo.container-build@debian - .fdo.container-build@debian
stage: container-base stage: container-base
variables: 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 lcov" 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_EXEC: 'bash ci/install-gst.sh && pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates' FDO_DISTRIBUTION_EXEC: 'bash ci/install-gst.sh && pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates'
.build-final-image: .build-final-image:
@ -432,11 +432,10 @@ coverage:
# generate html report # 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/ - 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 # 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 - grcov . --binary-path ./target/debug/ -s . -t cobertura --branch --ignore-not-existing --ignore "*target*" --ignore "*/sys/*" --ignore "examples/*" --ignore "tutorials/*" -o coverage.xml
- python3 /usr/local/lib/python3.7/dist-packages/lcov_cobertura.py lcov # output coverage summary for gitlab parsing.
# output coverage summary for gitlab parsing # TODO: use grcov once https://github.com/mozilla/grcov/issues/556 is fixed
- lcov -r lcov "/*" 2&> out - grep % coverage/index.html | head -1 ; true
- grep lines out
artifacts: artifacts:
paths: paths:
- 'coverage' - 'coverage'

View file

@ -1,4 +1,4 @@
variables: variables:
GST_RS_IMG_TAG: '2021-04-23.0' GST_RS_IMG_TAG: '2021-04-23.1'
GST_RS_STABLE: '1.51.0' GST_RS_STABLE: '1.51.0'
GST_RS_MSRV: '1.51.0' GST_RS_MSRV: '1.51.0'

View file

@ -31,5 +31,4 @@ fi
if [ "$RUST_VERSION" = "nightly" ]; then if [ "$RUST_VERSION" = "nightly" ]; then
cargo install grcov cargo install grcov
rustup component add llvm-tools-preview rustup component add llvm-tools-preview
pip3 install lcov_cobertura
fi fi