add travis config

This commit is contained in:
spalger 2016-03-10 22:23:32 -07:00
parent f0aaff5817
commit cd11af7367
4 changed files with 52 additions and 0 deletions

21
.travis.yml Normal file
View file

@ -0,0 +1,21 @@
language: node_js
node_js: 4
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
install:
- npm install
- npm run setup_kibana
cache:
directories:
- node_modules
- ../kibana
script: npm test

View file

@ -126,4 +126,5 @@ module.exports = function (grunt) {
require('./tasks/build')(grunt);
require('./tasks/release')(grunt);
require('./tasks/setup_kibana')(grunt);
};

View file

@ -13,6 +13,8 @@
"build": "grunt build",
"release": "grunt release",
"lint": "grunt eslint:source",
"setup_kibana": "grunt setup_kibana",
"test": "npm run test:server",
"test:server": "plugin-helpers test:server"
},
"devDependencies": {

28
tasks/setup_kibana.js Normal file
View file

@ -0,0 +1,28 @@
const exec = require('child_process').execFileSync;
const stat = require('fs').statSync;
const fromRoot = require('path').resolve.bind(null, __dirname, '../');
module.exports = function (grunt) {
grunt.registerTask('setup_kibana', function () {
const kbnDir = fromRoot('../kibana');
const kbnGitDir = fromRoot('../kibana/.git');
try {
if (stat(kbnGitDir).isDirectory()) {
exec('git', ['pull', 'origin', 'master'], { cwd: kbnDir });
} else {
throw new Error(`${kbnGitDir} is not a directory??`);
}
} catch (error) {
if (error.code === 'ENOENT') {
exec('git', ['clone', 'https://github.com/elastic/kibana.git', kbnDir]);
} else {
throw error;
}
}
exec('npm', ['prune'], { cwd: kbnDir });
exec('npm', ['install'], { cwd: kbnDir });
});
};