Use a script/cibuild to control the CI process

We need some extra setup work that's easier to accomplish in a separate
script than embedding it all in the Travis CI configuration. Follow the
scripts-to-rule-them-all pattern from GitHub and add a script/cibuild
for that purpose.
This commit is contained in:
Matt Rogers 2018-05-29 20:14:19 -05:00
parent 68ce8ad1ae
commit 7dd8e8caec
No known key found for this signature in database
GPG key ID: 605D017C07EB4316
2 changed files with 28 additions and 1 deletions

View file

@ -9,7 +9,7 @@ before_install:
- chmod 0755 docker-compose - chmod 0755 docker-compose
- sudo mv docker-compose /usr/local/bin - sudo mv docker-compose /usr/local/bin
install: true install: true
script: "cp config/site.yml.tmpl config/site.yml ; docker-compose build ; bin/rake ci:lite" script: "script/cibuild"
addons: addons:
apt: apt:
packages: packages:

27
script/cibuild Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash
set -e
docker_compose="docker-compose --file docker-compose.yml"
function cleanup() {
$docker_compose down
}
trap cleanup EXIT
export RAILS_ENV=test
# Put a config/site.yml file in place since it's needed for operation
cp config/site.yml.tmpl config/site.yml
$docker_compose build
$docker_compose up -d
sleep 2 # janky way of waiting for the database to be up
# Leaving this in since it will be needed for Rails 5
# bin/rails db:environment:set RAILS_ENV=test || true
bin/rake db:create db:test:prepare
bin/rake ci:lite