Permalink
Browse files

chore: setup Travis

Closes #17
  • Loading branch information...
1 parent e9069b0 commit 78663329c3b2353d41950b7bbed44e8bb7de4711 @mlaval mlaval committed Apr 15, 2016
View
@@ -0,0 +1,18 @@
+language: node_js
+sudo: false
+node_js:
+- '5.10.1'
+
+cache:
+ directories:
+ - $HOME/.chrome/chromium
+
+before_install:
+ - npm install -g gulp typings
+ - ./scripts/install_chromium.sh
+ - export CHROME_BIN=$HOME/.chrome/chromium/chrome-linux/chrome
+ - export DISPLAY=:99.0
+ - sh -e /etc/init.d/xvfb start
+
+script:
+ - npm test
View
@@ -1,3 +1,6 @@
+[![Join the chat at https://gitter.im/angular/react-native-renderer](https://badges.gitter.im/angular/react-native-renderer.svg)](https://gitter.im/angular/react-native-renderer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Build Status](https://travis-ci.org/angular/react-native-renderer.svg?branch=master)](https://travis-ci.org/angular/react-native-renderer)
+
# angular2-react-native
Use Angular 2 and React Native to build applications for Android and iOS.
View
@@ -168,7 +168,8 @@ gulp.task('test.browser', ['ts2system'], function (neverDone) {
gulp.task('test.browser/ci', ['ts2system'], function(done) {
new karma({
configFile: path.join(__dirname, 'karma.conf.js'),
- singleRun: true
+ singleRun: true,
+ browsers: [process.env.TRAVIS ? 'ChromeNoSandbox' : 'Chrome']
}, done).start();
});
View
@@ -22,6 +22,13 @@ module.exports = function(config) {
{pattern: 'dist/code/test/**/*.js', included: false, watched: true}
],
+ customLaunchers: {
+ 'ChromeNoSandbox': {
+ base: 'Chrome',
+ flags: ['--no-sandbox']
+ }
+ },
+
reporters: ['dots'],
port: 9876,
colors: true,
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+set -e -x
+
+# This script basically follows the instructions to download an old version of Chromium: https://www.chromium.org/getting-involved/download-chromium
+# 1) It retrieves the current stable version number from https://www.chromium.org/developers/calendar (via the https://omahaproxy.appspot.com/all file), e.g. 359700 for Chromium 48.
+# 2) It checks the Travis cache for this specific version
+# 3) If not available, it downloads and caches it, using the "decrement commit number" trick.
+
+#Build version read from the OmahaProxy CSV Viewer at https://www.chromium.org/developers/calendar
+#Let's use the following version of Chromium, and inform about availability of newer build from https://omahaproxy.appspot.com/all
+CHROMIUM_VERSION=369907
+
+PLATFORM="$(uname -s)"
+case "$PLATFORM" in
+ (Darwin)
+ ARCHITECTURE=Mac
+ DIST_FILE=chrome-mac.zip
+ ;;
+ (Linux)
+ ARCHITECTURE=Linux_x64
+ DIST_FILE=chrome-linux.zip
+ ;;
+ (*)
+ echo Unsupported platform $PLATFORM. Exiting ... >&2
+ exit 3
+ ;;
+esac
+
+TMP=$(curl -s "https://omahaproxy.appspot.com/all") || true
+oldIFS="$IFS"
+IFS='
+'
+IFS=${IFS:0:1}
+lines=( $TMP )
+IFS=','
+for line in "${lines[@]}"
+ do
+ lineArray=($line);
+ if [ "${lineArray[0]}" = "linux" ] && [ "${lineArray[1]}" = "stable" ] ; then
+ LATEST_CHROMIUM_VERSION="${lineArray[7]}"
+ fi
+done
+IFS="$oldIFS"
+
+CHROMIUM_DIR=$HOME/.chrome/chromium
+CHROMIUM_BIN=$CHROMIUM_DIR/chrome-linux/chrome
+CHROMIUM_VERSION_FILE=$CHROMIUM_DIR/VERSION
+
+EXISTING_VERSION=""
+if [[ -f $CHROMIUM_VERSION_FILE && -x $CHROMIUM_BIN ]]; then
+ EXISTING_VERSION=`cat $CHROMIUM_VERSION_FILE`
+ echo Found cached Chromium version: ${EXISTING_VERSION}
+fi
+
+if [[ "$EXISTING_VERSION" != "$CHROMIUM_VERSION" ]]; then
+ echo Downloading Chromium version: ${CHROMIUM_VERSION}
+ rm -fR $CHROMIUM_DIR
+ mkdir -p $CHROMIUM_DIR
+
+ NEXT=$CHROMIUM_VERSION
+ FILE="chrome-linux.zip"
+ STATUS=404
+ while [[ $STATUS == 404 && $NEXT -ge 0 ]]
+ do
+ echo Fetch Chromium version: ${NEXT}
+ STATUS=$(curl "https://storage.googleapis.com/chromium-browser-snapshots/${ARCHITECTURE}/${NEXT}/${DIST_FILE}" -s -w %{http_code} --create-dirs -o $FILE) || true
+ NEXT=$[$NEXT-1]
+ done
+
+ unzip $FILE -d $CHROMIUM_DIR
+ rm $FILE
+ echo $CHROMIUM_VERSION > $CHROMIUM_VERSION_FILE
+fi
+
+if [[ "$CHROMIUM_VERSION" != "$LATEST_CHROMIUM_VERSION" ]]; then
+ echo "New version of Chromium available. Update install_chromium.sh with build number: ${LATEST_CHROMIUM_VERSION}"
+fi
+
@@ -73,7 +73,7 @@ describe('DrawerLayout component (Android)', () => {
rootRenderer.executeCommands();
expect(fixture.componentInstance.log.join(',')).toEqual('1');
resolve();
- }, 30);
+ }, 150);
});
});
@@ -96,7 +96,7 @@ describe('DrawerLayout component (Android)', () => {
rootRenderer.executeCommands();
expect(mock.commandLogs.toString()).toEqual('DISMISS_KEYBOARD+-1+');
resolve();
- }, 30);
+ }, 150);
});
});
@@ -67,7 +67,7 @@ describe('PagerLayout component (Android)', () => {
rootRenderer.executeCommands();
expect(fixture.componentInstance.log.join(',')).toEqual('1');
resolve();
- }, 30);
+ }, 150);
});
});
@@ -90,7 +90,7 @@ describe('PagerLayout component (Android)', () => {
rootRenderer.executeCommands();
expect(mock.commandLogs.toString()).toEqual('DISMISS_KEYBOARD+-1+');
resolve();
- }, 30);
+ }, 150);
});
});
@@ -122,7 +122,7 @@ describe('PagerLayout component (Android)', () => {
fixture.detectChanges();
expect(mock.commandLogs.toString()).toEqual('COMMAND+3+setPageWithoutAnimation+1');
resolve();
- }, 50);
+ }, 150);
});
});
}));
@@ -66,7 +66,7 @@ describe('Toolbar component (Android)', () => {
rootRenderer.executeCommands();
expect(fixture.componentInstance.log.join(',')).toEqual('1');
resolve();
- }, 100);
+ }, 150);
});
});
@@ -67,7 +67,7 @@ describe('Image component', () => {
rootRenderer.executeCommands();
expect(fixture.componentInstance.log.join(',')).toEqual('foo');
resolve();
- }, 30);
+ }, 150);
});
});
@@ -65,7 +65,7 @@ describe('DatePicker component (iOS)', () => {
setTimeout(() => {
expect(fixture.componentInstance.log.join(',')).toEqual('42');
resolve();
- }, 30);
+ }, 150);
});
});
@@ -69,7 +69,7 @@ describe('DatePicker component (iOS)', () => {
setTimeout(() => {
expect(fixture.componentInstance.log.join(',')).toEqual('click');
resolve();
- }, 100);
+ }, 150);
});
});
@@ -45,7 +45,7 @@ describe('Navigator component (iOS)', () => {
'CREATE+5+cmp-a+{},CREATE+6+native-text+{},CREATE+7+native-rawtext+{"text":"a"},ATTACH+6+7+0,ATTACH+5+6+0,ATTACH+4+5+0');
resolve();
}, 0);
- }, 30);
+ }, 150);
});
});
}));
@@ -65,7 +65,7 @@ describe('SegmentedControl component (iOS)', () => {
setTimeout(() => {
expect(fixture.componentInstance.log.join(',')).toEqual('0');
resolve();
- }, 30);
+ }, 150);
});
});
@@ -65,7 +65,7 @@ describe('Slider component (iOS)', () => {
setTimeout(() => {
expect(fixture.componentInstance.log.join(',')).toEqual('0.55');
resolve();
- }, 80);
+ }, 150);
});
});
@@ -94,7 +94,7 @@ describe('TabBar component (iOS)', () => {
expect(mock.commandLogs.toString()).toEqual(
'CREATE+7+native-view+{"margin":2},UPDATE+4+native-tabbaritem+{"selected":false},UPDATE+5+native-tabbaritem+{"selected":true},ATTACH+5+7+0');
resolve();
- }, 30);
+ }, 150);
});
});
@@ -79,7 +79,7 @@ describe('Picker component', () => {
rootRenderer.executeCommands();
expect(mock.commandLogs.toString()).toEqual('UPDATE+3+native-dialogpicker+{"selected":0}');
resolve();
- }, 30);
+ }, 150);
});
});
@@ -67,7 +67,7 @@ describe('RefreshControl component', () => {
expect(fixture.componentInstance.log.join(',')).toEqual('foo');
expect(mock.commandLogs.toString()).toEqual('UPDATE+3+native-refreshcontrol+{"refreshing":false}');
resolve();
- }, 30);
+ }, 150);
});
});
@@ -97,7 +97,7 @@ describe('ScrollView component', () => {
rootRenderer.executeCommands();
expect(fixture.componentInstance.log.join(',')).toEqual('foo');
resolve();
- }, 100);
+ }, 150);
});
});
@@ -68,7 +68,7 @@ describe('Switch component', () => {
rootRenderer.executeCommands();
expect(mock.commandLogs.toString()).toEqual('UPDATE+3+native-switch+{"on":true}');
resolve();
- }, 30);
+ }, 150);
});
});
@@ -69,7 +69,7 @@ describe('TextInput component', () => {
expect(fixture.componentInstance.log.join(',')).toEqual('foo');
expect(mock.commandLogs.toString()).toEqual('UPDATE+3+native-textinput+{"text":"bar"}');
resolve();
- }, 80);
+ }, 150);
});
});
@@ -102,7 +102,7 @@ describe('TextInput component', () => {
fixture.detectChanges();
expect(mock.commandLogs.toString()).toEqual('COMMAND+3+focusTextInput');
resolve();
- }, 50);
+ }, 150);
});
});
}));
@@ -66,7 +66,7 @@ describe('WebView component', () => {
rootRenderer.executeCommands();
expect(fixture.componentInstance.log.join(',')).toEqual('foo');
resolve();
- }, 30);
+ }, 150);
});
});

0 comments on commit 7866332

Please sign in to comment.