Update coverage upload script
This commit is contained in:
parent
7321583429
commit
75b3fe4db0
@ -2,24 +2,25 @@
|
|||||||
BASEDIR="$1"
|
BASEDIR="$1"
|
||||||
PROJECT_NAME="$2"
|
PROJECT_NAME="$2"
|
||||||
|
|
||||||
cd "$BASEDIR/htmlcov/"; tar czf "$BASEDIR/coverage.tar.gz" ./
|
TITLE="Coverage report of $PROJECT_NAME"
|
||||||
|
|
||||||
|
|
||||||
cd "$BASEDIR"
|
|
||||||
|
|
||||||
# build by gitlab CI
|
# build by gitlab CI
|
||||||
if [ -n "$CI_BUILD_REF_NAME" ]; then
|
if [ -n "$CI_BUILD_REF_NAME" ]; then
|
||||||
BRANCH="$CI_BUILD_REF_NAME"
|
BRANCH="$CI_BUILD_REF_NAME"
|
||||||
|
TITLE="$TITLE, $BRANCH branch"
|
||||||
# build by travis
|
# build by travis
|
||||||
elif [ -n "$TRAVIS_BRANCH" ]; then
|
elif [ -n "$TRAVIS_BRANCH" ]; then
|
||||||
# if this a pull request ?
|
# if this a pull request ?
|
||||||
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
|
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
|
||||||
BRANCH="pull-request-$TRAVIS_PULL_REQUEST"
|
BRANCH="pull-request-$TRAVIS_PULL_REQUEST"
|
||||||
|
TITLE="$TITLE, pull request n°$BRANCH"
|
||||||
else
|
else
|
||||||
BRANCH="$TRAVIS_BRANCH"
|
BRANCH="$TRAVIS_BRANCH"
|
||||||
|
TITLE="$TITLE, $BRANCH branch"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
TITLE="$TITLE, $BRANCH branch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$BRANCH" = "HEAD" ]] || [ -z "$BRANCH" ]; then
|
if [[ "$BRANCH" = "HEAD" ]] || [ -z "$BRANCH" ]; then
|
||||||
@ -27,6 +28,22 @@ if [[ "$BRANCH" = "HEAD" ]] || [ -z "$BRANCH" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
VENV="$(mktemp -d)"
|
||||||
|
HTMLREPORT="$(mktemp -d)"
|
||||||
|
virtualenv "$VENV"
|
||||||
|
"$VENV/bin/pip" install coverage
|
||||||
|
"$VENV/bin/coverage" html --title "$TITLE" --directory "$HTMLREPORT"
|
||||||
|
rm -rf "$VENV"
|
||||||
|
|
||||||
|
|
||||||
|
cd "$HTMLREPORT"; tar czf "$BASEDIR/coverage.tar.gz" ./
|
||||||
|
|
||||||
|
cd "$BASEDIR"
|
||||||
|
|
||||||
|
rm -rf "$HTMLREPORT"
|
||||||
|
|
||||||
|
|
||||||
curl https://badges.genua.fr/coverage/ \
|
curl https://badges.genua.fr/coverage/ \
|
||||||
-F "secret=$COVERAGE_TOKEN" \
|
-F "secret=$COVERAGE_TOKEN" \
|
||||||
-F "tar=@$BASEDIR/coverage.tar.gz" \
|
-F "tar=@$BASEDIR/coverage.tar.gz" \
|
||||||
|
Loading…
Reference in New Issue
Block a user