forked from ky1ejs/osx-box-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitrise.yml
294 lines (270 loc) · 7.71 KB
/
bitrise.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
---
format_version: 1.1.0
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ""
app:
envs:
- ANSIBLE_HOST_KEY_CHECKING: "False"
- VM_BUILD_IP: $VM_BUILD_IP
- XCODE_PATH: $XCODE_PATH
trigger_map:
- push_branch: step/1
workflow: provision-vm
- push_branch: step/2
workflow: perform-weekly-cache-update
- push_branch: step/xamarin
workflow: provision-xamarin-vm
workflows:
_pod_remove_master:
steps:
- script:
title: pod repo remove master
run_if: .IsCI
inputs:
- content: |-
#!/usr/bin/env bash
set -e
# Originally the command was pod repo remove master
# it just erased the dir under .cocoapods/repos/master.
# It is huge. Not by size, but the number of files.
# Instead just moved to /var/tmp it is way faster and it runs only during ci.
mv ~/.cocoapods/repos/master /var/tmp/
_ansible-play:
steps:
- script:
title: Run Ansible Playbook on CI's build VM
run_if: .IsCI
inputs:
- content: |-
#!/usr/bin/env bash
set -e
ansible-playbook \
-vv \
-e xcode_path="$(xcode-select -p)" \
${ADDITIONAL_VARIABLES_TO_ANSIBLE} \
--connection=local \
--inventory 127.0.0.1, \
--limit 127.0.0.1 \
"${LOCAL_PLAYBOOK_PATH}"
_cli-version:
steps:
- script:
title: get latest bitrise cli version
inputs:
- content: |-
#!/usr/bin/env bash
echo $GITHUB_TOKEN
echo $(curl -H "Authorization: token $GITHUB_TOKEN" \
--silent https://api.github.com/repos/bitrise-io/bitrise/releases/latest |\
grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') > cli_version.txt
#######################
#### Main wrkflows ####
#######################
ci:
steps:
- script:
title: Setup pip3
run_if: .IsCI
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
# Only install pip3 on Linux stacks. OSX stacks already has it.
if [[ "$OSTYPE" == *"linux"* ]]; then
sudo apt update
sudo apt install -y python3-pip
fi
pip3 --version
- script:
title: Install ansible-lint ver = ANSIBLE_LINT_VER
run_if: .IsCI
inputs:
- content: |-
#!/usr/bin/env bash
set -e
sudo pip3 install "ansible-lint==${ANSIBLE_LINT_VER}" --force-reinstall
ansible-lint --version
- script:
title: Install yamllint ver = YAML_LINT_VER
run_if: .IsCI
inputs:
- content: |-
#!/usr/bin/env bash
set -e
sudo pip3 install "yamllint==${YAML_LINT_VER}" --force-reinstall
yamllint --version
- script:
title: Validate bitrise.yml
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
bitrise validate -c ./bitrise.yml
- script:
title: Lint Ansible playbooks
inputs:
- content: |-
#!/usr/bin/env bash
set -e
for f in $(find . -name '*playbook.yml'); do
ansible-lint -c ansible-lint.yaml "$f"
done
- script:
title: Run Yamllint
inputs:
- content: |-
#!/usr/bin/env bash
set -e
yamllint -s -c ./yamllint.yaml .
run_if: .IsCI
inputs:
- wait_for_builds: "true"
- workflows: |-
intermediate-setup-test
weekly-cache-update-test
test_ruby
test_node
test_android
test_ssh-setup
test_flutter
test_go
test_bitrise-cli
test_remote-access
test_intermediate-setup
- access_token: $BITRISE_ACCESS_TOKEN
perform-weekly-cache-update:
after_run:
- _ansible-play
envs:
- LOCAL_PLAYBOOK_PATH: ./weekly-cache-update-playbook.yml
- ADDITIONAL_VARIABLES_TO_ANSIBLE: '-i "${VM_BULD_IP}"'
perform-weekly-cache-update-with-inventory:
description: |-
Runs `ansible` with the `weekly-cache-update-playbook.yml` playbook,
to update the pre-installed tools' caches
after_run:
- _ansible-play
envs:
- LOCAL_PLAYBOOK_PATH: ./weekly-cache-update-playbook.yml
- ADDITIONAL_VARIABLES_TO_ANSIBLE: '-i "./_tmp/weekly-update-inventory"'
provision-vm:
description: |-
Runs `ansible` with the `playbook.yml` playbook, to provision the
Virtual Machine. After this the VM should be completely ready,
you just have to save it / package it / distribute it.
steps:
- script:
inputs:
- content: |-
#!/bin/bash
set -e
ansible-playbook -v \
-e xcode_path="${XCODE_PATH}" \
--private-key ./vagrant-insecure_private_key \
-i "${VM_BUILD_IP}", \
"./playbook.yml"
provision-xamarin-vm:
description: |-
Runs `ansible` with the `xamarin-playbook.yml` playbook, to provision the
Virtual Machine. After this the VM should be completely ready,
you just have to save it / package it / distribute it.
after_run:
- _ansible-play
envs:
- LOCAL_PLAYBOOK_PATH: ./xamarin-playbook.yml
- ADDITIONAL_VARIABLES_TO_ANSIBLE: '-i "${VM_BUILD_IP}",'
weekly-cache-update-test:
before_run:
- _cli-version
- _pod_remove_master
after_run:
- _ansible-play
envs:
- LOCAL_PLAYBOOK_PATH: ./weekly-cache-update-playbook.yml
intermediate-setup-test:
before_run:
- _pod_remove_master
after_run:
- _ansible-play
envs:
- LOCAL_PLAYBOOK_PATH: ./playbook.yml
test_ruby:
envs:
- ROLE: "ruby"
after_run:
- _run_molecule_test
test_node:
envs:
- ROLE: "node"
after_run:
- _run_molecule_test
test_ssh-setup:
envs:
- ROLE: "ssh-setup"
after_run:
- _run_molecule_test
test_android:
envs:
- ROLE: "android"
after_run:
- _run_molecule_test
test_intermediate-setup:
envs:
- ROLE: "intermediate-setup"
after_run:
- _run_molecule_test
test_flutter:
envs:
- ROLE: "flutter"
after_run:
- _run_molecule_test
test_bitrise-cli:
envs:
- ROLE: "bitrise-cli"
after_run:
- _run_molecule_test
test_go:
envs:
- ROLE: "go"
after_run:
- _run_molecule_test
test_remote-access:
envs:
- ROLE: "remote-access"
after_run:
- _run_molecule_test
##############################
#### Utility workflows #######
##############################
send_lead_time:
steps:
- script-runner:
title: Lead Time KPI
deps:
apt_get:
- name: jq
brew:
- name: jq
inputs:
- file_path: _scripts/lead_time.sh
- slack:
inputs:
- webhook_url: $SLACK_WEBHOOK_URL
- channel: $SLACK_CHANNEL
- message: "$PR_CREATE_TIME - $PR_CLOSED_TIME"
_run_molecule_test:
steps:
- script-runner:
title: Install dependencies
inputs:
- file_path: _scripts/molecule/install_dependencies.sh
- change-workdir@1:
title: hopp into the test folder
inputs:
- path: roles/tests
- script-runner:
title: molecule test
inputs:
- file_path: ../../_scripts/molecule/test.sh
- deploy-to-bitrise-io@1: {}