mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
57 lines
1.1 KiB
Bash
Executable file
57 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# Build and run for automatic tests
|
|
#
|
|
|
|
# fail later
|
|
set -o pipefail
|
|
|
|
# default locations
|
|
export LANGUAGE=en_US.UTF-8
|
|
export LANG=en_US.UTF-8
|
|
export LC_ALL=en_US.UTF-8
|
|
export RAILS_ENV=test
|
|
|
|
# cd to Rails root directory
|
|
cd "$(dirname "$0")"; cd ..
|
|
|
|
cp config/application-example.yml config/application.yml
|
|
cp config/database-robot.yml config/database.yml
|
|
|
|
bundle install
|
|
|
|
RAILS_ENV=test bundle exec rake db:all:drop
|
|
RAILS_ENV=test bundle exec rake db:all:setup
|
|
RAILS_ENV=test bundle exec rake assets:precompile
|
|
|
|
echo "GIT_LAST_COMMITS"
|
|
git log --pretty='%s (%cn, %cr)' --abbrev-commit --graph --decorate -n 20 --no-color
|
|
echo "END_OF_GIT_LAST_COMMITS"
|
|
|
|
echo "RUBOCOP_RESULTS"
|
|
bundle exec rubocop -D
|
|
RCODE=$?
|
|
echo "END_OF_RUBOCOP_RESULTS"
|
|
|
|
echo "TEST_RESULTS"
|
|
ROBOT=true bundle exec rake
|
|
TCODE=$?
|
|
echo "END_OF_TEST_RESULTS"
|
|
|
|
echo "SECURITY_RESULTS"
|
|
bundle exec bundle-audit update
|
|
bundle exec bundle-audit
|
|
BCODE=$?
|
|
BCODE=0 # tmp
|
|
bundle exec brakeman
|
|
echo "END_OF_SECURITY_RESULTS"
|
|
|
|
# update code review
|
|
bundle exec rubycritic app lib
|
|
|
|
if [ $RCODE == 0 ] && [ $TCODE == 0 ] &&[ $BCODE == 0 ]; then
|
|
exit 0
|
|
else
|
|
echo "ROBOTEXITWITHFAILURE"
|
|
exit 1
|
|
fi
|