Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(infrastructure): Set up continuous integration #4580

Merged
merged 1 commit into from
Jul 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
sudo: required
language: node_js
node_js:
- node # stable
- '4' # LTS
branches:
only:
- master
before_install:
- '[ -n "$SAUCE_ACCESS_KEY" ] || echo "NON-SECURE BUILD. Falling back to Chrome + FF only."'
- '[ -n "$SAUCE_ACCESS_KEY" ] || export CHROME_BIN=/usr/bin/google-chrome'
- '[ -n "$SAUCE_ACCESS_KEY" ] || export DISPLAY=:99.0'
- '[ -n "$SAUCE_ACCESS_KEY" ] || sh -e /etc/init.d/xvfb start'
- '[ -n "$SAUCE_ACCESS_KEY" ] || sudo apt-get update'
- '[ -n "$SAUCE_ACCESS_KEY" ] || sudo apt-get install -y libappindicator1 fonts-liberation'
- '[ -n "$SAUCE_ACCESS_KEY" ] || wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb'
- '[ -n "$SAUCE_ACCESS_KEY" ] || sudo dpkg -i google-chrome*.deb'
env:
global:
- SAUCE_USERNAME=material-sauce
-
secure: aJ9IOc3ngZAujpeNdRRfEZf32tEiPJhNEt/QeoKspP+ivDDxtX4tP+5PlefnQqu5z4M1puF4A6UyiKXZJ5AThFBX0L+FP531lCNibZppyK7KZgl68O92iBooA0EZH45Pb36v9rN5Xl4ZwzJhcx8QiFWXwHp3fQHCgtoxiSdaOBt3l63Wg1vCFPSPPI/8BGiJDwxrOretholor63gMBXUoxJl2ZCMG8NnT5KF1YBzi6ZEWtMLBnuEeKxQcgi3l70UJfR9K/VTfxaoctGrc9UfmyJmD27gGHdBZc0HfZF0Z00SufXn7hILUqfaioJPzRylKxEy0h0KTeX5ZBEQNeLXSIxfcnFHbKk5OeTCkIF+cs9hUrhQfwTpoxyLNPNNeg8P2DMkUvBy/QllEuiESg3LcJlM/ziLhHJpZ7MerbSAZC91rQKX7N/2R8UkaKH6GkEMf5JtK+t1s1fgInBMfPt6oqY250GFq6QJaO/n9a5ndBnDIkjBqbUQYD+8IE793t9HjAN7XwYBk+WgLiStWR+FACLN1VLg8+9K6SfnQujOO2ZYXe2Q2Bdbwk5QqJQCvvb1WHKRMOG2+DN9A2S8zOVfGdC1B9Ih/UZXmXF0r+fEOiY2yuWhgSwd5r16KERxgnG189Gs+7kveT0gfl8SUdEXTEF+fATGEcG+RIv2LSrCNVY=
addons:
firefox: latest
sauce_connect: true
108 changes: 107 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,90 @@
const path = require('path');
const webpackConfig = require('./webpack.config')[0];

const USING_TRAVISCI = Boolean(process.env.TRAVIS);
const USING_SL = Boolean(process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY);

const SL_LAUNCHERS = {
'sl-chrome-stable': {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest',
platform: 'OS X 10.11'
},
'sl-chrome-beta': {
base: 'SauceLabs',
browserName: 'chrome',
version: 'beta'
},
'sl-chrome-previous': {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest-1',
platform: 'OS X 10.11'
},
'sl-firefox-stable': {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest',
platform: 'Windows 10'
},
'sl-firefox-previous': {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest-1',
platform: 'Windows 10'
},
// NOTE(traviskaufman): Tried adding Firefox beta but it was consistently flaky. Holding off on adding
// it in for now. If it proves to be less flaky in the future, we should add it.
'sl-safari-stable': {
base: 'SauceLabs',
browserName: 'safari',
version: '9',
platform: 'OS X 10.11'
},
'sl-safari-previous': {
base: 'SauceLabs',
browserName: 'safari',
version: '8',
platform: 'OS X 10.10'
},
'sl-ie': {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '11',
platform: 'Windows 8.1'
},
'sl-edge': {
base: 'SauceLabs',
browserName: 'microsoftedge',
version: 'latest',
platform: 'Windows 10'
},
'sl-android-stable': {
base: 'SauceLabs',
browserName: 'android',
version: '5.0'
},
'sl-ios-safari-latest': {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.10',
version: '9.1'
},
'sl-ios-safari-previous': {
base: 'SauceLabs',
browserName: 'iphone',
version: '8.4'
}
};

const TRAVISCI_FALLBACK_LAUNCHERS = {
'travisci-chrome': {
base: 'Chrome',
flags: ['--no-sandbox']
}
};

module.exports = function(config) {
config.set({
basePath: '',
Expand All @@ -15,8 +99,12 @@ module.exports = function(config) {
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
browsers: ['Chrome'],
browsers: getBrowsers(),
browserDisconnectTimeout: 20000,
browserNoActivityTimeout: 240000,
captureTimeout: 120000,
concurrency: Infinity,
customLaunchers: USING_SL ? SL_LAUNCHERS : TRAVISCI_FALLBACK_LAUNCHERS,

coverageReporter: {
dir: 'coverage',
Expand Down Expand Up @@ -46,4 +134,22 @@ module.exports = function(config) {
noInfo: true
}
});

// See https://github.com/karma-runner/karma-sauce-launcher/issues/73
if (USING_TRAVISCI) {
config.set({
sauceLabs: {
testName: 'Material Design Lite Unit Tests - CI',
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
startConnect: false
}
});
}
};

function getBrowsers() {
if (USING_SL) {
return Object.keys(SL_LAUNCHERS);
}
return USING_TRAVISCI ? Object.keys(TRAVISCI_FALLBACK_LAUNCHERS).concat(['Firefox']) : ['Chrome'];
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"karma": "^1.1.1",
"karma-chrome-launcher": "^1.0.1",
"karma-coverage": "^1.1.0",
"karma-firefox-launcher": "^1.0.0",
"karma-sauce-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-tap": "^2.0.1",
"karma-webpack": "^1.7.0",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mdl-auto-init/mdl-auto-init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const createFixture = () => bel`

const setupTest = () => {
mdlAutoInit.deregisterAll();
mdlAutoInit.register(FakeComponent.name, FakeComponent);
mdlAutoInit.register('FakeComponent', FakeComponent);
return createFixture();
};

Expand Down