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.
This commit is contained in:
Greg Fitzgerald 2018-10-05 10:17:35 -07:00 committed by GitHub
parent da0404ad03
commit 9c0fa4d1d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 10 deletions

View File

@ -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"

View File

@ -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

View File

@ -13,6 +13,7 @@ RUN set -x && \
apt install -y \
buildkite-agent \
cmake \
lcov \
libclang-common-7-dev \
llvm-7 \
rsync \

View File

@ -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

View File

@ -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)