Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 9d5ac2e

Browse files
committedSep 17, 2015
chore(travis): upgrade CI builds to latest
1 parent 19bb53d commit 9d5ac2e

11 files changed

+137
-17
lines changed
 

‎.travis.yml

+31-7
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,58 @@
11
language: node_js
2+
sudo: false
23
node_js:
34
- '0.10'
45

6+
cache:
7+
directories:
8+
- node_modules
9+
- bower_components
10+
- docs/bower_components
11+
512
branches:
613
except:
714
- /^g3_.*$/
815

916
env:
1017
matrix:
11-
- JOB=unit
12-
- JOB=e2e TEST_TARGET=jqlite
13-
- JOB=e2e TEST_TARGET=jquery
18+
- JOB=unit BROWSER_PROVIDER=saucelabs
19+
- JOB=docs-e2e BROWSER_PROVIDER=saucelabs
20+
- JOB=e2e TEST_TARGET=jqlite BROWSER_PROVIDER=saucelabs
21+
- JOB=e2e TEST_TARGET=jquery BROWSER_PROVIDER=saucelabs
22+
- JOB=unit BROWSER_PROVIDER=browserstack
23+
- JOB=docs-e2e BROWSER_PROVIDER=browserstack
24+
- JOB=e2e TEST_TARGET=jqlite BROWSER_PROVIDER=browserstack
25+
- JOB=e2e TEST_TARGET=jquery BROWSER_PROVIDER=browserstack
1426
global:
1527
- SAUCE_USERNAME=angular-ci
1628
- SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987
29+
- BROWSER_STACK_USERNAME=VojtaJina
30+
- BROWSER_STACK_ACCESS_KEY=QCQJ1ZpWXpBkSwEdD8ev
1731
- LOGS_DIR=/tmp/angular-build/logs
18-
- BROWSER_PROVIDER_READY_FILE=/tmp/sauce-connect-ready
32+
- BROWSER_PROVIDER_READY_FILE=/tmp/browsersprovider-tunnel-ready
33+
34+
matrix:
35+
allow_failures:
36+
- env: "JOB=unit BROWSER_PROVIDER=browserstack"
37+
- env: "JOB=docs-e2e BROWSER_PROVIDER=browserstack"
38+
- env: "JOB=e2e TEST_TARGET=jqlite BROWSER_PROVIDER=browserstack"
39+
- env: "JOB=e2e TEST_TARGET=jquery BROWSER_PROVIDER=browserstack"
1940

2041
install:
42+
# Check the size of caches
43+
- du -sh ./node_modules ./bower_components/ ./docs/bower_components/ || true
2144
# - npm config set registry http://23.251.144.68
2245
# Disable the spinner, it looks bad on Travis
2346
- npm config set spin false
2447
# Log HTTP requests
2548
- npm config set loglevel http
26-
- time ./scripts/travis/npm-bundle-deps.sh
27-
- time npm install
49+
- npm install -g npm@2.5
50+
# Instal npm dependecies and ensure that npm cache is not stale
51+
- scripts/npm/install-dependencies.sh
2852

2953
before_script:
3054
- mkdir -p $LOGS_DIR
31-
- ./lib/sauce/sauce_connect_setup.sh
55+
- ./scripts/travis/start_browser_provider.sh
3256
- npm install -g grunt-cli
3357
- grunt package
3458
- ./scripts/travis/wait_for_browser_provider.sh

‎lib/browser-stack/start-tunnel.sh

-1
This file was deleted.

‎lib/browser-stack/start-tunnel.js ‎lib/browserstack/start_tunnel.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ var http = require('http');
55
var BrowserStackTunnel = require('browserstacktunnel-wrapper');
66

