Skip to content

Commit

Permalink
chore(ci): configure Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanrsmith committed Dec 16, 2015
1 parent d37f970 commit ef3003f
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 80 deletions.
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
language: node_js
node_js:
- "stable"

sudo: false

notifications:
email: false

cache:
directories:
- node_modules
- jspm_packages

branches:
only:
- master

install:
- npm install
- jspm config registries.github.auth $JSPM_GITHUB_AUTH_TOKEN
- node_modules/.bin/jspm install

before_script:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

script:
- npm run ci
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# aurelia-history-browser

[![Build Status](https://travis-ci.org/aurelia/history-browser.svg?branch=master)](https://travis-ci.org/aurelia/history-browser)
[![Coverage Status](https://coveralls.io/repos/aurelia/history-browser/badge.svg?branch=master&service=github)](https://coveralls.io/github/aurelia/history-browser?branch=master)
[![npm Version](https://img.shields.io/npm/v/aurelia-history-browser.svg)](https://www.npmjs.com/package/aurelia-history-browser)
[![ZenHub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.io)
[![Join the chat at https://gitter.im/aurelia/discuss](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aurelia/discuss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Expand Down
1 change: 1 addition & 0 deletions build/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
module.exports = {
root: appRoot,
source: appRoot + '**/*.js',
tests: 'test/**/*.js',
html: appRoot + '**/*.html',
style: 'styles/**/*.css',
output: 'dist/',
Expand Down
3 changes: 3 additions & 0 deletions build/tasks/ci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var gulp = require('gulp');

gulp.task('ci', ['default', 'coveralls']);
12 changes: 12 additions & 0 deletions build/tasks/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var gulp = require('gulp');
var runSequence = require('run-sequence');

gulp.task('default', function(callback) {
return runSequence(
'lint',
'build',
'doc',
'test',
callback
);
});
40 changes: 17 additions & 23 deletions build/tasks/test.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
var gulp = require('gulp');
var Karma = require('karma').Server;
var karma = require('karma');
var coveralls = require('gulp-coveralls');

/**
* Run test once and exit
*/
gulp.task('test', function (done) {
new Karma({
configFile: __dirname + '/../../karma.conf.js',
singleRun: true
}, done).start();
new karma.Server({
configFile: __dirname + '/../../karma.conf.js',
singleRun: true
}, function(e) {
done(e === 0 ? null : 'karma exited with status ' + e);
}).start();
});

/**
* Watch for file changes and re-run tests on each change
*/
gulp.task('tdd', function (done) {
new Karma({
configFile: __dirname + '/../../karma.conf.js'
}, done).start();
new karma.Server({
configFile: __dirname + '/../../karma.conf.js'
}, function(e) {
done();
}).start();
});

/**
* Run test once with code coverage and exit
* Report coverage to coveralls
*/
gulp.task('cover', function (done) {
new Karma({
configFile: __dirname + '/../../karma.conf.js',
singleRun: true,
reporters: ['coverage'],
preprocessors: {
'test/**/*.js': ['babel'],
'src/**/*.js': ['babel', 'coverage']
},
coverageReporter: {
type: 'html',
dir: 'build/reports/coverage'
}
}, done).start();
gulp.task('coveralls', ['test'], function (done) {
gulp.src('build/reports/coverage/lcov/report-lcovonly.txt')
.pipe(coveralls());
});
105 changes: 52 additions & 53 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,82 +1,81 @@
// Karma configuration
// Generated on Fri Dec 05 2014 16:49:29 GMT-0500 (EST)
var isparta = require('isparta');
var paths = require('./build/paths');
var babelOptions = require('./build/babel-options');

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
var configuration = {
frameworks: ['jspm', 'jasmine'],

jspm: {
// Edit this to your needs
loadFiles: ['src/**/*.js', 'test/**/*.js']
config: 'config.js',
loadFiles: [paths.tests],
serveFiles: [paths.source]
},


// list of files / patterns to load in the browser
files: [],


// list of files to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/**/*.js': ['babel'],
'src/**/*.js': ['babel']
[paths.tests]: ['babel'],
[paths.source]: ['babel', 'sourcemap', 'coverage']
},
'babelPreprocessor': {

babelPreprocessor: {
options: {
sourceMap: 'inline',
modules: 'system',
moduleIds: false,
loose: "all",
optional: [
"es7.decorators",
"es7.classProperties"
]
loose: babelOptions.loose,
stage: babelOptions.stage,
optional: babelOptions.optional,
sourceMap: 'inline'
}
},

reporters: ['coverage', 'progress'],

coverageReporter: {
instrumenters: {
isparta: isparta
},

instrumenter: {
[paths.source]: 'isparta'
},

dir: 'build/reports/coverage/',

reporters: [{
type: 'text-summary'
}, {
type: 'html',
subdir: 'html'
}, {
type: 'lcovonly',
subdir: 'lcov',
file: 'report-lcovonly.txt'
}]
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};

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

config.set(configuration);
};
18 changes: 14 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
"type": "git",
"url": "http://github.com/aurelia/history-browser"
},
"scripts": {
"test": "gulp test",
"ci": "gulp ci"
},
"jspmNodeConversion": false,
"jspm": {
"main": "aurelia-history-browser",
Expand All @@ -42,7 +46,7 @@
"core-js": "^1.2.6"
},
"devDependencies": {
"aurelia-tools": "^0.1.12",
"aurelia-tools": "0.1.16",
"babel-dts-generator": "^0.2.17",
"babel-eslint": "^4.1.1",
"conventional-changelog": "0.0.11",
Expand All @@ -51,18 +55,24 @@
"gulp-babel": "^5.2.1",
"gulp-bump": "^0.3.1",
"gulp-concat": "^2.6.0",
"gulp-coveralls": "0.1.4",
"gulp-eslint": "^1.0.0",
"gulp-insert": "^0.5.0",
"gulp-rename": "^1.2.2",
"gulp-typedoc": "^1.2.1",
"gulp-typedoc-extractor": "^0.0.8",
"isparta": "4.0.0",
"istanbul": "github:gotwarlost/istanbul#source-map",
"jasmine-core": "^2.1.3",
"karma": "^0.13.15",
"jspm": "0.16.18",
"karma": "0.13.15",
"karma-babel-preprocessor": "^5.2.2",
"karma-chrome-launcher": "^0.1.7",
"karma-coverage": "^0.3.1",
"karma-chrome-launcher": "0.1.12",
"karma-coverage": "github:douglasduteil/karma-coverage#next",
"karma-firefox-launcher": "0.1.7",
"karma-jasmine": "^0.3.5",
"karma-jspm": "^2.0.1",
"karma-sourcemap-loader": "0.3.6",
"object.assign": "^1.0.3",
"require-dir": "^0.1.0",
"run-sequence": "^1.0.2",
Expand Down

0 comments on commit ef3003f

Please sign in to comment.