-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54cb4cd
commit 103dc36
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# Script that runs in every Travis CI container. | ||
# Responsible for testing the project in different Travis jobs of the current build stage. | ||
|
||
# The script should immediately exit if any command in the script fails. | ||
set -e | ||
|
||
# Go to project directory | ||
cd $(dirname $0)/../.. | ||
|
||
if [[ -z "$TRAVIS" ]]; then | ||
echo "This script can only run inside of Travis build jobs." | ||
exit 1 | ||
fi | ||
|
||
echo "" | ||
echo "Building sources and running tests. Running mode: ${MODE}" | ||
echo "" | ||
|
||
# Get commit diff | ||
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then | ||
fileDiff=$(git diff --name-only $TRAVIS_COMMIT_RANGE) | ||
else | ||
fileDiff=$(git diff --name-only $TRAVIS_BRANCH...HEAD) | ||
fi | ||
|
||
# Check if tests can be skipped | ||
# if [[ ${fileDiff} =~ ^(.*\.md\s*)*$ ]]; then | ||
# echo "Skipping tests since only markdown files changed." | ||
# exit 0 | ||
# fi | ||
|
||
if [ "${MODE}" = "lint" ]; then | ||
npm run lint | ||
elif [ "${MODE}" = "audit" ]; then | ||
npm audit | ||
fi | ||
|
||
# Upload coverage results if those are present. | ||
if [ -f coverage/lcov.info ]; then | ||
npm run coveralls | ||
fi |