77
var HOSTNAME = 'localhost';
8-
var PORTS = require('../grunt/utils').availablePorts;
8+
var PORTS = [9876, 8000];
99
var ACCESS_KEY = process.env.BROWSER_STACK_ACCESS_KEY;
10-
var READY_FILE = process.env.SAUCE_CONNECT_READY_FILE;
10+
var READY_FILE = process.env.BROWSER_PROVIDER_READY_FILE;
11+
var TUNNEL_IDENTIFIER = process.env.TRAVIS_JOB_NUMBER;
1112

1213
// We need to start fake servers, otherwise the tunnel does not start.
1314
var fakeServers = [];
@@ -24,6 +25,7 @@ PORTS.forEach(function(port) {
2425

2526
var tunnel = new BrowserStackTunnel({
2627
key: ACCESS_KEY,
28+
tunnelIdentifier: TUNNEL_IDENTIFIER,
2729
hosts: hosts
2830
});
2931

‎lib/browserstack/start_tunnel.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev`
2+
3+
node ./lib/browserstack/start_tunnel.js &

‎lib/sauce/sauce_connect_setup.sh ‎lib/saucelabs/start_tunnel.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ set -e
1212
# before_script:
1313
# - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash
1414

15-
CONNECT_URL="https://saucelabs.com/downloads/sc-4.3-linux.tar.gz"
15+
CONNECT_URL="https://saucelabs.com/downloads/sc-4.3.7-linux.tar.gz"
1616
CONNECT_DIR="/tmp/sauce-connect-$RANDOM"
17-
CONNECT_DOWNLOAD="sc-4.3-linux.tar.gz"
17+
CONNECT_DOWNLOAD="sc-4.3.7-linux.tar.gz"
1818

1919
CONNECT_LOG="$LOGS_DIR/sauce-connect"
2020
CONNECT_STDOUT="$LOGS_DIR/sauce-connect.stdout"
@@ -46,5 +46,5 @@ echo "Starting Sauce Connect in the background, logging into:"
4646
echo " $CONNECT_LOG"
4747
echo " $CONNECT_STDOUT"
4848
echo " $CONNECT_STDERR"
49-
sauce-connect/bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY $ARGS -v \
49+
sauce-connect/bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY $ARGS \
5050
--logfile $CONNECT_LOG 2> $CONNECT_STDERR 1> $CONNECT_STDOUT &

‎scripts/npm/clean-shrinkwrap.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* this script is just a temporary solution to deal with the issue of npm outputting the npm
5+
* shrinkwrap file in an unstable manner.
6+
*
7+
* See: https://github.com/npm/npm/issues/3581
8+
*/
9+
10+
var _ = require('lodash');
11+
var sorted = require('sorted-object');
12+
var fs = require('fs');
13+
var path = require('path');
14+
15+
16+
function cleanModule(module, name) {
17+
18+
// keep `resolve` properties for git dependencies, delete otherwise
19+
delete module.from;
20+
if (!(module.resolved && module.resolved.match(/^git(\+[a-z]+)?:\/\//))) {
21+
delete module.resolved;
22+
}
23+
24+
_.forEach(module.dependencies, function(mod, name) {
25+
cleanModule(mod, name);
26+
});
27+
}
28+
29+
30+
console.log('Reading npm-shrinkwrap.json');
31+
var shrinkwrap = require('../../npm-shrinkwrap.json');
32+
33+
console.log('Cleaning shrinkwrap object');
34+
cleanModule(shrinkwrap, shrinkwrap.name);
35+
36+
var cleanShrinkwrapPath = path.join(__dirname, '..', '..', 'npm-shrinkwrap.clean.json');
37+
console.log('Writing cleaned to', cleanShrinkwrapPath);
38+
fs.writeFileSync(cleanShrinkwrapPath, JSON.stringify(sorted(shrinkwrap), null, 2) + "\n");

‎scripts/npm/install-dependencies.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
SHRINKWRAP_FILE=npm-shrinkwrap.json
6+
SHRINKWRAP_CACHED_FILE=node_modules/npm-shrinkwrap.cached.json
7+
8+
if diff -q $SHRINKWRAP_FILE $SHRINKWRAP_CACHED_FILE; then
9+
echo 'No shrinkwrap changes detected. npm install will be skipped...';
10+
else
11+
echo 'Blowing away node_modules and reinstalling npm dependencies...'
12+
rm -rf node_modules
13+
npm install
14+
cp $SHRINKWRAP_FILE $SHRINKWRAP_CACHED_FILE
15+
echo 'npm install successful!'
16+
fi

‎scripts/travis/build.sh

+15-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,27 @@
22

33
set -e
44

5+
export BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev`
56
export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
67

78
if [ $JOB = "unit" ]; then
8-
grunt ci-checks
9+
if [ "$BROWSER_PROVIDER" == "browserstack" ]; then
10+
BROWSERS="BS_Chrome,BS_Safari,BS_Firefox,BS_IE_8,BS_IE_9,BS_IE_10,BS_IE_11"
11+
else
12+
BROWSERS="SL_Chrome,SL_Safari,SL_Firefox,SL_IE_8,SL_IE_9,SL_IE_10,SL_IE_11"
13+
fi
14+
915
grunt test:promises-aplus
10-
grunt test:unit --browsers SL_Chrome,SL_Safari,SL_Firefox,SL_IE_8,SL_IE_9,SL_IE_10,SL_IE_11 --reporters dots
11-
grunt tests:docs --browsers SL_Chrome,SL_Safari,SL_Firefox,SL_IE_8,SL_IE_9,SL_IE_10,SL_IE_11 --reporters dots
16+
grunt test:unit --browsers $BROWSERS --reporters dots
17+
grunt ci-checks
18+
grunt tests:docs --browsers $BROWSERS --reporters dots
19+
elif [ $JOB = "docs-e2e" ]; then
1220
grunt test:travis-protractor --specs "docs/app/e2e/**/*.scenario.js"
1321
elif [ $JOB = "e2e" ]; then
22+
if [ $TEST_TARGET = "jquery" ]; then
23+
export USE_JQUERY=1
24+
fi
25+
1426
export TARGET_SPECS="build/docs/ptore2e/**/default_test.js"
1527
if [ $TEST_TARGET = "jquery" ]; then
1628
TARGET_SPECS="build/docs/ptore2e/**/jquery_test.js"
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# Has to be run from project root directory.
3+
4+
5+
if [ "$BROWSER_PROVIDER" == "browserstack" ]; then
6+
echo "Using BrowserStack"
7+
elif [ "$BROWSER_PROVIDER" == "saucelabs" ]; then
8+
echo "Using SauceLabs"
9+
else
10+
echo "Invalid BROWSER_PROVIDER. Please set env var BROWSER_PROVIDER to 'saucelabs' or 'browserstack'."
11+
exit 1
12+
fi
13+
14+
./lib/${BROWSER_PROVIDER}/start_tunnel.sh

‎scripts/travis/wait_for_browser_provider.sh

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33

44
# Wait for Connect to be ready before exiting
5+
# Time out if we wait for more than 2 minutes, so that we can print logs.
6+
let "counter=0"
7+
58
while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do
9+
let "counter++"
10+
if [ $counter -gt 240 ]; then
11+
echo "Timed out after 2 minutes waiting for browser provider ready file"
12+
# We must manually print logs here because travis will not run
13+
# after_script commands if the failure occurs before the script
14+
# phase.
15+
./scripts/travis/print_logs.sh
16+
exit 5
17+
fi
618
sleep .5
719
done

‎test/AngularSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ describe('angular', function() {
786786

787787
it('should bootstrap using class name', function() {
788788
var appElement = jqLite('<div class="ng-app: ABC;"></div>')[0];
789-
angularInit(jqLite('<div></div>').append(appElement)[0], bootstrapSpy);
789+
angularInit(appElement, bootstrapSpy);
790790
expect(bootstrapSpy).toHaveBeenCalledOnceWith(appElement, ['ABC']);
791791
});
792792

0 commit comments

Comments
 (0)