-
-
Notifications
You must be signed in to change notification settings - Fork 656
284 lines (249 loc) · 8.56 KB
/
zzz-reuse-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
---
name: Reusable worfklow for tests
on:
workflow_call:
###
### Variables
###
inputs:
matrix:
description: 'The test matrix'
required: true
type: string
custom_config:
description: 'Apply customized .env configuration?'
required: true
type: boolean
operating_system:
description: 'The operating system to run on'
required: true
type: string
jobs:
# -----------------------------------------------------------------------------------------------
# JOB: BUILD
# -----------------------------------------------------------------------------------------------
test:
runs-on: ${{ inputs.operating_system }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(inputs.matrix) }}
steps:
# ------------------------------------------------------------
# Setup repository
# ------------------------------------------------------------
- name: "[SETUP] Checkout repository (current)"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "[DEBUG] Show Matrix configuration"
shell: bash
run: |
echo '${{ toJson(matrix) }}' | jq -r
- name: "[DEBUG] Show env variables"
shell: bash
run: |
env
- name: "[DEBUG] Show open network ports"
shell: bash
run: |
netstat -an || true
ss -tlun || true
- name: "[DEBUG] Show Docker version"
shell: bash
run: |
docker version
- name: "[DEBUG] Show Docker Compose version"
shell: bash
run: |
docker-compose version
# ------------------------------------------------------------
# Configure
# ------------------------------------------------------------
- name: "[Configure] Configure customized configuration"
shell: bash
run: |
cd "${GITHUB_WORKSPACE}/.tests/"
# Test full customization
make configure KEY=DEBUG_ENTRYPOINT VAL="$(( RANDOM % 3 ))"
make configure KEY=DOCKER_LOGS VAL="$(( RANDOM % 1 ))"
make configure KEY=TLD_SUFFIX VAL=loc2
make configure KEY=TIMEZONE VAL='Europe/Berlin'
make configure KEY=PHP_MODULES_DISABLE VAL=
make configure KEY=HTTPD_TEMPLATE_DIR VAL=.config
make configure KEY=HOST_PORT_HTTPD VAL=8080
make configure KEY=HOST_PORT_HTTPD_SSL VAL=8443
make configure KEY=MYSQL_ROOT_PASSWORD VAL=mysqlpass
make configure KEY=PGSQL_ROOT_USER VAL=pgroot
make configure KEY=PGSQL_ROOT_PASSWORD VAL=pgsqlpass
make configure KEY=DEVILBOX_VENDOR_PHPMYADMIN_AUTOLOGIN VAL=0
if: inputs.custom_config
- name: "[Configure] Configure versions"
shell: bash
run: |
# (1/3) Change to .tests/ directory
cd "${GITHUB_WORKSPACE}/.tests/"
# (2/3) Change MySQL port 3306 to 3307 (3306 is already taken)
make configure KEY=HOST_PORT_MYSQL VAL=3307
# (3/3) Loop over configured values
while IFS= read -r line; do
KEY="${line}"
VAL="$( echo '${{ toJson(matrix) }}' | jq -r ".${KEY}" | awk '{print $NF}' )"
echo "KEY: ${KEY}"
echo "VAL: ${VAL}"
# Set the matrix version
make configure KEY="${KEY}" VAL="${VAL}"
done <<< "$( echo '${{ toJson(matrix) }}' | jq -r 'keys[]' )"
- name: "[Configure] Show .env file"
shell: bash
run: |
cat .env
# ------------------------------------------------------------
# Startup
# ------------------------------------------------------------
- name: "[Startup] Pull images"
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make pull
- name: "[Startup] Start Devilbox"
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make start
- name: "[Startup] Show Docker logs"
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make logs
# ------------------------------------------------------------
# Run tests
# ------------------------------------------------------------
- name: Test Modules
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-modules
- name: Test Config
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-config
if: success() || failure()
- name: Test Intranet
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-intranet
if: success() || failure()
- name: Test Vendors
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-vendors
if: success() || failure()
- name: Test Vhosts
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-vhosts
if: success() || failure()
- name: Test Reverse Proxy
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-rproxies
if: success() || failure()
- name: Test SSL
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-ssl
if: success() || failure()
- name: Test Bind
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-bind
if: success() || failure()
- name: Test Autostart
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-autostart
if: success() || failure()
- name: "Test Framework: CakePHP"
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-framework-cakephp
if: success() || failure()
- name: "Test Framework: Drupal"
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-framework-drupal
if: success() || failure()
- name: "Test Framework: Wordpress"
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-framework-wordpress
if: success() || failure()
- name: "Test Container"
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make test-smoke-container
if: success() || failure()
# ------------------------------------------------------------
# Finish
# ------------------------------------------------------------
- name: "Finish: Docker logs"
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make logs
if: success() || failure()
- name: "Finish: Shutdown"
uses: cytopia/[email protected]
with:
retries: 3
workdir: "${{ github.workspace }}/.tests/"
command: |
make stop
if: success() || failure()