-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
141 lines (124 loc) · 3.21 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# -*- mode: yaml -*-
# vim:ts=2:sw=2:ai:si:syntax=yaml
#########################
# Travis CI configuration
#########################
---
# Run tests against pull requests and main branches only
if: |
type = pull_request OR \
branch IN (master, develop)
language: generic
# Install Ansible and Python development packages
addons:
apt:
packages:
- python-pip
- python-dev
- shellcheck
update: true
snaps:
- shfmt
homebrew:
packages:
- ansible
update: true
install:
# Install Ansible with pip on Ubuntu
- >
if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then
if [[ -z "$ANSIBLE_VERSION" ]]; then
pip install --user ansible
else
pip install --user ansible${ANSIBLE_VERSION}
fi
fi
# Check Ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../\n' > ansible.cfg
before_script:
# https://github.com/travis-ci/travis-ci/issues/6307
- >
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
rvm get head || true
fi
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
# Test role run
- >
ansible-playbook tests/test.yml -i tests/inventory --connection=local
# Test idempotence
- >
ansible-playbook tests/test.yml -i tests/inventory --connection=local
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Test command line tools have been installed are are available
- >
source ~/.bashrc
&& command -v aws
&& aws --version
- >
source ~/.bashrc
&& command -v aws-shell
- >
source ~/.bashrc
&& command -v aws-vault
&& aws-vault --version
- >
source ~/.bashrc
&& command -v cli53
&& cli53 --version
stages:
- validate
- test
jobs:
include:
# Run validation stage in Linux with latest Ansible only
- stage: validate
name: Validate with pre-commit
os: linux
dist: xenial
language: minimal
cache:
directories:
- $HOME/.cache/pre-commit/
before_cache:
- rm -f $HOME/.cache/pre-commit/pre-commit.log
install:
# Fix ansible-lint installation issues
# https://github.com/ansible/ansible-lint/issues/590
- pip install --user virtualenv==16.3.0
# Install pre-commit with pip
- pip install --user pre-commit
script:
- pre-commit run -a
# Run tests
- stage: test
name: "Ubuntu 16.04 (Xenial) with Ansible 2.6"
os: linux
dist: xenial
env: ANSIBLE_VERSION='<2.7.0'
- stage: test
name: "Ubuntu 16.04 (Xenial) with Ansible 2.7"
os: linux
dist: xenial
env: ANSIBLE_VERSION='<2.8.0'
- stage: test
name: "Ubuntu 18.04 (Bionic) with Ansible 2.8"
os: linux
dist: bionic
env: ANSIBLE_VERSION='<2.9.0'
- stage: test
name: "macOS 10.13 (High Sierra) with Xcode 10.1"
os: osx
osx_image: xcode10.1
- stage: test
name: "macOS 10.14 (Mojave) with Xcode 10.2.1"
os: osx
osx_image: xcode10.2
notifications:
webhooks:
- https://galaxy.ansible.com/api/v1/notifications/