forked from instructure/switchman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·45 lines (41 loc) · 1.44 KB
/
build.sh
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
#!/bin/bash
set -ex
function cleanup() {
exit_code=$?
set +e
docker cp $(docker ps --latest --quiet):/app/coverage .
docker-compose kill
docker-compose rm -f
exit $exit_code
}
trap cleanup INT TERM EXIT
cp spec/dummy/config/database.yml.docker spec/dummy/config/database.yml
docker-compose pull postgres
docker-compose up -d postgres
docker-compose build --pull app
function test_ruby_version() {
# test_ruby_version ruby_version appraisals
# or just test_ruby_version ruby_version for all
ruby_version=$1
shift
docker-compose run --rm app /bin/bash -lc \
"rvm-exec $ruby_version bundle install --jobs 5"
docker-compose run --rm app /bin/bash -lc \
"rvm-exec $ruby_version bundle exec rake db:drop db:create db:migrate"
if [ $# == 0 ] ; then
docker-compose run --rm app /bin/bash -lc \
"rvm-exec $ruby_version bundle exec appraisal bundle install --jobs 5"
docker-compose run app /bin/bash -lc \
"rvm-exec $ruby_version bundle exec appraisal rspec --format doc"
else
for appraisal_version in $* ; do
docker-compose run --rm app /bin/bash -lc \
"rvm-exec $ruby_version bundle exec appraisal $appraisal_version bundle install --jobs 5"
docker-compose run app /bin/bash -lc \
"rvm-exec $ruby_version bundle exec appraisal $appraisal_version rspec --format doc"
done
fi
docker cp $(docker ps --latest --quiet):/app/coverage .
}
test_ruby_version 2.5
test_ruby_version 2.6