-
Notifications
You must be signed in to change notification settings - Fork 79
351 lines (342 loc) · 13.6 KB
/
acceptance-tests.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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
name: Acceptance Testing
on:
workflow_dispatch:
workflow_run:
# wait for Platform Executable Release to complete
workflows:
[
"Windows Executable Release",
]
branches: [main]
types:
- completed
env:
INPUT_OWNER: ${{ github.repository_owner }}
INPUT_REPO: twilio-cli
INPUT_GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
INPUT_WAITING_INTERVAL: 10
INPUT_PROPAGATE_FAILURE: true
INPUT_TRIGGER_WORKFLOW: false
jobs:
get-branch:
name: Get Current Branch Name
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract_branch.outputs.branch }}
steps:
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
get-tag:
runs-on: ubuntu-latest
outputs:
TAG_NAME: ${{steps.get-tag.outputs.TAG_NAME}}
steps:
- uses: actions/checkout@v2
- name: Getting latest tag
id: get-tag
run: |
git fetch --prune --unshallow
echo "::set-output name=TAG_NAME::$(git describe --tags $(git rev-list --tags --max-count=1))"
wait-for-brew-releases:
name: Wait for brew Release to complete
runs-on: macos-13
continue-on-error: true
strategy:
matrix:
node-version: [ 18.x, 20.x, lts/* ]
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_brew.outputs.FAILURE_TAG_BREW }}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for oclif executables Release
run: source .github/scripts/trigger-and-wait.sh
env:
INPUT_OWNER: ${{ github.repository_owner }}
INPUT_GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
INPUT_WORKFLOW_FILE_NAME: release.yml
INPUT_REF: main
INPUT_REPO: homebrew-brew
- name: Global - Testing installation of Twilio CLI (1)
if: ${{ github.respository != 'twilio/draft-release-branch' }}
env:
REPO_NAME: ${{ github.repository_owner }}
run: |
brew tap $REPO_NAME/brew && brew install twilio
.github/scripts/cmds-to-test.sh
- name: Global - Testing upgrade Twilio CLI (2)
if: ${{ github.respository != 'twilio/draft-release-branch' }}
env:
REPO_NAME: ${{ github.repository_owner }}
run: |
brew tap $REPO_NAME/brew && brew install twilio
brew upgrade twilio
.github/scripts/cmds-to-test.sh
- name: Draft - Testing installation of Twilio CLI (1)
if: ${{ github.respository == 'twilio/draft-release-branch' }}
env:
REPO_NAME: ${{ github.repository_owner }}
run: |
brew tap $REPO_NAME/brew && brew install twiliodraft
.github/scripts/cmds-to-test.sh
- name: Draft - Testing upgrade Twilio CLI (2)
if: ${{ github.respository == 'twilio/draft-release-branch' }}
env:
REPO_NAME: ${{ github.repository_owner }}
run: |
brew tap $REPO_NAME/brew && brew install twiliodraft
brew upgrade twilio
.github/scripts/cmds-to-test.sh
- name: setup brew failure output
if: failure() || cancelled()
id: failure_brew
run: echo '::set-output name=FAILURE_TAG_BREW::true'
wait-for-windows-releases:
name: Wait for windows platform executables Release to complete
runs-on: windows-latest
needs: [ get-branch, get-tag ]
continue-on-error: true
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_windows.outputs.FAILURE_TAG_WINDOWS }}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for windows executables Release
run: bash .github/scripts/trigger-and-wait.sh
env:
INPUT_WORKFLOW_FILE_NAME: windows-executable-release.yml
INPUT_REF: ${{ needs.get-branch.outputs.branch }}
- name: Perform acceptance install and tests on Windows
id: windows_acceptance_run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ needs.get-tag.outputs.TAG_NAME }} --pattern '*.exe'
ls
(New-Object System.Net.WebClient).DownloadFile('https://get.scoop.sh', 'scoop.ps1')
./scoop.ps1 -RunAsAdmin
scoop install gsudo
./twilio-${{ needs.get-tag.outputs.TAG_NAME }}.exe /S
sleep 100
$env:Path += ";C:\Program Files (x86)\twilio-cli\bin"
$Env:Path
cd C:\"Program Files (x86)\twilio-cli"
dir
twilio --version
twilio api --help
- name: setup windows failure output
if: failure() || cancelled()
id: failure_windows
run: echo '::set-output name=FAILURE_TAG_WINDOWS::true'
wait-for-macos-releases:
name: Wait for macos platform executables Release to complete
runs-on: macos-13
continue-on-error: true
needs: [ get-branch, get-tag ]
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_macos.outputs.FAILURE_TAG_MACOS }}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for macos executables Release
run: source .github/scripts/trigger-and-wait.sh
env:
INPUT_WORKFLOW_FILE_NAME: macos-executable-release.yml
INPUT_REF: ${{ needs.get-branch.outputs.branch }}
- name: Perform acceptance install and test on binaries
id: macos_acceptance_run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ needs.get-tag.outputs.TAG_NAME }} --pattern '*.pkg'
sudo installer -pkg twilio-${{ needs.get-tag.outputs.TAG_NAME }}-x64.pkg -target ~/
ls
twilio --version
twilio api --help
- name: setup macos failure output
if: failure() || cancelled()
id: failure_macos
run: echo '::set-output name=FAILURE_TAG_MACOS::true'
wait-for-debian-releases:
name: Wait for debian platform executables Release to complete
runs-on: ubuntu-latest
needs: [ get-branch, get-tag ]
continue-on-error: true
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_debian.outputs.FAILURE_TAG_DEBIAN }}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for debian executables Release
run: source .github/scripts/trigger-and-wait.sh
env:
INPUT_WORKFLOW_FILE_NAME: debian-executable-release.yml
INPUT_REF: ${{ needs.get-branch.outputs.branch }}
- name: Perform acceptance install and test on binaries
id: debian_acceptance_run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ needs.get-tag.outputs.TAG_NAME }} --pattern '*amd64.deb'
sudo dpkg -i twilio-${{ needs.get-tag.outputs.TAG_NAME }}-amd64.deb
ls
twilio --version
twilio api --help
- name: setup debian failure output
if: failure() || cancelled()
id: failure_debian
run: echo '::set-output name=FAILURE_TAG_DEBIAN::true'
test-apt-release:
name: Wait for apt release to complete
runs-on: ubuntu-latest
needs: [ get-branch, get-tag ]
continue-on-error: true
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.apt.outputs.FAILURE_TAG_APT}}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for apt Release
run: source .github/scripts/trigger-and-wait.sh
env:
INPUT_WORKFLOW_FILE_NAME: apt-release.yml
INPUT_REF: ${{ needs.get-branch.outputs.branch }}
- name: Perform acceptance install and test on apt package
id: apt_acceptance_run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget -qO- https://twilio-cli-prod.s3.amazonaws.com/twilio_pub.asc | sudo apt-key add -
sudo touch /etc/apt/sources.list.d/twilio.list
echo 'deb https://twilio-cli-prod.s3.amazonaws.com/apt/ /' | sudo tee /etc/apt/sources.list.d/twilio.list
sudo apt update
sudo apt install -y twilio
ls
twilio --version
twilio api --help
.github/scripts/cmds-to-test.sh
- name: APT upgrade twilio package
run: |
sudo apt-get install --only-upgrade twilio
.github/scripts/cmds-to-test.sh
- name: APT downgrade twilio package
run: |
sudo apt-get install -y twilio=3.1.0-1 --allow-downgrades
twilio --version
.github/scripts/cmds-to-test.sh
- name: setup apt failure output
if: failure() || cancelled()
id: failure_apt
run: echo '::set-output name=FAILURE_TAG_APT::true'
test-npm-releases:
name: NPM acceptance testing
runs-on: ubuntu-latest
continue-on-error: true
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_npm.outputs.FAILURE_TAG_NPM }}
strategy:
matrix:
node-version: [ 18.x, 20.x, lts/* ]
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/checkout@v2
with:
node-version: ${{ matrix.node-version }}
- name: Check for cached twilio installation
run: |
if ! command -v twilio > /dev/null; then twilio() { printf '%sCLI is not installed, all good. '; } else echo "CLI is installed already, Abort."; exit 1; fi
twilio --version
- name: Node Install - Testing installation of Twilio CLI (1)
if: ${{ github.respository != 'twilio/draft-release-branch' }}
run: |
npm install -g twilio-cli
.github/scripts/cmds-to-test.sh
- name: NPM Update - Testing upgrade Twilio CLI (2)
if: ${{ github.respository != 'twilio/draft-release-branch' }}
run: |
npm update -g twilio-cli
.github/scripts/cmds-to-test.sh
- name: Node Install - Testing installation of Twilio CLI (1)
if: ${{ github.respository == 'twilio/draft-release-branch' }}
run: |
npm install -g twilio-cli@$(npm view twilio-cli dist-tags.draft-release-branch)
.github/scripts/cmds-to-test.sh
- name: NPM Update - Testing upgrade Twilio CLI (2)
if: ${{ github.respository == 'twilio/draft-release-branch' }}
run: |
npm update -g twilio-cli@$(npm view twilio-cli dist-tags.draft-release-branch)
.github/scripts/cmds-to-test.sh
- name: setup debian failure output
if: failure() || cancelled()
id: failure_npm
run: echo '::set-output name=FAILURE_TAG_NPM::true'
test-scoop-release:
name: Do scoop testing after release
runs-on: windows-latest
continue-on-error: true
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_scoop.outputs.FAILURE_TAG_SCOOP }}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for Scoop release to finish
run: bash .github/scripts/trigger-and-wait.sh
env:
INPUT_WORKFLOW_FILE_NAME: update-release.yml
INPUT_REF: main
INPUT_OWNER: ${{ github.repository_owner }}
INPUT_REPO: scoop-twilio-cli
INPUT_GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Perform testing on scoop installations
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
(New-Object System.Net.WebClient).DownloadFile('https://get.scoop.sh', 'scoop.ps1')
./scoop.ps1 -RunAsAdmin
scoop bucket add twilio-scoop https://github.com/twilio/scoop-twilio-cli
scoop install twilio
twilio --version
twilio api --help
- name: Draft - Perform testing on scoop installations
if: ${{ github.respository == 'twilio/draft-release-branch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
(New-Object System.Net.WebClient).DownloadFile('https://get.scoop.sh', 'scoop.ps1')
./scoop.ps1 -RunAsAdmin
scoop bucket add twilio-scoop https://github.com/twilio/scoop-twilio-cli
scoop install twiliodraft
twilio --version
twilio api --help
- name: setup scoop failure output
if: failure() || cancelled()
id: failure_scoop
run: echo '::set-output name=FAILURE_TAG_SCOOP::true'
notify-complete-fail:
needs: [wait-for-brew-releases, wait-for-windows-releases, wait-for-debian-releases, wait-for-macos-releases, test-scoop-release, test-npm-releases, test-apt-release]
name: Notify Release Failed
runs-on: ubuntu-latest
if: ${{ contains( needs.*.outputs.ACCEPTANCE_FAILURE_TAG, 'true' ) }}
steps:
- uses: actions/checkout@v2
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.ALERT_SLACK_WEB_HOOK }}
SLACK_COLOR: "#ff3333"
SLACK_USERNAME: CLI Release Bot
SLACK_ICON_EMOJI: ":ship:"
SLACK_TITLE: "Twilio Cli"
SLACK_MESSAGE: 'CLI acceptance workflow Failed'
- name: Fail in case all jobs failed
if: |
${{ ( needs.test-npm-releases.outputs.ACCEPTANCE_FAILURE_TAG == 'true' ) &&
( needs.wait-for-brew-releases.outputs.ACCEPTANCE_FAILURE_TAG == 'true' ) &&
( needs.wait-for-macos-releases.outputs.ACCEPTANCE_FAILURE_TAG == 'true' ) &&
( needs.wait-for-windows-releases.outputs.ACCEPTANCE_FAILURE_TAG == 'true' ) &&
( needs.wait-for-debian-releases.outputs.ACCEPTANCE_FAILURE_TAG == 'true') &&
( needs.test-scoop-release.outputs.ACCEPTANCE_FAILURE_TAG == 'true')}}
( needs.test-apt-release.outputs.ACCEPTANCE_FAILURE_TAG} == 'true')}}
run:
exit 1