Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Upload coverage HTML reports (#1421)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
garious authored Oct 5, 2018
1 parent da0404a commit 9c0fa4d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ci/buildkite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ 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"
timeout_in_minutes: 30
- 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"
Expand Down
1 change: 0 additions & 1 deletion ci/docker-rust-nightly/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions ci/docker-rust/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN set -x && \
apt install -y \
buildkite-agent \
cmake \
lcov \
libclang-common-7-dev \
llvm-7 \
rsync \
Expand Down
29 changes: 23 additions & 6 deletions ci/test-nightly.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion ci/version-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9c0fa4d

Please sign in to comment.