diff options
| author | Vojta Jina | 2013-06-25 13:50:45 -0700 | 
|---|---|---|
| committer | Vojta Jina | 2013-06-28 11:43:38 -0700 | 
| commit | 33223e26a0c6e73bddbc112829f35f373f97b10d (patch) | |
| tree | 20305c84130daff5939ee403870cb13d0cb4aaac | |
| parent | 976edc1fc4d4c373bcecddd0389fe94dd528eb4e (diff) | |
| download | angular.js-33223e26a0c6e73bddbc112829f35f373f97b10d.tar.bz2 | |
chore: set up Sauce Labs with Travis
This should not affect the Jenkins build at all.
Now, the Travis build uses Chrome on Sauce Labs, which in theory gives us opportunity to use any
browser/platform that Sauce Labs offers.
| -rw-r--r-- | .travis.yml | 13 | ||||
| -rw-r--r-- | karma-docs.conf.js | 2 | ||||
| -rw-r--r-- | karma-e2e.conf.js | 2 | ||||
| -rw-r--r-- | karma-jqlite.conf.js | 2 | ||||
| -rw-r--r-- | karma-jquery.conf.js | 2 | ||||
| -rw-r--r-- | karma-modules.conf.js | 2 | ||||
| -rw-r--r-- | karma-shared.conf.js | 16 | ||||
| -rwxr-xr-x | lib/sauce/sauce_connect_block.sh | 7 | ||||
| -rwxr-xr-x | lib/sauce/sauce_connect_setup.sh | 32 | ||||
| -rw-r--r-- | package.json | 1 | 
10 files changed, 75 insertions, 4 deletions
| diff --git a/.travis.yml b/.travis.yml index b3588709..92da3ed9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,19 @@ language: node_js  node_js:    - 0.8 +env: +  global: +    - SAUCE_USERNAME=angular-ci +    - SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987 +    - SAUCE_CONNECT_READY_FILE=/tmp/sauce-connect-ready +  before_script: -  - export DISPLAY=:99.0 -  - sh -e /etc/init.d/xvfb start +  - export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev` +  - ./lib/sauce/sauce_connect_setup.sh    - npm install -g grunt-cli    - grunt package    - grunt webserver > /dev/null & +  - ./lib/sauce/sauce_connect_block.sh  script: -  - grunt test --browsers Firefox --reporters=dots +  - grunt test --reporters dots --browsers SL_Chrome diff --git a/karma-docs.conf.js b/karma-docs.conf.js index 0403d187..2a06e17f 100644 --- a/karma-docs.conf.js +++ b/karma-docs.conf.js @@ -33,4 +33,6 @@ module.exports = function(config) {        suite: 'Docs'      }    }); + +  config.sauceLabs.testName = 'AngularJS: docs';  }; diff --git a/karma-e2e.conf.js b/karma-e2e.conf.js index 2c87820c..d9a92e99 100644 --- a/karma-e2e.conf.js +++ b/karma-e2e.conf.js @@ -22,4 +22,6 @@ module.exports = function(config) {        suite: 'E2E'      }    }); + +  config.sauceLabs.testName = 'AngularJS: e2e';  }; diff --git a/karma-jqlite.conf.js b/karma-jqlite.conf.js index d3a297a8..bf190f5e 100644 --- a/karma-jqlite.conf.js +++ b/karma-jqlite.conf.js @@ -13,4 +13,6 @@ module.exports = function(config) {        suite: 'jqLite'      }    }); + +  config.sauceLabs.testName = 'AngularJS: jqLite';  }; diff --git a/karma-jquery.conf.js b/karma-jquery.conf.js index 236824f7..126b3e1d 100644 --- a/karma-jquery.conf.js +++ b/karma-jquery.conf.js @@ -13,4 +13,6 @@ module.exports = function(config) {        suite: 'jQuery'      }    }); + +  config.sauceLabs.testName = 'AngularJS: jQuery';  }; diff --git a/karma-modules.conf.js b/karma-modules.conf.js index 38c22b81..9bbdec67 100644 --- a/karma-modules.conf.js +++ b/karma-modules.conf.js @@ -12,4 +12,6 @@ module.exports = function(config) {        suite: 'modules'      }    }); + +  config.sauceLabs.testName = 'AngularJS: modules';  }; diff --git a/karma-shared.conf.js b/karma-shared.conf.js index 70be8c97..3157d50f 100644 --- a/karma-shared.conf.js +++ b/karma-shared.conf.js @@ -4,6 +4,20 @@ module.exports = function(config) {      autoWatch: true,      logLevel: config.LOG_INFO,      logColors: true, -    browsers: ['Chrome'] +    browsers: ['Chrome'], + +    // config for Travis CI +    sauceLabs: { +      testName: 'AngularJS', +      startConnect: false, +      tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER +    }, + +    customLaunchers: { +      'SL_Chrome': { +        base: 'SauceLabs', +        browserName: 'chrome' +      } +    }    });  }; diff --git a/lib/sauce/sauce_connect_block.sh b/lib/sauce/sauce_connect_block.sh new file mode 100755 index 00000000..126d3710 --- /dev/null +++ b/lib/sauce/sauce_connect_block.sh @@ -0,0 +1,7 @@ +#!/bin/bash + + +# Wait for Connect to be ready before exiting +while [ ! -f $SAUCE_CONNECT_READY_FILE ]; do +  sleep .5 +done diff --git a/lib/sauce/sauce_connect_setup.sh b/lib/sauce/sauce_connect_setup.sh new file mode 100755 index 00000000..7ca8917b --- /dev/null +++ b/lib/sauce/sauce_connect_setup.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +# Setup and start Sauce Connect for your TravisCI build +# This script requires your .travis.yml to include the following two private env variables: +# SAUCE_USERNAME +# SAUCE_ACCESS_KEY +# Follow the steps at https://saucelabs.com/opensource/travis to set that up. +# +# Curl and run this script as part of your .travis.yml before_script section: +# before_script: +#   - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash + +CONNECT_URL="http://saucelabs.com/downloads/Sauce-Connect-latest.zip" +CONNECT_DIR="/tmp/sauce-connect-$RANDOM" +CONNECT_DOWNLOAD="Sauce_Connect.zip" +CONNECT_LOG="$CONNECT_DIR/log" + +# Get Connect and start it +mkdir -p $CONNECT_DIR +cd $CONNECT_DIR +curl $CONNECT_URL > $CONNECT_DOWNLOAD 2> /dev/null +unzip $CONNECT_DOWNLOAD +rm $CONNECT_DOWNLOAD + + +echo "Starting Sauce Connect in the background" +echo "Logging into $CONNECT_LOG" +java -jar Sauce-Connect.jar --readyfile $SAUCE_CONNECT_READY_FILE \ +    --tunnel-identifier $TRAVIS_JOB_NUMBER \ +    $SAUCE_USERNAME $SAUCE_ACCESS_KEY > $CONNECT_LOG & diff --git a/package.json b/package.json index 68a0b7ec..c3f3b7ba 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@      "karma-firefox-launcher": "~0.0.1",      "karma-ng-scenario": "~0.0.1",      "karma-junit-reporter": "~0.0.1", +    "karma-sauce-launcher": "~0.0.4",      "yaml-js": "0.0.5",      "showdown": "0.3.1",      "rewire": "1.1.3", | 
