Overhaul coverage setup
This commit is contained in:
@ -17,9 +17,9 @@ steps:
|
||||
- command: "ci/docker-run.sh solanalabs/rust:1.31.0 ci/test-stable.sh"
|
||||
name: "stable"
|
||||
timeout_in_minutes: 30
|
||||
#- command: "ci/docker-run.sh solanalabs/rust-nightly:2018-12-05 ci/test-nightly.sh"
|
||||
# name: "nightly"
|
||||
# timeout_in_minutes: 30
|
||||
- command: "ci/docker-run.sh solanalabs/rust-nightly:2018-12-18 ci/test-coverage.sh"
|
||||
name: "coverage"
|
||||
timeout_in_minutes: 30
|
||||
# TODO: Fix and re-enable test-large-network.sh
|
||||
# - command: "ci/test-large-network.sh || true"
|
||||
# name: "large-network [ignored]"
|
||||
|
40
ci/test-coverage.sh
Executable file
40
ci/test-coverage.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
annotate() {
|
||||
${BUILDKITE:-false} && {
|
||||
buildkite-agent annotate "$@"
|
||||
}
|
||||
}
|
||||
|
||||
affectedFiles="$(buildkite-agent meta-data get affected_files)"
|
||||
echo "Affected files in this PR: $affectedFiles"
|
||||
if [[ ! ":$affectedFiles:" =~ \.rs: ]]; then
|
||||
annotate --style info --context coverage-info \
|
||||
"Coverage skipped as no .rs files were modified"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
source ci/upload-ci-artifact.sh
|
||||
ci/version-check-with-upgrade.sh nightly
|
||||
|
||||
scripts/coverage.sh
|
||||
|
||||
report=coverage-"${BUILDKITE_COMMIT:0:9}".tar.gz
|
||||
mv target/cov/report.tar.gz "$report"
|
||||
upload-ci-artifact "$report"
|
||||
annotate --style success --context lcov-report \
|
||||
"lcov report: <a href=\"artifact://$report\">$report</a>"
|
||||
|
||||
echo "--- codecov.io report"
|
||||
if [[ -z "$CODECOV_TOKEN" ]]; then
|
||||
echo "^^^ +++"
|
||||
echo CODECOV_TOKEN undefined, codecov.io upload skipped
|
||||
else
|
||||
bash <(curl -s https://codecov.io/bash) -X gcov -f target/cov/lcov.info
|
||||
|
||||
annotate --style success --context codecov.io \
|
||||
"CodeCov report: https://codecov.io/github/solana-labs/solana/commit/${BUILDKITE_COMMIT:0:9}"
|
||||
fi
|
@ -1,57 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
source ci/upload-ci-artifact.sh
|
||||
|
||||
ci/version-check.sh nightly
|
||||
export RUST_BACKTRACE=1
|
||||
|
||||
_() {
|
||||
echo "--- $*"
|
||||
"$@"
|
||||
}
|
||||
|
||||
# Uncomment this to run nightly test suit
|
||||
# _ cargo test --all --verbose --features=unstable -- --test-threads=1
|
||||
|
||||
cargo_install_unless() {
|
||||
declare crate=$1
|
||||
shift
|
||||
|
||||
"$@" > /dev/null 2>&1 || \
|
||||
_ cargo install "$crate"
|
||||
}
|
||||
|
||||
cargo_install_unless cargo-cov cargo cov --help
|
||||
|
||||
# Generate coverage data and report via unit-test suite.
|
||||
_ cargo cov clean
|
||||
_ cargo cov build --all
|
||||
_ cargo cov test --lib
|
||||
_ cargo cov report
|
||||
_ ./scripts/fetch-grcov.sh
|
||||
_ ./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"
|
||||
|
||||
# Upload coverage files to buildkite for grcov debugging
|
||||
_ cd target/cov/build && tar -cjf cov-gcda.tar.bz2 gcda/* && cd -
|
||||
_ upload-ci-artifact "target/cov/build/cov-gcda.tar.bz2"
|
||||
|
||||
_ cd target/cov/build && tar -cjf cov-gcno.tar.bz2 gcno/* && cd -
|
||||
_ upload-ci-artifact "target/cov/build/cov-gcno.tar.bz2"
|
||||
|
||||
if [[ -z "$CODECOV_TOKEN" ]]; then
|
||||
echo CODECOV_TOKEN undefined
|
||||
else
|
||||
true
|
||||
# TODO: Why doesn't codecov grok our lcov files?
|
||||
#bash <(curl -s https://codecov.io/bash) -X gcov
|
||||
fi
|
Reference in New Issue
Block a user