mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 10:49:39 +02:00
rename robot scripts
This commit is contained in:
parent
4659aa0cba
commit
dd4db88ac2
3 changed files with 63 additions and 62 deletions
57
bin/robot
57
bin/robot
|
@ -1,13 +1,60 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Update repo
|
# 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 to Rails root directory
|
||||||
cd "$(dirname "$0")"; cd ..
|
cd "$(dirname "$0")"; cd ..
|
||||||
|
|
||||||
git pull origin master &> /dev/null
|
# cp config/secrets-example.yml config/secrets.yml
|
||||||
git reset --hard &> /dev/null
|
# create manually config/database.yml
|
||||||
unset GIT_DIR GIT_WORK_TREE
|
|
||||||
|
|
||||||
bin/robot-audit
|
bundle install
|
||||||
|
|
||||||
|
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 &> /dev/null
|
||||||
|
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"
|
||||||
|
|
||||||
|
echo "RUBOCOP_RESULTS"
|
||||||
|
bundle exec rubocop -D
|
||||||
|
RCODE=$?
|
||||||
|
echo "END_OF_RUBOCOP_RESULTS"
|
||||||
|
|
||||||
|
echo "TEST_RESULTS"
|
||||||
|
ROBOT=true bundle exec rake test
|
||||||
|
TCODE=$?
|
||||||
|
TCODE=0 # tmp
|
||||||
|
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
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
#!/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
|
|
||||||
|
|
||||||
# cp config/secrets-example.yml config/secrets.yml
|
|
||||||
# create manually config/database.yml
|
|
||||||
|
|
||||||
bundle install
|
|
||||||
|
|
||||||
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 &> /dev/null
|
|
||||||
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"
|
|
||||||
|
|
||||||
echo "RUBOCOP_RESULTS"
|
|
||||||
bundle exec rubocop -D
|
|
||||||
RCODE=$?
|
|
||||||
echo "END_OF_RUBOCOP_RESULTS"
|
|
||||||
|
|
||||||
echo "TEST_RESULTS"
|
|
||||||
ROBOT=true bundle exec rake test
|
|
||||||
TCODE=$?
|
|
||||||
TCODE=0 # tmp
|
|
||||||
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
|
|
11
bin/update-repo
Executable file
11
bin/update-repo
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Update repo
|
||||||
|
#
|
||||||
|
|
||||||
|
# cd to Rails root directory
|
||||||
|
cd "$(dirname "$0")"; cd ..
|
||||||
|
|
||||||
|
git pull origin master &> /dev/null
|
||||||
|
git reset --hard &> /dev/null
|
||||||
|
unset GIT_DIR GIT_WORK_TREE
|
Loading…
Add table
Add a link
Reference in a new issue