language: ruby
sudo: required
dist: xenial
rvm: 2.5.3
cache:
bundler: true
env:
global:
- COVERAGE=1
matrix:
- INTEGRATION_SPECS=0
- INTEGRATION_SPECS=1
stages:
- test
- ':ship: it to Quay.io'
jobs:
allow_failures:
- script: ./script/docker-build-and-push
include:
- stage: test
env:
script: ./script/validate-example-payloads-with-docker
- stage: ':ship: it to Quay.io'
env:
script: ./script/docker-build-and-push
if: NOT type IN (pull_request) AND branch = master
before_script:
- eval "$(script/handle-docker-config)"
- bundle exec rake clean assets:precompile
script:
- bundle exec rspec spec
- bundle exec rake shfmt
- bundle exec rake assert_clean
- bundle exec rake shellcheck
- bundle exec rake assert_examples
after_success: bundle exec codeclimate-test-reporter
after_failure: bundle exec rake dump_examples_logs
before_deploy:
- sudo pip install -U -I Pygments
- ./script/build-s3-index-html
deploy:
provider: s3
access_key_id:
secure: fXt5NG5UGDvpnRFvUUk9J//iSo+Vh28oEUJvjZqiUZ9GRHp5TrIS5vL4bPlD/1RrJRp7BVVj1+4ThXZRzrMhF5xazK8k4ANaUhMdjmRa6arXtqBcXIyUvu//5e80nlXekqMKaW7f5wrLNiKZB+ck7ayGlI1NYLNQ5nCWC6Xxe6s=
secret_access_key:
secure: Jn9clQh78C2c1zoueTkn0r5kSCHrbb7bMojb8/Ne+6zg0pD/3w25mrhEC4y9b3M/lHoKArOPj4dn03ZErJleM8aOMNMIa6ck8GKP+7EoFlZ/1/C5733HazlldTWDd2+wTOYfSIGOM+mHDP5tmK0S7pr1zEm+/++UExuGZXiCSSI=
bucket: travis-build-examples
local_dir: examples
skip_cleanup: true
region: us-east-1
on:
branch: master
condition: $INTEGRATION_SPECS == 1
repo: travis-ci/travis-build
UKGovernmentBEIS/beis-report-official-development-assistance:.travis.yml@4aee44f
language: minimal
services:
- docker
before_install:
- docker build . --target test --build-arg RAILS_ENV=test -t app/test
jobs:
include:
- stage: Test
name: Build and test the current version of the application using Docker
env:
- RAILS_ENV=test
script: |
set -eu
docker network create test
docker run -d --name pg --network test -p 5432:5432 postgres:11.6
docker run \
--network test \
-e RAILS_ENV=test \
-e DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true \
-e DATABASE_URL=postgres://postgres@pg:5432/roda_test \
-e TRAVIS="$TRAVIS" \
-e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" \
-e TRAVIS_BRANCH="$TRAVIS_BRANCH" \
-e TRAVIS_PULL_REQUEST="$TRAVIS_PULL_REQUEST" \
-e COVERALLS_SERVICE_NAME=travis-ci \
-e COVERALLS_REPO_TOKEN="$COVERALLS_REPO_TOKEN" \
-e CI=true \
--env-file .env.test \
app/test /bin/bash -c "set -eu; bundle exec rake; bundle exec brakeman"
echo "==== testing terrafrom ===="
cd terraform
git clone https://github.com/tfutils/tfenv.git ~/.tfenv
export PATH="$HOME/.tfenv/bin:$PATH"
tfenv install
../install-terraform-provider-for-cf.sh
terraform init
terraform fmt -diff -check -recursive
terraform validate
cd ..
echo "==== linting our shell scripts ===="
bash -c 'shopt -s globstar nullglob; shellcheck **/*.{sh,ksh,bash}'
set +eu
deploy:
- provider: script
script: bash travis-docker-push.sh
on:
all_branches: true
condition: "$TRAVIS_BRANCH =~ ^(develop|master|hotfix)"
- provider: script
script: bash deploy-terraform.sh
on:
all_branches: true
condition: "$TRAVIS_BRANCH =~ ^(develop|master)$"
env:
global:
secure: mBNvcyOEhYVAbbUJL4sXvwU6RM9LgFLAaEq/B5VKhUSOSKWvcYYInk5qWOldMF79aE8mC7JsOi5D4AC6fvPEEU2aM9N5jcvoNyR5FEKg80ltgK8GE8NwrzqjD3shS2IhFtKdBN1PI/vDxAtIJqefQ8eSy2/FwdpN/aB06QDGjEy5ye2dh/A4YH5fAz1W9lncFI8zr7ZdPC5N7FG6DkNCVju9wfqwzyHCQabuJ3iKvq3dxBaRvJgrIi6I2QVHV9ieWARuI5CHgYQWwm2VPVW5vUhrZ3ZaefD5qJZ4Bp+NzlnDH7frCjuDpPrCiNI6wYrbOxj4LFVDAWl9dMYcZ9BY6DNQjeTtSt9qLCgG6csBsTf9RHR5THz3zreChEyf/+iJvBqyh9XdSNj/ZtEDFAM4z4LTsyQy7VlxyjLoO+oYOONzQP/y4EOmELJ7YPvB6bZmazJ2Rpix91svlBmaxtcx63W0aZa8yqqzJ5n6mPdIIBnMQOlNkofUSapaKJRceMcVqHk/5EqjUG7ETTf8eohrfLqrHP/S344NPNCDMHmTIoWd4QL7K9E0IeAinBUOa8RfN4A3SfXvouOPvfZGqCjmciAsQi2r024EqZ/c39xu1BQDLIm+LZ9ThMBimi2u7yZV7W4ijoY7DRae3mgzqGxnHxEmWhtDMWWnEujfR2BM4oY= # Coveralls.io READ_TOKEN
notifications:
slack:
if: branch =~ /(develop|master)/
on_failure: change
secure: CUMfiPR1L6YiIfu0stmmTVWb1OjIZakrSI7gLfoK9UXZK/kGY1jk6HDVmpK4tsZ3S6Za3iZitAfsPuy3O4R/D4F6gNPbrTsWQ0oYz8z8WPEWSjGTaU0S4Mr5BjKYm8nWtF9bHiTVXVfXtrcg72/PHQyneVB4wAh5sxcEBq/JaGaITGgqs39MIOHo23iLzz4piMvIpho8LAMyBSAR6mji0GYU5gFIBkeY3ysSn+lU5R71og6vKdln2Hf0jLQBonk+Q5numDTBOKaVj4uV8o5tNcrfr4pLQud6mIrKRyQudUrJFbj8e4iBMhmZSY5hM6JKzKDYfo9X8ymLqq75hsg0vwXlcP6dn+5LHnvjqfPLx+/d/pbeGU8OBHMj2IkxYWxpv7W2j2YmUhLkmxGjO+QcHPg/dbtIEFtmC48aiy4GRSGoeQssPLgr6DT1zcWyrXv7cdp+I0Fp0WWxk0HhnutSeScc3waoLfms0eB0VbwKzd+19gj1R86xOowH9K+Qaevpj8pnaSH53xyOjicGBlWmwZa/onrsIsJNUynv1RrhA+15VevQ8DFxiUXmy6hTQ0vDdlAd86G7cqkPwvz2bCHmuCH04CKjtBm7XSCixWiHs0s65/UyFMhaVV90N8ZTbmer/jyby9vefp/yeo6NB1I2zpVfyqLIZGbFqHMvH+maHyc=
Build Config
{
"os": [
"linux"
],
"env": {
"global": [
{
"COVERAGE": "1"
}
],
"matrix": [
{
"INTEGRATION_SPECS": "0"
},
{
"INTEGRATION_SPECS": "1"
}
]
},
"rvm": [
"2.5.3"
],
"dist": "xenial",
"sudo": true,
"cache": {
"bundler": true
},
"deploy": [
{
"on": {
"repo": "travis-ci/travis-build",
"branch": [
"master"
],
"condition": [
"$INTEGRATION_SPECS == 1"
]
},
"bucket": "travis-build-examples",
"region": "us-east-1",
"provider": "s3",
"local_dir": "examples",
"skip_cleanup": true,
"access_key_id": {
"secure": "fXt5NG5UGDvpnRFvUUk9J//iSo+Vh28oEUJvjZqiUZ9GRHp5TrIS5vL4bPlD/1RrJRp7BVVj1+4ThXZRzrMhF5xazK8k4ANaUhMdjmRa6arXtqBcXIyUvu//5e80nlXekqMKaW7f5wrLNiKZB+ck7ayGlI1NYLNQ5nCWC6Xxe6s="
},
"secret_access_key": {
"secure": "Jn9clQh78C2c1zoueTkn0r5kSCHrbb7bMojb8/Ne+6zg0pD/3w25mrhEC4y9b3M/lHoKArOPj4dn03ZErJleM8aOMNMIa6ck8GKP+7EoFlZ/1/C5733HazlldTWDd2+wTOYfSIGOM+mHDP5tmK0S7pr1zEm+/++UExuGZXiCSSI="
}
}
],
"matrix": {
"include": [
{
"env": [
{}
],
"stage": "test",
"script": [
"./script/validate-example-payloads-with-docker"
]
},
{
"if": "NOT type IN (pull_request) AND branch = master",
"env": [
{}
],
"stage": ":ship: it to Quay.io",
"script": [
"./script/docker-build-and-push"
]
}
],
"allow_failures": [
{
"script": [
"./script/docker-build-and-push"
]
}
]
},
"script": [
"bundle exec rspec spec",
"bundle exec rake shfmt",
"bundle exec rake assert_clean",
"bundle exec rake shellcheck",
"bundle exec rake assert_examples"
],
"stages": [
{
"name": "test"
},
{
"name": ":ship: it to Quay.io"
}
],
"language": "ruby",
"after_failure": [
"bundle exec rake dump_examples_logs"
],
"after_success": [
"bundle exec codeclimate-test-reporter"
],
"before_deploy": [
"sudo pip install -U -I Pygments",
"./script/build-s3-index-html"
],
"before_script": [
"eval \"$(script/handle-docker-config)\"",
"bundle exec rake clean assets:precompile"
]
}