Skip to content

Commit

Permalink
Added coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronnewman committed Jun 14, 2019
1 parent 43cf75b commit 9fcceb1
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ script: make && make release

after_success:
- ./scripts/ci/tag.sh
- ./scripts/ci/coverage.sh

deploy:
provider: releases
Expand Down
52 changes: 52 additions & 0 deletions scripts/ci/coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

echo "Checking variables"
echo $TRAVIS
echo $TRAVIS_TAG
echo $TRAVIS_BRANCH
echo $TRAVIS_PULL_REQUEST_BRANCH
echo $TRAVIS_PULL_REQUEST

# Checks if the tag script is being run on TravisCI
if [ ! $TRAVIS ]; then
echo "This script needs to be run on TravisCI platform"
exit 1
fi

# Checks if the build was triggered by a tag commit.
if [ ! -z "$TRAVIS_TAG" ]; then
echo "This build was triggered by a git tag push"
exit 1
fi

if [ "$TRAVIS_PULL_REQUEST" -eq "$TRAVIS_PULL_REQUEST" 2>/dev/null ] || [[ "$TRAVIS_PULL_REQUEST" =~ ^[0-9]+$ ]]; then
echo "This build was triggered by a Pull Request (PR)"
exit 1
fi

# Checks if the build was triggered Pull Request.
#if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ ! "$TRAVIS_PULL_REQUEST_BRANCH" = "master" ]; then
# echo "Run in a Pull Request"
# exit 1
#fi

if [ ! "$TRAVIS_BRANCH" == "master" ] && [ -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then
echo "This build is not in the master branch"
exit 1
fi

# Checks is the CODECOV_TOKEN token has been set
if [ -z $CODECOV_TOKEN ]; then
echo "CODECOV_TOKEN has not been set!"
exit 2
fi

# Checks if the coverage file exists from the makefile
if [ ! -f coverage.txt ]; then
echo "coverage.txt file not found!"
exit 2
fi

bash <(curl -s https://codecov.io/bash)

exit 1

0 comments on commit 9fcceb1

Please sign in to comment.