internetee-registry/bin/robot
2014-10-10 12:02:48 +03:00

52 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
#
# Build and run everything for automatic tests
#
# default locations
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# fail later
set -o pipefail
# cd to Rails root directory
cd "$(dirname "$0")"; cd ..
# cp config/secrets-example.yml config/secrets.yml
# create manually config/database.yml
git pull origin master &> /dev/null
git reset --hard &> /dev/null
unset GIT_DIR GIT_WORK_TREE
bundle install
echo "RUBOCOP_RESULTS"
bundle exec rubocop
echo "END_OF_RUBOCOP_RESULTS"
echo "SECURITY_RESULTS"
bundle exec bundle-audit update
bundle exec bundle-audit
bundle exec brakeman
echo "END_OF_SECURITY_RESULTS"
RAILS_ENV=test bundle exec rake db:drop
RAILS_ENV=test bundle exec rake db:create
RAILS_ENV=test bundle exec rake db:schema:load
RAILS_ENV=test bundle exec rake db:seed
RAILS_ENV=test bundle exec rake assets:precompile
echo "GIT_LAST_COMMITS"
git log origin/master -n 10 --pretty=oneline | sed -r '/^.{40} Merge branch/d' | sed -r 's/^.{40}/Latest: /'
echo "END_OF_GIT_LAST_COMMITS"
# run tests
echo "TEST_RESULTS"
ROBOT=true bundle exec rake test
echo "END_OF_TEST_RESULTS"
# update code review
bundle exec rubycritic app lib