diff --git a/README.md b/README.md index 8c0b10a4abfc35..5555776165183e 100644 --- a/README.md +++ b/README.md @@ -234,12 +234,21 @@ $ cargo +nightly bench --features="unstable" Code coverage --- -To generate code coverage statistics, run kcov via Docker: +To generate code coverage statistics, install cargo-cov. Note: the tool currently only works +in Rust nightly. ```bash -$ ./ci/coverage.sh +$ cargo +nightly install cargo-cov ``` -The coverage report will be written to `./target/cov/index.html` + +Run cargo-cov and generate a report: + +```bash +$ cargo +nightly cov test +$ cargo +nightly cov report --open +``` + +The coverage report will be written to `./target/cov/report/index.html` Why coverage? While most see coverage as a code quality metric, we see it primarily as a developer diff --git a/ci/buildkite.yml b/ci/buildkite.yml index f95af779921d91..d6cc061cf60d4b 100644 --- a/ci/buildkite.yml +++ b/ci/buildkite.yml @@ -3,13 +3,6 @@ steps: name: "stable [public]" timeout_in_minutes: 20 - wait - - command: "ci/coverage.sh" - name: "coverage [public]" - timeout_in_minutes: 20 - retry: - automatic: - - exit_status: "*" - limit: 2 - command: "ci/docker-run.sh rustlang/rust:nightly ci/test-nightly.sh" name: "nightly [public]" timeout_in_minutes: 20 diff --git a/ci/coverage.sh b/ci/coverage.sh index fc6098fc3b8fc3..6c3570249405da 100755 --- a/ci/coverage.sh +++ b/ci/coverage.sh @@ -2,20 +2,16 @@ cd "$(dirname "$0")/.." -ci/docker-run.sh evilmachines/rust-cargo-kcov \ - bash -exc "\ - export RUST_BACKTRACE=1; \ - cargo build --verbose; \ - cargo kcov --lib --verbose; \ - " +cargo cov test +cargo cov report echo Coverage report: -ls -l target/cov/index.html +ls -l target/cov/report/index.html if [[ -z "$CODECOV_TOKEN" ]]; then echo CODECOV_TOKEN undefined else - bash <(curl -s https://codecov.io/bash) + bash <(curl -s https://codecov.io/bash) -x 'llvm-cov gcov' fi exit 0 diff --git a/ci/test-nightly.sh b/ci/test-nightly.sh index a0ae0102eeb131..3f38e3d1bc2c39 100755 --- a/ci/test-nightly.sh +++ b/ci/test-nightly.sh @@ -6,9 +6,9 @@ rustc --version cargo --version export RUST_BACKTRACE=1 -rustup component add rustfmt-preview cargo build --verbose --features unstable cargo test --verbose --features unstable cargo bench --verbose --features unstable +ci/coverage.sh exit 0