Skip to content

Commit

Permalink
build(travis): reconfigure travis to support jobs matrix, setup sauce…
Browse files Browse the repository at this point in the history
…labs, browserstack)

Temporary allowing to fail for sauce labs, as no free account provided yet.
  • Loading branch information
nnixaa authored Jan 18, 2018
1 parent a9324b4 commit 26eabac
Show file tree
Hide file tree
Showing 16 changed files with 2,102 additions and 211 deletions.
58 changes: 29 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
language: node_js

sudo: false
dist: trusty

language: node_js
node_js:
- '8'

cache:
directories:
- node_modules

env:
global:
- SAUCE_USERNAME=nixa
- SAUCE_ACCESS_KEY=a922753805a4-7538-6644-c450-48fdf18c
- BROWSER_STACK_USERNAME=debac1
- BROWSER_STACK_ACCESS_KEY=V5ykpyxrTxXLSsRBmXpL
- BROWSER_PROVIDER_READY_FILE=/tmp/nebular/readyfile
- BROWSER_PROVIDER_ERROR_FILE=/tmp/nebular/errorfile
- LOGS_DIR=/tmp/nebular/logs
matrix:
- MODE=sauce_e2e
- MODE=browserstack_e2e
- MODE=sauce_unit_test
- MODE=browserstack_unit_test
- MODE=build
- MODE=docs
- MODE=lint
branches:
only:
- master

addons:
apt:
sources:
- ubuntu-toolchain-r-test
- google-chrome
packages:
- g++-4.8
- google-chrome-stable
git:
depth: 1

before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm i -g npm@latest
matrix:
fast_finish: true
allow_failures:
- env: "MODE=sauce_e2e"
- env: "MODE=sauce_unit_test"
- env: "MODE=browserstack_unit_test"

install:
- travis_retry npm i
- npm install

before_script:
- mkdir -p $LOGS_DIR

script:
- npm run lint:ci
- npm run build:prod
- npm run release:validate
- npm run docs:ci

git:
depth: 1
- ./scripts/ci/travis-script.sh
73 changes: 66 additions & 7 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ module.exports = function (config) {
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-sauce-launcher'),
require('karma-browserstack-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
client:{
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
Expand All @@ -27,19 +29,76 @@ module.exports = function (config) {
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
browsers: ['ChromeHeadlessLocal'],
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
ChromeHeadlessLocal: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--window-size=1024,768'
]
},
SauceChromeCI: {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest'
},
BrowserstackChromeCI: {
base: 'BrowserStack',
browser: 'Chrome',
version: 'latest'
}
},
browserConsoleLogOptions: {
terminal: true,
level: 'log'
},
sauceLabs: {
testName: 'Nebular Unit Tests',
startConnect: false,
recordVideo: false,
recordScreenshots: false,
idleTimeout: 600,
commandTimeout: 600,
maxDuration: 5400
},
browserStack: {
project: 'Nebular Unit Tests',
startTunnel: false,
retryLimit: 1,
timeout: 600,
pollingTimeout: 20000,
video: false,
},
singleRun: false
};

if (process.env.TRAVIS) {
configuration.browsers = ['Chrome_travis_ci'];
if (process.env['TRAVIS']) {

const [platform] = process.env.MODE.split('_');
const buildId = `TRAVIS #${process.env['TRAVIS_BUILD_NUMBER']} (${process.env['TRAVIS_BUILD_ID']})`;

if (platform === 'sauce') {
const key = require('./scripts/ci/sauce/config');

configuration.reporters.push('saucelabs');
configuration.sauceLabs.build = buildId;
configuration.sauceLabs.tunnelIdentifier = process.env['TRAVIS_JOB_ID'];
configuration.sauceLabs.username = process.env['SAUCE_USERNAME'];
configuration.sauceLabs.accessKey = key;
configuration.browsers = ['SauceChromeCI'];
} else if (platform === 'browserstack') {
const key = require('./scripts/ci/browserstack/config');

configuration.reporters.push('BrowserStack');
configuration.browserStack.build = buildId;
configuration.browserStack.tunnelIdentifier = process.env['TRAVIS_JOB_ID'];
configuration.browserStack.username = process.env['BROWSER_STACK_USERNAME'];
configuration.browserStack.accessKey = key;
configuration.browsers = ['BrowserstackChromeCI'];
}
}

console.log(configuration);
config.set(configuration);
};
Loading

0 comments on commit 26eabac

Please sign in to comment.