Skip to content

Commit

Permalink
bugfix(travis): Hopefully let PRs run tests
Browse files Browse the repository at this point in the history
Travis doesn't give PRs access to secure variables (for good reason),
which means they can't connect to SauceLabs. These changes should prevent
the build process from trying to run CI tests on PRs and instead just run
local tests.

Also coverage and release tasks should only run on master branch commits

[skip ci]
  • Loading branch information
c0bra committed Sep 10, 2014
1 parent 4ece940 commit 2bdd734
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ script:
- ./travis_build.sh

after_success:
- grunt release
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && grunt release

after_failure:
- ./travis_print_logs.sh
Expand Down
12 changes: 7 additions & 5 deletions lib/sauce/sauce_connect_block.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash


# Wait for Connect to be ready before exiting
while [ ! -f $SAUCE_CONNECT_READY_FILE ]; do
sleep .5
done
if [ ! $TRAVIS_PULL_REQUEST ]
then
# Wait for Connect to be ready before exiting
while [ ! -f $SAUCE_CONNECT_READY_FILE ]; do
sleep .5
done
fi
6 changes: 6 additions & 0 deletions lib/sauce/sauce_connect_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ set -e
# before_script:
# - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash

# Skip this if we're un a pull request, we won't be able to connect
if [ $TRAVIS_PULL_REQUEST ]
then
exit 0
fi

CONNECT_URL="http://saucelabs.com/downloads/Sauce-Connect-latest.zip"
CONNECT_DIR="/tmp/sauce-connect-$RANDOM"
CONNECT_DOWNLOAD="Sauce_Connect.zip"
Expand Down
19 changes: 15 additions & 4 deletions travis_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,19 @@ set -e

grunt
# grunt test:e2e:ci --verbose
grunt test:ci

# Send coverage data to coveralls.io
grunt coverage
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js || true
# If this is a pull request then we won't have access to secure variables and can't do integration tests with SauceLabs.
# In this case just do normal local tests
if [ $TRAVIS_PULL_REQUEST ]
then
grunt test
else
grunt test:ci

# Send coverage data to coveralls.io
if [ $TRAVIS_BRANCH == "master" ]
then
grunt coverage
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js || true\
fi
fi

0 comments on commit 2bdd734

Please sign in to comment.