Skip to content

Instantly share code, notes, and snippets.

@jimjh
Last active December 19, 2015 05:29
Show Gist options
  • Save jimjh/5904659 to your computer and use it in GitHub Desktop.
Save jimjh/5904659 to your computer and use it in GitHub Desktop.
Jenkins script for Karma+Cloudbees
#!/bin/sh
# install nodejs, if using cloudbees
curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
NODE_VERSION=0.11.1 source ./use-node
# install phantomjs, karma
[ -d node_modules/phantomjs ] || npm install phantomjs
[ -d node_modules/karma ] || npm install karma
# install bundler and gems
echo "install: --no-document" > ~/.gemrc
echo "update: --no-document" >> ~/.gemrc
gem install --conservative bundler
bundle check || bundle install
# load database schema
bundle exec rake db:schema:load
bundle exec rake db:test:prepare
export PHANTOMJS_BIN='node_modules/phantomjs/bin/phantomjs'
# run
# bundle exec rspec --format CI::Repo
node_modules/karma/bin/karma start --browsers PhantomJS config/karma.conf.js
@mars
Copy link

mars commented Jul 31, 2013

It looks like you prep your Rails environment with bundle & rake db:migrate, but how do you start the Rails server?

@mars
Copy link

mars commented Jul 31, 2013

To answer my own question: add "thin" web server to the bundle and then:

bundle exec thin --rackup config.ru --port NNNN --daemonize start
# karma start here
bundle exec thin stop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment