tracks/script/cibuild

39 lines
689 B
Text
Raw Normal View History

#!/bin/bash
set -e
export RUBY_VERSION=$1
2024-08-02 10:23:34 +03:00
docker_compose="docker compose --file test-envs/docker-compose-$2.yml"
function cleanup() {
$docker_compose down
}
function die() {
echo $@
exit 1
}
trap cleanup EXIT
export RAILS_ENV=test
export DATABASE_NAME=tracks_test
$docker_compose build
$docker_compose up -d
2024-10-23 01:52:02 +03:00
script/poll-for-db $2
# Leaving this in since it will be needed for Rails 5
2019-10-30 20:45:50 -04:00
$docker_compose run web bin/rails db:environment:set RAILS_ENV=test || true
2020-08-26 00:38:06 +03:00
if [ "$2" == "mysql" ];
then
$docker_compose run web bin/rake db:reset
else
$docker_compose run web bin/rake db:migrate
$docker_compose run web bin/rake db:seed
fi
2019-10-30 20:45:50 -04:00
$docker_compose run web bin/rake test