-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.travis.yml
169 lines (141 loc) · 4.11 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# -*- mode: yaml -*-
# vim:ts=2:sw=2:ai:si:syntax=yaml
#
# Travis CI configuration
# https://docs.travis-ci.com/
---
# Run tests against pull requests and main branches only
if: |
type = pull_request OR \
branch IN (master, develop)
language: shell
before_install:
# The default Git on macOS doesn't support protocol version 2 that's enabled
# on Travis
- >
if [[ "${UNINSTALL_HOMEBREW}" == "YES" ]]; then
git config --global protocol.version 1
fi
# yamllint disable rule:line-length
# Uninstall existing Homebrew installation
- >
if [[ "${UNINSTALL_HOMEBREW}" == "YES" ]]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)" -- --force
fi
# yamllint enable rule:line-length
# Remove existing NVM installation
- >
if [[ "${UNINSTALL_NVM}" == "YES" ]]; then
unset NVM_CD_FLAGS
unset NVM_DIR
unset NVM_BIN
rm -rf /Users/travis/.nvm
rm -rf /etc/profile.d/travis-nvm.sh
fi
# Remove Go versions installed with Gimme
- >
if [[ "${UNINSTALL_GIMME}" == "YES" ]]; then
if [[ -d "/Users/travis/.gimme" ]]; then
rm -rf /Users/travis/.gimme
fi
unset GOROOT
unset GIMME_ENV
export PATH=$(echo "${PATH}" | sed 's~/Users/travis/.gimme/versions/\([^/]*\)/bin:~~')
fi
script:
# Use Travis test configuration
- cp machine.travis.yaml machine.yaml
# Install Ansible and roles
- ./setup --upgrade-ansible --no-run-playbook || travis_terminate 1
# Check syntax of the Ansible playbooks
- ./setup -s || travis_terminate 1
# Run playbooks without tasks using external roles
- ./setup -q -v -i asdf,aws,gcloud,golang,nvm,packer,python,ruby,rust,vagrant || travis_terminate 1
# Run asdf setup
- ./setup -q -v -t asdf || travis_terminate 1
# Run aws setup
- ./setup -q -v -t aws || travis_terminate 1
# Run Google Cloud SDK setup
- ./setup -q -v -t gcloud || travis_terminate 1
# Run golang setup
- ./setup -q -v -t golang || travis_terminate 1
# Run nvm setup
- ./setup -q -v -t nvm || travis_terminate 1
# Run python setup
- ./setup -q -v -t packer || travis_terminate 1
# Run packer setup
- ./setup -q -v -t python || travis_terminate 1
# Run ruby setup
- ./setup -q -v -t ruby || travis_terminate 1
# Run rust setup
- ./setup -q -v -t rust || travis_terminate 1
# Run rust setup
- ./setup -q -v -t vagrant || travis_terminate 1
# Run idempotence tests
- >
./setup -q \
| grep -q 'changed=0.*failed=0' \
&& (echo 'Idempotence test: pass' && exit 0) \
|| (echo 'Idempotence test: fail' && exit 1)
stages:
- validate
- test
jobs:
include:
- stage: validate
name: Validate with pre-commit
os: linux
dist: focal
language: python
python: 3.8
cache:
directories:
- $HOME/.cache/pre-commit/
before_cache:
- rm -f $HOME/.cache/pre-commit/pre-commit.log
install:
- pip3 install -r requirements.dev.txt
- python --version
- shfmt -version
- shellcheck --version
- pre-commit --version
script:
# shfmt version is too old
- export SKIP=shfmt
- pre-commit run -a
- stage: test
name: "macOS 10.15.5 (Catalina) with Xcode 12 (uninstall Homebrew)"
os: osx
osx_image: xcode12
env: >-
UNINSTALL_HOMEBREW=YES
UNINSTALL_NVM=YES
UNINSTALL_GIMME=YES
- stage: test
name: "macOS 10.14 (Mojave) with Xcode 11.0 (uninstall Homebrew)"
os: osx
osx_image: xcode11
env: >-
UNINSTALL_HOMEBREW=YES
UNINSTALL_NVM=YES
UNINSTALL_GIMME=YES
- stage: test
name: "macOS 10.15.5 (Catalina) with Xcode 12"
os: osx
osx_image: xcode12
env: >-
UNINSTALL_NVM=YES
UNINSTALL_GIMME=YES
addons:
homebrew:
update: true
- stage: test
name: "macOS 10.14 (Mojave) with Xcode 11.0"
os: osx
osx_image: xcode11
env: >-
UNINSTALL_NVM=YES
UNINSTALL_GIMME=YES
addons:
homebrew:
update: true