From 9c0fa4d1d2d53ea2ed9766a770b8842dc29594e6 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Fri, 5 Oct 2018 10:17:35 -0700 Subject: [PATCH] Upload coverage HTML reports (#1421) Uploads two reports to Buildkite, one from cargo-cov and one from lcov via grcov. The lcov one is busted on linux and is what we need to bring codecov.io back up again. It works great on macos if you wanted to generate them locally and prefer lcov HTML reports. * Also comment out non-coverage build to speed things up. --- ci/buildkite.yml | 4 ++-- ci/docker-rust-nightly/Dockerfile | 1 - ci/docker-rust/Dockerfile | 1 + ci/test-nightly.sh | 29 +++++++++++++++++++++++------ ci/version-check.sh | 2 +- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/ci/buildkite.yml b/ci/buildkite.yml index 9e53967e14..1782669bd2 100644 --- a/ci/buildkite.yml +++ b/ci/buildkite.yml @@ -4,7 +4,7 @@ steps: env: CARGO_TARGET_CACHE_NAME: "stable" timeout_in_minutes: 30 - - command: "ci/docker-run.sh solanalabs/rust-nightly:2018-09-28 ci/test-bench.sh" + - command: "ci/docker-run.sh solanalabs/rust-nightly:2018-10-04 ci/test-bench.sh" name: "bench [public]" env: CARGO_TARGET_CACHE_NAME: "nightly" @@ -12,7 +12,7 @@ steps: - command: "ci/shellcheck.sh" name: "shellcheck [public]" timeout_in_minutes: 20 - - command: "ci/docker-run.sh solanalabs/rust-nightly:2018-09-28 ci/test-nightly.sh" + - command: "ci/docker-run.sh solanalabs/rust-nightly:2018-10-04 ci/test-nightly.sh" name: "nightly [public]" env: CARGO_TARGET_CACHE_NAME: "nightly" diff --git a/ci/docker-rust-nightly/Dockerfile b/ci/docker-rust-nightly/Dockerfile index 7d0bc30edf..c284c38e7d 100644 --- a/ci/docker-rust-nightly/Dockerfile +++ b/ci/docker-rust-nightly/Dockerfile @@ -4,7 +4,6 @@ ARG date RUN set -x && \ rustup install nightly-$date && \ rustup default nightly-$date && \ - rustup component add clippy-preview --toolchain=nightly-$date && \ rustc --version && \ cargo --version && \ cargo +nightly-$date install cargo-cov diff --git a/ci/docker-rust/Dockerfile b/ci/docker-rust/Dockerfile index 9d2f131269..3a52184236 100644 --- a/ci/docker-rust/Dockerfile +++ b/ci/docker-rust/Dockerfile @@ -13,6 +13,7 @@ RUN set -x && \ apt install -y \ buildkite-agent \ cmake \ + lcov \ libclang-common-7-dev \ llvm-7 \ rsync \ diff --git a/ci/test-nightly.sh b/ci/test-nightly.sh index c7caf92b46..877001e3bf 100755 --- a/ci/test-nightly.sh +++ b/ci/test-nightly.sh @@ -1,6 +1,7 @@ #!/bin/bash -e cd "$(dirname "$0")/.." +source ci/upload_ci_artifact.sh ci/version-check.sh nightly export RUST_BACKTRACE=1 @@ -10,8 +11,8 @@ _() { "$@" } -_ cargo build --verbose --features unstable -_ cargo test --verbose --features=unstable +# Uncomment this to run nightly test suit +# _ cargo test --verbose --features=unstable maybe_cargo_install() { for cmd in "$@"; do @@ -27,17 +28,33 @@ maybe_cargo_install() { maybe_cargo_install cov +# Generate coverage data and report via unit-test suite. _ cargo cov clean _ cargo cov test --lib _ cargo cov report -echo --- Coverage report: -ls -l target/cov/report/index.html +# Generate a coverage report with grcov via lcov. +if [[ ! -f ./grcov ]]; then + uname=$(uname | tr '[:upper:]' '[:lower:]') + uname_m=$(uname -m | tr '[:upper:]' '[:lower:]') + name=grcov-${uname}-${uname_m}.tar.bz2 + _ wget "https://github.com/mozilla/grcov/releases/download/v0.2.3/${name}" + _ tar -xjf "${name}" +fi +_ ./grcov . -t lcov > lcov.info +_ genhtml -o target/cov/report-lcov --show-details --highlight --ignore-errors source --legend lcov.info + +# Upload to tarballs to buildkite. +_ cd target/cov && tar -cjf cov-report.tar.bz2 report/* && cd - +_ upload_ci_artifact "target/cov/cov-report.tar.bz2" + +_ cd target/cov && tar -cjf lcov-report.tar.bz2 report-lcov/* && cd - +_ upload_ci_artifact "target/cov/lcov-report.tar.bz2" if [[ -z "$CODECOV_TOKEN" ]]; then echo CODECOV_TOKEN undefined else - # TODO: Fix this. true - #bash <(curl -s https://codecov.io/bash) -x 'llvm-cov-7 gcov' + # TODO: Why doesn't codecov grok our lcov files? + #bash <(curl -s https://codecov.io/bash) -X gcov fi diff --git a/ci/version-check.sh b/ci/version-check.sh index 44826e5f15..72ef69b240 100755 --- a/ci/version-check.sh +++ b/ci/version-check.sh @@ -19,7 +19,7 @@ require() { case ${1:-stable} in nightly) - require rustc 1.30.[0-9]+-nightly + require rustc 1.31.[0-9]+-nightly require cargo 1.31.[0-9]+-nightly ;; stable)