Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #195 from LiskHQ/192-Jenkins_CI
Browse files Browse the repository at this point in the history
Initial implementation of Jenkins CI - Closes #192
  • Loading branch information
karmacoma authored May 10, 2017
2 parents dbbb2ec + 66da7af commit 8703560
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 25 deletions.
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

78 changes: 78 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
pipeline {
agent none
environment {
ON_JENKINS = 'TRUE'
}
stages {
stage ('Lisk Provisioning') {
steps {
node('master-nano-01'){
lock(resource: "master-nano-01", inversePrecedence: true) {
sh '''#!/bin/bash
env
# Clean up old processes
pkill -f selenium -9 || true
pkill -f Xvfb -9 || true
rm -rf /tmp/.X0-lock || true
pkill -f app.js || true
pkill -f webpack-dev-server -9 || true
# Start lisk and make sure its current
cd /var/lib/jenkins/workspace/
git clone https://github.com/LiskHQ/lisk.git
cd /var/lib/jenkins/workspace/lisk
git checkout development
git pull
dropdb lisk_test || true
createdb lisk_test
psql -d lisk_test -c "alter user "$USER" with password 'password';"
cp /var/lib/jenkins/workspace/lisk-node-Linux-x86_64.tar.gz .
tar -zxvf lisk-node-Linux-x86_64.tar.gz
npm install
git submodule init
git submodule update
cd public
npm install
bower install
grunt release
cd ..
cd test/lisk-js/; npm install; cd ../..
cp test/config.json test/genesisBlock.json .
export NODE_ENV=test
BUILD_ID=dontKillMe ~/start_lisk.sh
# Build nano
cd $WORKSPACE/src
npm install
# Add coveralls config file
cp ~/.coveralls.yml-nano .coveralls.yml
# Prepare lisk core for testing
bash ~/tx.sh
# Run test
npm run test
# Commented until e2e is ready
# export CHROME_BIN=chromium-browser
# export DISPLAY=:0.0
# Xvfb :0 -ac -screen 0 1280x1024x24 &
# ./node_modules/protractor/bin/webdriver-manager update
# npm run e2e-test
# Commented until e2e is ready
# cat .protractor.log
# cat .lisk-nano.log
pkill -f app.js -9 || true
pkill -f webpack-dev-server -9 || true
'''
milestone 1
}
}
}
}
}
}
22 changes: 12 additions & 10 deletions src/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ preprocessors[test] = ['webpack'];

const opts = {
onTravis: process.env.ON_TRAVIS,
onJenkins: process.env.ON_JENKINS,
live: process.env.LIVE,
};

Expand Down Expand Up @@ -43,14 +44,10 @@ module.exports = function (config) {
// Rest results reporter to use
// Possible values: 'dots', 'progress'
// Available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['coverage', 'mocha'].concat(opts.onTravis ? ['coveralls'] : []),
reporters: ['coverage', 'mocha'].concat(opts.onTravis ? ['coveralls'] : []).concat(opts.onJenkins ? ['coveralls'] : []),

preprocessors,

mochaReporter: {
output: 'autowatch',
},

babelPreprocessor: {
options: {
presets: ['es2015'],
Expand Down Expand Up @@ -82,11 +79,16 @@ module.exports = function (config) {
},

coverageReporter: {
reporters: [
{
type: opts.onTravis ? 'lcov' : 'html',
dir: 'coverage/',
}].concat(opts.onTravis ? [{ type: 'text' }] : []),
reporters: [{
type: 'text',
dir: 'coverage/',
}, {
type: opts.onTravis ? 'lcov' : 'html',
dir: 'coverage/',
}, {
type: opts.onJenkins ? 'lcov' : 'html',
dir: 'coverage/',
}],
},

// Start these browsers
Expand Down
1 change: 1 addition & 0 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"karma-chrome-launcher": "=2.0.0",
"karma-coverage": "=1.1.1",
"karma-coveralls": "=1.1.2",
"karma-jenkins-reporter": "0.0.2",
"karma-mocha": "=1.3.0",
"karma-mocha-reporter": "=2.2.2",
"karma-ng-html2js-preprocessor": "=1.0.0",
Expand Down

0 comments on commit 8703560

Please sign in to comment.