-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
57 lines (56 loc) · 1.7 KB
/
.travis.yml
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
46
47
48
49
50
51
52
53
54
55
56
---
dist: bionic
language: ruby
addons:
postgresql: "9.5"
services:
- postgresql
- redis-server
# We're trying to cache bundler gems
cache:
directories:
- vendor/bundle
- /home/travis/.rvm/
# Needed for speed up pyenv installation
- /opt/pyenv
stages:
- name: tests
if: type = pull_request
- name: deploy
if: branch in (master) AND type != pull_request
before_install:
- gem install bundler:1.16.1
install:
- pip install ansible==2.9.6
jobs:
include:
- stage: tests
name: "Test given pull-request"
env:
- RAILS_ENV=test
script: |
psql -c 'create database pay_cryptoprocessing_test;' -U postgres
bundle install
rails db:migrate
bundle exec rspec
- stage: deploy
name: "Deploy code to target servers"
env: LIMIT=azure_oomag_api_docs_master
before_script: |
echo "Checkout ansible controller repository"
eval "$(ssh-agent -s)"
ssh-add <(echo "$MACHINE_GUNNER_PKEY")
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
git clone --depth=1 [email protected]:oomag/ansible_controller.git
echo "Ensure roles needed for deploy"
pushd ansible_controller
./tools/get-roles.sh docs
echo "Ensure SSH key to login to target hosts"
export ANSIBLE_VAULT_PASSWORD_FILE=$(readlink -f ./tools/get-vault-pass)
ansible-playbook --limit $LIMIT --tags local -e @vars/extra.yaml run-ci-prerequisites.yml
for key in /tmp/.ssh/*; do
ssh-add $key
done
script: |
echo "Run deploy on $LIMIT nodes set"
ansible-playbook --limit $LIMIT -e @vars/extra.yaml run-docs.yml