-
Notifications
You must be signed in to change notification settings - Fork 210
244 lines (196 loc) · 7.2 KB
/
test-workflow.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
name: Valet Plus test pipeline
on:
push:
branches: [ 2.x ]
pull_request:
branches: [ 2.x ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel# All actions starting with [INSTALL] are installation instructions that can be found
# in the Valet+ installation wiki page: https://github.com/weprovide/valet-plus/wiki/Installation
jobs:
test:
# Build on Catalina and later Big Sur (Not public released yet: https://github.com/actions/virtual-environments/issues/2486)
strategy:
matrix:
os: [macos-10.15]
runs-on: ${{matrix.os}}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel# All actions starting with [INSTALL] are installation instructions that can be found
# in the Valet+ installation wiki page: https://github.com/weprovide/valet-plus/wiki/Installation
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Valet install command test cases
- name: '[INSTALL] Brew update'
run: brew update
# For the Valet+ CI/CD remove the default brew PHP. Instead use valet-php.
# On a local installation one might choose to keep his/her default brew PHP installation.
- name: '[INSTALL] Brew uninstall php'
run: |
brew uninstall php
# Install the valet-php brew tap.
- name: '[INSTALL] Brew tap henkrehost/php'
run: |
brew tap henkrehorst/php
# Remove 2to3 to ensure python installation: https://github.com/weprovide/valet-plus/issues/558
# Install the default PHP version (currently: [email protected]).
- name: '[INSTALL] Brew install [email protected]'
run: |
rm /usr/local/bin/2to3
brew install [email protected] --build-from-source
# Link [email protected] as default php binary.
- name: '[INSTALL] Brew link [email protected]'
run: |
brew link [email protected] --force
php -v | grep 7.3
# Since the Github actions CI/CD image comes with composer pre-installed there is no need to install composer.
# However the image might change in the future. To ensure installation over several images an IF ELSE used.
# If installed print "Composer is already installed!" else install composer from brew.
# This way even if the image changes the installation instruction would be checked.
- name: '[INSTALL] Brew install composer'
run: |
if which composer | grep -q composer; then echo Composer is already installed!; else brew install composer; fi
- name: '[INSTALL] Composer install'
run: |
composer install
# If the code style does not pass there is no need to run other tests.
- name: '[CODE STYLE] Check PSR-2'
run: |
./vendor/squizlabs/php_codesniffer/bin/phpcs
# Somewhere around this point the Valet+ binary needs to be referenced in your PATH.
# Since the CI/CD targeting the binary directly the CI/CD does not check this.
- name: '[INSTALL] Valet fix'
run: |
./valet fix
- name: '[INSTALL] Valet install'
run: |
./valet install
# Nginx test cases
# Check if nginx was able to start correctly.
- name: '[NGINX] Sudo nginx -t'
run: |
sudo nginx -t
# Check if the Valet+ localhost page is reachable.
- name: '[NGINX] Check local host'
run: |
curl 127.0.0.1 | grep "Valet - Not Found"
# PHP 5.6 Command test cases
- name: '[PHP 5.6] Switch to'
run: |
./valet use 5.6
- name: '[PHP 5.6] Check version'
run: |
php -v | grep 5.6
- name: '[PHP 5.6] xdebug on and off'
run: |
./valet xdebug on
./valet xdebug off
- name: '[PHP 5.6] ioncube on and off'
run: |
./valet ioncube on
./valet ioncube off
# PHP 7.0 Command test cases
- name: '[PHP 7.0] Switch to'
run: |
./valet use 7.0
- name: '[PHP 7.0] Check version'
run: |
php -v | grep 7.0
- name: '[PHP 7.0] xdebug on and off'
run: |
./valet xdebug on
./valet xdebug off
- name: '[PHP 7.0] ioncube on and off'
run: |
./valet ioncube on
./valet ioncube off
# PHP 7.1 Command test cases
- name: '[PHP 7.1] Switch to'
run: |
./valet use 7.1
- name: '[PHP 7.1] Check version'
run: |
php -v | grep 7.1
- name: '[PHP 7.1] xdebug on and off'
run: |
./valet xdebug on
./valet xdebug off
- name: '[PHP 7.1] ioncube on and off'
run: |
./valet ioncube on
./valet ioncube off
# PHP 7.2 Command test cases
- name: '[PHP 7.2] Switch to'
run: |
./valet use 7.2
- name: '[PHP 7.2] Check version'
run: |
php -v | grep 7.2
- name: '[PHP 7.2] xdebug on and off'
run: |
./valet xdebug on
./valet xdebug off
- name: '[PHP 7.2] ioncube on and off'
run: |
./valet ioncube on
./valet ioncube off
# PHP 7.3 Command test cases
- name: '[PHP 7.3] Switch to'
run: |
./valet use 7.3
- name: '[PHP 7.3] Check version'
run: |
php -v | grep 7.3
- name: '[PHP 7.3] xdebug on and off'
run: |
./valet xdebug on
./valet xdebug off
- name: '[PHP 7.3] ioncube on and off'
run: |
./valet ioncube on
./valet ioncube off
# PHP 7.4 Command test cases
- name: '[PHP 7.4] Switch to'
run: |
./valet use 7.4
- name: '[PHP 7.4] Check version'
run: |
php -v | grep 7.4
- name: '[PHP 7.4] xdebug on and off'
run: |
./valet xdebug on
./valet xdebug off
- name: '[PHP 7.4] ioncube on and off'
run: |
./valet ioncube on
./valet ioncube off
# PHP 8.0 Command test cases
- name: '[PHP 8.0] Switch to'
run: |
./valet use 8.0
- name: '[PHP 8.0] Check version'
run: |
php -v | grep 8.0
- name: '[PHP 8.0] xdebug on and off'
run: |
./valet xdebug on
./valet xdebug off
- name: '[PHP 8.0] ioncube on and off'
run: |
./valet ioncube on
./valet ioncube off
# Test Memcached
- name: '[MEMCACHED] install'
run: |
brew reinstall pkg-config
./valet memcache install
- name: '[MEMCACHED] uninstall'
run: |
./valet memcache uninstall
# Extensions of commonly run commands, generally not hit or checked by the installation instructions.
# Chown the default PHP version to ensure deletion is possible.
# If we don't chown we'll get an permission error from the CI/CD.
# On local installations the printed instructions can be followed
# to manually remove the Cellar files.
- name: '[INSTALL] Valet fix --reinstall'
run: |
sudo chmod -R 777 /usr/local/Cellar/[email protected]
./valet fix --reinstall