Updated testing to pull yaml tests from a specific es branch, and setup
travis script that will download the latest build from a branch or a release based on the config it receives.
This commit is contained in:
@ -20,7 +20,7 @@ var argv = require('optimist')
|
||||
default: true,
|
||||
boolean: true
|
||||
},
|
||||
es_version: {
|
||||
es_branch: {
|
||||
default: 'master',
|
||||
string: true,
|
||||
alias: 'b'
|
||||
@ -39,62 +39,58 @@ if (!argv.force && process.env.FORCE || process.env.FORCE_GEN) {
|
||||
argv.force = argv.f = process.env.FORCE || process.env.FORCE_GEN;
|
||||
}
|
||||
|
||||
function updateSubmodules(done) {
|
||||
var branch = argv.es_version;
|
||||
// branch can be prefixed with = or suffixed with _nightly
|
||||
if (branch.indexOf) {
|
||||
['='].forEach(function removePrefix(pref) {
|
||||
if (branch.indexOf(pref) === 0) {
|
||||
branch = branch.substring(pref.length);
|
||||
}
|
||||
});
|
||||
|
||||
['_nightly'].forEach(function removeSuffix(suf) {
|
||||
if (branch.indexOf(suf) === branch.length - suf.length) {
|
||||
branch = branch.substr(0, branch.length - suf.length);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var stdio = [
|
||||
'ignore',
|
||||
argv.verbose ? process.stdout : 'ignore',
|
||||
process.stderr
|
||||
];
|
||||
|
||||
async.series([
|
||||
function (done) {
|
||||
// init submodules
|
||||
cp.spawn('git', ['submodule', 'update', '--init'], {
|
||||
stdio: stdio
|
||||
}).on('exit', function (status) {
|
||||
done(status ? new Error('Unable to init submodules.') : void 0);
|
||||
});
|
||||
},
|
||||
function (done) {
|
||||
// checkout branch and clean it
|
||||
cp.spawn('git', ['submodule', 'foreach', 'git checkout --detach origin/' + branch + ' && git clean -f'], {
|
||||
stdio: stdio
|
||||
}).on('exit', function (status) {
|
||||
done(status ? new Error('Unable to init submodules.') : void 0);
|
||||
});
|
||||
var branch = argv.es_branch;
|
||||
// branch can be prefixed with = or suffixed with _nightly
|
||||
if (branch.indexOf) {
|
||||
['='].forEach(function removePrefix(pref) {
|
||||
if (branch.indexOf(pref) === 0) {
|
||||
branch = branch.substring(pref.length);
|
||||
}
|
||||
], done);
|
||||
});
|
||||
|
||||
['_nightly'].forEach(function removeSuffix(suf) {
|
||||
if (branch.indexOf(suf) === branch.length - suf.length) {
|
||||
branch = branch.substr(0, branch.length - suf.length);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
updateSubmodules(function (err) {
|
||||
var stdio = [
|
||||
'ignore',
|
||||
argv.verbose ? process.stdout : 'ignore',
|
||||
process.stderr
|
||||
];
|
||||
|
||||
async.series([
|
||||
function (done) {
|
||||
cp.spawn('git', ['submodule', 'update', '--init'], {
|
||||
stdio: stdio
|
||||
}).on('exit', function (status) {
|
||||
done(status ? new Error('Unable to init submodules.') : void 0);
|
||||
});
|
||||
},
|
||||
function (done) {
|
||||
// checkout branch and clean it
|
||||
cp.spawn('git', ['submodule', 'foreach', 'git checkout origin/' + branch + ' && git clean -f'], {
|
||||
stdio: stdio
|
||||
}).on('exit', function (status) {
|
||||
done(status ? new Error('Unable to checkout ' + branch) : void 0);
|
||||
});
|
||||
},
|
||||
function (done) {
|
||||
var tasks = [];
|
||||
|
||||
if (argv.api) {
|
||||
tasks.push(require('./js_api'));
|
||||
}
|
||||
if (argv.tests) {
|
||||
tasks.push(require('./yaml_tests'));
|
||||
}
|
||||
|
||||
async.parallel(tasks, done);
|
||||
}
|
||||
], function (err) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
var tasks = [];
|
||||
|
||||
if (argv.api) {
|
||||
tasks.push(require('./js_api'));
|
||||
}
|
||||
if (argv.tests) {
|
||||
tasks.push(require('./yaml_tests'));
|
||||
}
|
||||
|
||||
async.parallel(tasks, function () {});
|
||||
});
|
||||
@ -1,8 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# generate the latest version of the yaml-tests
|
||||
node scripts/generate/ --no-api --es_version="=$ES_V"
|
||||
./node_modules/.bin/grunt run:generate_yaml_tests --es_branch="=$ES_V"
|
||||
|
||||
export VERBOSE="true"
|
||||
|
||||
|
||||
74
scripts/travis.sh
Executable file
74
scripts/travis.sh
Executable file
@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z $ES_BRANCH ]; then
|
||||
echo "Missing ES_BRANCH environment var"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROOT="$PWD"
|
||||
ES_SUBMODULE="$ROOT/src/elasticsearch"
|
||||
SNAPSHOTS="$ROOT/.snapshots"
|
||||
ES_BIN="$SNAPSHOTS/es/bin/elasticsearch"
|
||||
ES_VERSION="${ES_BRANCH}_nightly"
|
||||
ES_URL="http://s3-us-west-2.amazonaws.com/build.elasticsearch.org/origin/$ES_BRANCH/nightly/JDK6/elasticsearch-latest-SNAPSHOT.zip"
|
||||
|
||||
if [ ! -z $ES_RELEASE ]; then
|
||||
ES_VERSION="v${ES_RELEASE}"
|
||||
ES_URL="https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-${ES_RELEASE}.zip"
|
||||
fi
|
||||
|
||||
echo -en 'travis_fold:start:setup_es\\r'
|
||||
if [ -d $SNAPSHOTS ]; then
|
||||
echo "wiping out existing snapshots"
|
||||
rm -rf $SNAPSHOTS
|
||||
fi
|
||||
|
||||
echo "Killing existsing java processes"
|
||||
killall java 2>/dev/null
|
||||
|
||||
echo "Downloading Elasticsearch $ES_VERSION to $SNAPSHOTS"
|
||||
mkdir $SNAPSHOTS &&
|
||||
cd $SNAPSHOTS \
|
||||
&& curl -O $ES_URL \
|
||||
&& unzip elasticsearch-*.zip \
|
||||
|
||||
cd $ROOT
|
||||
|
||||
if [ ! -d $SNAPSHOTS ]; then
|
||||
echo "Failed to download ES"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
mv $SNAPSHOTS/elasticsearch-*/ $SNAPSHOTS/es/
|
||||
|
||||
if [ ! -x $ES_BIN ]; then
|
||||
echo "Unable to find elasticsearch binary $ES_BIN"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $ES_BRANCH = "0.90" ]; then
|
||||
echo "Starting Elasticsearch $ES_VERSION"
|
||||
$ES_BIN \
|
||||
-Des.network.host=localhost \
|
||||
-Des.discovery.zen.ping.multicast.enabled=false \
|
||||
-Des.discovery.zen.ping_timeout=1
|
||||
else
|
||||
echo "Starting Elasticsearch $ES_VERSION as a deamon"
|
||||
$ES_BIN -d \
|
||||
-Des.network.host=localhost \
|
||||
-Des.discovery.zen.ping.multicast.enabled=false \
|
||||
-Des.discovery.zen.ping_timeout=1
|
||||
fi
|
||||
|
||||
sleep 3
|
||||
echo -en 'travis_fold:end:setup_es\\r'
|
||||
|
||||
echo -en 'travis_fold:start:install_grunt\\r'
|
||||
npm install -g grunt-cli
|
||||
echo -en 'travis_fold:end:install_grunt\\r'
|
||||
|
||||
grunt --es_branch="=$ES_BRANCH" jshint mochacov:unit run:generate_yaml_tests mochacov:integration mochacov:ship_coverage
|
||||
RESULT=$?
|
||||
|
||||
killall java 2>/dev/null
|
||||
exit $RESULT
|
||||
Reference in New Issue
Block a user