-
Notifications
You must be signed in to change notification settings - Fork 3
/
buildshim
executable file
·115 lines (96 loc) · 2.72 KB
/
buildshim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
fi
ruby_version=3.1.3
rvm use ruby-$ruby_version || exit 100
branch=$(echo $GIT_BRANCH | cut -d / -f 2)
rvm use ruby-$ruby_version@$branch --create || exit 100
#branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
case $1 in
patch)
;;
install_deps)
;;
configure)
#rvm --force gemset empty ruby-$ruby_version@$branch || exit 100
#gem install bundler
rm -rf dri_files/*
cp config/solr.yml.sample config/solr.yml
cp config/database.yml.sample config/database.yml
cp config/redis.yml.sample config/redis.yml
cp config/blacklight.yml.sample config/blacklight.yml
cat > config/settings/test.yml << __EOF__
interface:
languages: [en, ga]
dri:
files: dri_files
plugins:
ffmpeg_path: /usr/bin/ffmpeg
S3:
server: http://localstack:4566
access_key_id: test
secret_access_key: test
bucket_prefix: buildbot
doi:
enable: false
__EOF__
#source /home/jenkins/localstack/bin/activate
#SERVICES=s3 localstack start --host &>/dev/null &
#echo $! > localstack.pid
bundle install --without production
bundle exec rake server:start
bundle exec rake server:config
bundle exec rake db:migrate
bundle exec rake db:seed
bundle exec rake db:migrate
bundle exec rake db:test:prepare
bundle exec rake db:environment:set RAILS_ENV=test
bundle exec rails dartsass:build
;;
rspec)
bundle exec rake rspec RUN_COVERAGE=on
;;
cucumber)
bundle exec rake cucumber_ci
;;
api)
bundle exec rake api:docs:generate
;;
compile)
bundle exec rake assets:precompile
;;
push)
rm -rf dri-app-mirror
git clone --mirror ssh://[email protected]:2200/drirepo/dri-app.git dri-app-mirror
cd dri-app-mirror
git remote set-url --push origin [email protected]:Digital-Repository-of-Ireland/dri-app.git
git fetch -p origin
git push --mirror
cd ..
;;
compile_extra)
#only check test instance on develop branch
if [[ "$branch" == "false" ]]; then
#check application
OUTPUT=`curl -s -o /dev/null -I -w "%{http_code}" http://test.dri.ie/is_it_working`
sleep 60
OUTPUT=`curl -s -o /dev/null -I -w "%{http_code}" http://test.dri.ie/is_it_working`
if [[ $OUTPUT -ne 200 ]] ; then
printf "Test Application Stack FAULT! [HTTP: $OUTPUT]\n"
exit 1
else
printf "Test Application Stack OK. [HTTP: $OUTPUT]\n"
fi
fi
;;
uninstall_deps)
#kill -TERM $(cat localstack.pid) || true
;;
esac