From 7dd8e8caecaad32988717871ad82a82888dfef28 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Tue, 29 May 2018 20:14:19 -0500 Subject: [PATCH] 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. --- .travis.yml | 2 +- script/cibuild | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 script/cibuild diff --git a/.travis.yml b/.travis.yml index d8a6fef8..af3c4a58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_install: - chmod 0755 docker-compose - sudo mv docker-compose /usr/local/bin install: true -script: "cp config/site.yml.tmpl config/site.yml ; docker-compose build ; bin/rake ci:lite" +script: "script/cibuild" addons: apt: packages: diff --git a/script/cibuild b/script/cibuild new file mode 100755 index 00000000..01130422 --- /dev/null +++ b/script/cibuild @@ -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 +