2019-06-05 09:47:36 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-05-16 16:12:23 +08:00
|
|
|
set -euo pipefail
|
2019-06-05 09:47:36 +08:00
|
|
|
set -x
|
|
|
|
|
2021-05-16 16:12:23 +08:00
|
|
|
# Install coverage.
|
|
|
|
if [[ -z ${TOXENV+x} || -z $TOXENV ]]; then
|
2019-06-05 09:47:36 +08:00
|
|
|
python -m pip install coverage
|
|
|
|
else
|
|
|
|
# Add last TOXENV to $PATH.
|
|
|
|
PATH="$PWD/.tox/${TOXENV##*,}/bin:$PATH"
|
|
|
|
fi
|
|
|
|
|
2021-05-16 16:12:23 +08:00
|
|
|
# Run coverage.
|
2019-06-05 09:47:36 +08:00
|
|
|
python -m coverage xml
|
2021-05-16 16:12:23 +08:00
|
|
|
|
|
|
|
# Download and verify latest Codecov bash uploader.
|
2019-10-13 02:50:33 +08:00
|
|
|
# Set --connect-timeout to work around https://github.com/curl/curl/issues/4461
|
2021-05-16 16:12:23 +08:00
|
|
|
curl --silent --show-error --location --connect-timeout 5 --retry 6 -o codecov https://codecov.io/bash
|
|
|
|
VERSION=$(grep --only-matching 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2)
|
|
|
|
if command -v sha256sum; then
|
|
|
|
sha256sum --check --strict --ignore-missing --quiet <(curl --silent "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA256SUM")
|
|
|
|
else
|
|
|
|
shasum --algorithm 256 --check --strict --ignore-missing --quiet <(curl --silent "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA256SUM")
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Upload coverage.
|
|
|
|
bash codecov -Z -X fix -f coverage.xml "$@"
|