gstreamer-rs/ci/install-rust.sh
Guillaume Desmottes 01e1cfce54 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/
2021-01-11 15:41:21 +01:00

35 lines
826 B
Bash
Executable file

source ./ci/env.sh
set -e
export CARGO_HOME='/usr/local/cargo'
RUSTUP_VERSION=1.23.1
RUST_VERSION=$1
RUST_IMAGE_FULL=$2
RUST_ARCH="x86_64-unknown-linux-gnu"
RUSTUP_URL=https://static.rust-lang.org/rustup/archive/$RUSTUP_VERSION/$RUST_ARCH/rustup-init
wget $RUSTUP_URL
chmod +x rustup-init;
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION;
rm rustup-init;
chmod -R a+w $RUSTUP_HOME $CARGO_HOME
rustup --version
cargo --version
rustc --version
if [ "$RUST_IMAGE_FULL" = "1" ]; then
rustup component add clippy-preview
rustup component add rustfmt
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