-
Notifications
You must be signed in to change notification settings - Fork 189
161 lines (141 loc) · 5.12 KB
/
cli-runner-test.yml
File metadata and controls
161 lines (141 loc) · 5.12 KB
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
name: Slack CLI Runner Tests
on:
pull_request:
jobs:
test-all:
runs-on: ubuntu-latest
steps:
- name: Checkout the current code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run slack version
id: version
uses: ./.github/resources/.actions/cli-runner
with:
command: "version"
cli-version: "3.6.1"
env:
SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }}
- name: Debug outputs
run: |
echo "output: '${{ steps.version.outputs.output }}'"
echo "ok: '${{ steps.version.outputs.ok }}'"
echo "command executed: '${{ steps.version.outputs.command_executed }}'"
- name: Verify CLI version
if: steps.version.outputs.ok != 'true'
run: |
echo "CLI version command failure"
echo "output: ${{ steps.version.outputs.output }}"
exit 1
- name: Empty command
id: empty-command
uses: ./.github/resources/.actions/cli-runner
with:
command: ""
cli-version: "3.6.1"
env:
SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }}
- name: Command with whitespace
id: command-with-whitespace
uses: ./.github/resources/.actions/cli-runner
with:
command: " version"
cli-version: "3.6.1"
env:
SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }}
- name: Long command with flags
id: long-command
uses: ./.github/resources/.actions/cli-runner
with:
command: 'doctor --help --experiment string'
cli-version: "3.6.1"
env:
SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }}
- name: Ensure empty command works
if: steps.empty-command.outputs.ok != 'true'
run: |
echo "Empty command failure"
echo "ok: '${{ steps.empty-command.outputs.ok }}'"
echo "output: '${{ steps.empty-command.outputs.output }}'"
exit 1
- name: Ensure command with whitespace
if: steps.command-with-whitespace.outputs.ok != 'true'
run: |
echo "Command with whitespace failure"
echo "ok: '${{ steps.command-with-whitespace.outputs.ok }}'"
echo "output: '${{ steps.command-with-whitespace.outputs.output }}'"
exit 1
- name: Ensure long command works
if: steps.long-command.outputs.ok != 'true'
run: |
echo "Long command failure"
echo "ok: '${{ steps.long-command.outputs.ok }}'"
echo "output: '${{ steps.long-command.outputs.output }}'"
exit 1
- name: Run with verbose
id: with-verbose
uses: ./.github/resources/.actions/cli-runner
with:
command: "help"
cli-version: "3.6.1"
verbose: "true"
env:
SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }}
- name: Ensure verbose flag worked
if: steps.with-verbose.outputs.ok != 'true'
run: |
echo "Verbose flag failure"
echo "ok: '${{ steps.with-verbose.outputs.ok }}'"
echo "output: '${{ steps.with-verbose.outputs.output }}'"
exit 1
- name: First run (install if missing)
id: no-cache
uses: ./.github/resources/.actions/cli-runner
with:
command: "version"
cli-version: "3.6.1"
env:
SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }}
- name: Second run (cache hit)
id: cache-hit
uses: ./.github/resources/.actions/cli-runner
with:
command: "version"
cli-version: "3.6.1"
env:
SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Ensure cache worked
if: github.run_attempt > 1 && steps.cache-hit.outputs.ok != 'true'
run: |
echo "cache failure"
exit 1
- name: Run with invalid command
id: invalid-command
continue-on-error: true
uses: ./.github/resources/.actions/cli-runner
with:
command: "invalid-command"
cli-version: "3.6.1"
env:
SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }}
- name: Expect failure
if: steps.invalid-command.outputs.ok == 'true'
run: |
echo "Expected failure with invalid command"
echo "output: '${{ steps.invalid-command.outputs.output }}'"
echo "ok: '${{ steps.invalid-command.outputs.ok }}'"
exit 1
- name: Test specific version
id: specific-version
uses: ./.github/resources/.actions/cli-runner
with:
command: "version"
cli-version: "3.5.0"
env:
SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }}
- name: Ensure specific version
if: ${{ !contains(steps.specific-version.outputs.output, '3.5.0') }}
run: |
echo "Specific version failure"
echo "output: '${{ steps.specific-version.outputs.output }}'"
exit 1