metamaps--metamaps/bin/jenkins-test.sh

35 lines
712 B
Bash
Raw Normal View History

2016-01-26 08:58:15 +00:00
#!/bin/bash -l
2016-02-01 09:25:06 +00:00
# jenkins machine prerequisites
2016-02-05 07:35:06 +00:00
# sudo aptitude -q -y install libpq-dev
# install rvm with user gemsets
2016-04-26 02:22:32 +00:00
# install node and npm
2016-01-26 08:58:15 +00:00
source "$HOME/.rvm/scripts/rvm"
2016-02-05 12:16:54 +00:00
rvm use $(cat .ruby-version) || \
2016-02-05 10:02:30 +00:00
rvm install $(cat .ruby-version)
rvm gemset use $(cat .ruby-gemset) || \
rvm gemset create $(cat .ruby-gemset) && \
rvm gemset use $(cat .ruby-gemset)
2016-01-26 08:58:15 +00:00
gem install bundler
set -x
#configure environment
export RAILS_ENV=test
cp .example-env .env
sed -i -e "s/DB_USERNAME='.*'/DB_USERNAME='jenkins'/" .env
2016-04-26 02:22:32 +00:00
# rspec tests
2016-01-26 08:58:15 +00:00
bundle install
rake db:drop
rake db:create
rake db:schema:load
rake db:migrate
2016-02-05 07:35:06 +00:00
COVERAGE=on bundle exec rspec
2016-04-26 02:22:32 +00:00
# javascript tests
cd app/assets/javascripts
npm install
npm test