提交 22ca5602 编写于 作者: S Sercan

trying to fix travis build

上级 4cb7e54a
#!/usr/bin/env node
var path = require('path'),
fs = require('fs'),
extend = require('util')._extend,
exec = require('child_process').exec,
processes = [];
var baseDir = path.resolve(__dirname, '..'),
srcDir = path.resolve(baseDir, ''),
chimpBin = path.resolve(baseDir, 'node_modules/.bin/chimp');
var appOptions = {
settings: 'settings.json',
port: 3000,
env: {
ROOT_URL: 'http://localhost:3000',
VELOCITY: 1,
JASMINE_CLIENT_UNIT: 0,
JASMINE_SERVER_UNIT: 0,
JASMINE_CLIENT_INTEGRATION: 0,
JASMINE_SERVER_INTEGRATION: 1
}
};
var mirrorOptions = {
settings: appOptions.settings,
port: 3100,
env: {
IS_MIRROR: 1,
MONGO_URL: 'mongodb://localhost:' + 3001 + '/chimp_db',
ROOT_URL: 'http://localhost:3100'
},
logFile: './chimp-mirror.log'
};
var chimpSwitches =
' --path=' + path.resolve('tests/features') +
//' -r=' + path.resolve('tests/features/step_definitions/domain') +
//' --criticalSteps=' + path.resolve('tests/features/step_definitions/critical') +
' --singleSnippetPerFile=1';
if (process.env.CI || process.env.TRAVIS || process.env.CIRCLECI) {
// when not in Watch mode, Chimp existing will exit Meteor too
// we also don't need Velocity for the app chimp will run against
appOptions.env.VELOCITY = 0;
} else {
chimpSwitches += ' --watch';
}
if (process.env.SIMIAN_API && process.env.SIMIAN_REPOSITORY) {
chimpSwitches += ' --simianRepositoryId=' + process.env.SIMIAN_REPOSITORY;
chimpSwitches += ' --simianAccessToken=' + process.env.SIMIAN_API;
}
if (process.env.CUCUMBER_JSON_OUTPUT) {
chimpSwitches += ' --jsonOutput=' + process.env.CUCUMBER_JSON_OUTPUT;
}
// set this flag to start with a mirror locally (ala Velocity xolvio:cucumber style)
if (process.env.WITH_MIRROR) {
chimpWithMirror();
} else if (process.env.NO_METEOR) {
startChimp('--ddp=' + appOptions.env.ROOT_URL + chimpSwitches);
} else {
chimpNoMirror();
}
// *************************************************
function chimpWithMirror() {
appOptions.waitForMessage = 'Started MongoDB';
startApp(function () {
startMirror(function () {
console.log('=> Test App running at:', mirrorOptions.env.ROOT_URL);
console.log('=> Log file: tail -f', path.resolve(mirrorOptions.logFile), '\n');
startChimp('--ddp=' + mirrorOptions.env.ROOT_URL + chimpSwitches
)
});
});
}
function chimpNoMirror() {
appOptions.waitForMessage = 'App running at';
startApp(function () {
startChimp('--ddp=' + appOptions.env.ROOT_URL + chimpSwitches);
});
}
function startApp(callback) {
startProcess({
name: 'Meteor App',
command: 'meteor --settings ' + appOptions.settings + ' --port ' + appOptions.port,
waitForMessage: appOptions.waitForMessage,
options: {
cwd: srcDir,
env: extend(appOptions.env, process.env)
}
}, callback);
}
function startMirror(callback) {
startProcess({
name: 'Meteor Mirror',
command: 'meteor --settings ' + mirrorOptions.settings + ' --port ' + mirrorOptions.port,
silent: true,
logFile: mirrorOptions.logFile,
waitForMessage: 'App running at',
options: {
cwd: srcDir,
env: extend(mirrorOptions.env, process.env)
}
}, callback);
}
function startChimp(command) {
startProcess({
name: 'Chimp',
command: chimpBin + ' ' + command
});
}
function startProcess(opts, callback) {
var proc = exec(
opts.command,
opts.options
);
if (opts.waitForMessage) {
proc.stdout.on('data', function waitForMessage(data) {
if (data.toString().match(opts.waitForMessage)) {
if (callback) {
callback();
}
}
});
}
if (!opts.silent) {
proc.stdout.pipe(process.stdout);
proc.stderr.pipe(process.stderr);
}
if (opts.logFile) {
var logStream = fs.createWriteStream(opts.logFile, {flags: 'a'});
proc.stdout.pipe(logStream);
proc.stderr.pipe(logStream);
}
proc.on('close', function (code) {
console.log(opts.name, 'exited with code ' + code);
for (var i = 0; i < processes.length; i += 1) {
processes[i].kill();
}
process.exit(code);
});
processes.push(proc);
}
#!/usr/bin/env node
var path = require('path'),
extend = require('util')._extend,
exec = require('child_process').exec;
// var chimpScript = path.resolve(__dirname, 'start.js');
// runTests();
// function runTests() {
// runChimp(function () {
// console.log('Yay!');
// });
// }
// function runChimp(callback) {
// startProcess({
// name: 'Chimp',
// options: {
// env: extend({CI: 1}, process.env)
// },
// command: chimpScript
// }, callback);
// }
// function startProcess(opts, callback) {
// var proc = exec(
// opts.command,
// opts.options
// );
// proc.stdout.pipe(process.stdout);
// proc.stderr.pipe(process.stderr);
// proc.on('close', function (code) {
// if (code > 0) {
// console.log(opts.name, 'exited with code ' + code);
// process.exit(code);
// } else {
// callback();
// }
// });
// }
sudo: true
dist: trusty
sudo: false
language: node_js
node_js:
- 5.2.0
env:
global:
MONGO_URL: "mongodb://localhost:27017/meteor"
before_install:
- curl https://install.meteor.com | /bin/sh
- export PATH="$HOME/.meteor:$PATH"
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
firefox: "latest"
script:
- meteor build $HOME/build.tgz
cache:
directories:
- "$HOME/node_modules"
- "$HOME/.npm"
- "$HOME/mongodb-linux-x86_64-2.6.4"
- "$HOME/.meteor"
- "src/.meteor/local/build"
- "src/.meteor/local/bundler-cache"
- "src/.meteor/local/db"
- "src/.meteor/local/isopacks"
- "src/.meteor/local/plugin-cache"
- "src/.meteor/local/mirrors"
before_cache:
- rm -rf $HOME/build/rsercano/mongoclient/.meteor/local/log
- rm -rf $HOME/build/rsercano/mongoclient/.meteor/local/run
before_install:
# Download Meteor
- PATH=$PATH:$HOME/.meteor
- if [ ! -e $HOME/.meteor/meteor ]; then curl -k https://install.meteor.com | sh; fi
# Use X Virtual Frame Buffer
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1027x768x16"
- sleep 3 # give xvfb some time to start
- "export DISPLAY=:99.0"
# Install and start MongoDB 2.6
- export MONGO_PACKAGE=mongodb-linux-x86_64-2.6.4
- export MONGO_HOME=$HOME/$MONGO_PACKAGE
- if [[ ! -e $MONGO_HOME/bin/mongod ]]; then cd $HOME; wget http://downloads.mongodb.org/linux/$MONGO_PACKAGE.tgz && tar xvzf $HOME/$MONGO_PACKAGE.tgz; fi
- export PATH=$MONGO_HOME/bin:$PATH
- mkdir -p $HOME/data/db
- $MONGO_HOME/bin/mongod --dbpath $HOME/data/db > $HOME/mongo.log 2>&1 &
- cd $HOME/build/rsercano/mongoclient
# Install NPM dependencies
- npm install
# Cache Selenium & ChromeDriver
- ./node_modules/.bin/chimp --path=content # there are no tests in content
# Make sure Mongo has started
- until nc -z localhost 27017 ; do echo Waiting for MongoDB; sleep 1; done
- node_modules
install:
before_script:
- meteor npm install
script:
- npm test
- meteor test --once
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册