2018-05-21 23:02:54 -07:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2018-05-27 18:19:07 -07:00
|
|
|
cd "$(dirname "$0")/.."
|
2018-10-05 10:17:35 -07:00
|
|
|
source ci/upload_ci_artifact.sh
|
2018-05-21 23:02:54 -07:00
|
|
|
|
2018-08-06 08:57:12 -07:00
|
|
|
ci/version-check.sh nightly
|
2018-06-24 21:24:08 -07:00
|
|
|
export RUST_BACKTRACE=1
|
2018-05-22 16:57:14 -07:00
|
|
|
|
2018-06-24 21:24:08 -07:00
|
|
|
_() {
|
|
|
|
echo "--- $*"
|
|
|
|
"$@"
|
|
|
|
}
|
|
|
|
|
2018-10-05 10:17:35 -07:00
|
|
|
# Uncomment this to run nightly test suit
|
|
|
|
# _ cargo test --verbose --features=unstable
|
2018-09-04 15:34:21 -07:00
|
|
|
|
2018-09-01 17:05:12 -07:00
|
|
|
maybe_cargo_install() {
|
|
|
|
for cmd in "$@"; do
|
|
|
|
set +e
|
|
|
|
cargo "$cmd" --help > /dev/null 2>&1
|
|
|
|
declare exitcode=$?
|
|
|
|
set -e
|
|
|
|
if [[ $exitcode -eq 101 ]]; then
|
|
|
|
_ cargo install cargo-"$cmd"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
2018-06-24 21:24:08 -07:00
|
|
|
|
2018-09-01 17:05:12 -07:00
|
|
|
maybe_cargo_install cov
|
|
|
|
|
2018-10-05 10:17:35 -07:00
|
|
|
# Generate coverage data and report via unit-test suite.
|
2018-09-01 17:05:12 -07:00
|
|
|
_ cargo cov clean
|
|
|
|
_ cargo cov test --lib
|
2018-09-28 12:42:41 -07:00
|
|
|
_ cargo cov report
|
2018-09-01 17:05:12 -07:00
|
|
|
|
2018-10-05 10:17:35 -07:00
|
|
|
# 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"
|
2018-09-28 12:42:41 -07:00
|
|
|
|
|
|
|
if [[ -z "$CODECOV_TOKEN" ]]; then
|
|
|
|
echo CODECOV_TOKEN undefined
|
|
|
|
else
|
2018-09-28 18:47:44 -07:00
|
|
|
true
|
2018-10-05 10:17:35 -07:00
|
|
|
# TODO: Why doesn't codecov grok our lcov files?
|
|
|
|
#bash <(curl -s https://codecov.io/bash) -X gcov
|
2018-09-28 12:42:41 -07:00
|
|
|
fi
|