-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
396 lines (382 loc) · 13.7 KB
/
ci.yml
File metadata and controls
396 lines (382 loc) · 13.7 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
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
name: CI Joomla
on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
composer:
name: Install PHP dependencies
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.4
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache-php
with:
path: libraries/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
- name: Install PHP dependencies
if: steps.cache-php.outputs.cache-hit != 'true'
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
composer config --global home
composer validate --no-check-all --strict
composer install --no-progress --ignore-platform-reqs
npm:
name: Install JS/CSS dependencies and build assets
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.4
needs: [composer]
steps:
- uses: actions/setup-node@v4
with:
node-version: latest
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache-assets
with:
path: |
node_modules
media
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json', 'build/media_source/**', 'administrator/components/com_media/resources/**') }}
- uses: actions/cache/restore@v4
with:
path: libraries/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
- name: Build assets
if: steps.cache-assets.outputs.cache-hit != 'true'
run: npm ci --unsafe-perm
code-style-php:
name: Check PHP code style
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.4
needs: [composer]
strategy:
matrix:
command: ['php-cs-fixer fix -vvv --dry-run --diff', 'phpcs --extensions=php -p --standard=ruleset.xml .']
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: libraries/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
- name: Check PHP code style
env:
PHP_CS_FIXER_IGNORE_ENV: true
run: ./libraries/vendor/bin/${{ matrix.command }}
code-style-js-css:
name: Check Javascript & CSS code style
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.4
needs: [composer, npm]
strategy:
matrix:
check: ['lint:js', 'lint:testjs', 'lint:css']
steps:
- uses: actions/setup-node@v4
with:
node-version: latest
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: |
node_modules
media
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json', 'build/media_source/**', 'administrator/components/com_media/resources/**') }}
- name: Check code style
run: npm run ${{ matrix.check }}
phpstan:
name: Run PHPstan
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.4
needs: [code-style-php]
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: libraries/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
- name: Run PHPstan
run: |
./libraries/vendor/bin/phpstan --error-format=github
tests-unit:
name: Run Unit tests
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php${{ matrix.php_version }}
needs: [code-style-php]
strategy:
matrix:
php_version: ['8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: libraries/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- name: Run Unit tests
run: ./libraries/vendor/bin/phpunit --testsuite Unit
tests-integration:
name: Run integration tests
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php${{ matrix.php_version }}
needs: [code-style-php]
strategy:
matrix:
php_version: ['8.1', '8.2', '8.3', '8.4', '8.5']
config:
- my_version: '8.4'
engine: 'mysqli'
host: 'mysql'
user: 'joomla_ut'
- my_version: '8.0.13'
engine: 'mysqli'
host: 'mysql'
user: 'joomla_ut'
- maria_version: '12.0'
engine: 'mysqli'
host: 'maria'
user: 'joomla_ut'
- maria_version: '10.4'
engine: 'mysqli'
host: 'maria'
user: 'joomla_ut'
- pg_version: '12.0'
engine: 'pgsql'
host: 'postgres'
user: 'root'
- pg_version: '18.0'
engine: 'pgsql'
host: 'postgres'
user: 'root'
steps:
- uses: actions/checkout@v4
- name: Start LDAP container
uses: docker://docker
with:
args: docker run -d --name openldap --network ${{ job.container.network }} --network-alias openldap -e "LDAP_ADMIN_USERNAME=admin" -e "LDAP_ADMIN_PASSWORD=adminpassword" -e "LDAP_USERS=customuser" -e "LDAP_PASSWORDS=custompassword" -e "LDAP_ENABLE_TLS=yes" -e "LDAP_TLS_CERT_FILE=/certs/openldap.crt" -e "LDAP_TLS_KEY_FILE=/certs/openldap.key" -e "LDAP_TLS_CA_FILE=/certs/CA.crt" -e "BITNAMI_DEBUG=true" -e "LDAP_CONFIG_ADMIN_ENABLED=yes" -e "LDAP_CONFIG_ADMIN_USERNAME=admin" -e "LDAP_CONFIG_ADMIN_PASSWORD=configpassword" -v "${{ github.workspace }}/tests/certs/openldap.crt":"/certs/openldap.crt" -v "${{ github.workspace }}/tests/certs/openldap.key":"/certs/openldap.key" -v "${{ github.workspace }}/tests/certs/CA.crt":"/certs/CA.crt" ghcr.io/joomla-projects/mirror-bitnami-openldap:latest
- uses: actions/cache/restore@v4
with:
path: libraries/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- name: Run Integration tests
env:
JTEST_DB_ENGINE: ${{ matrix.config.engine }}
JTEST_DB_HOST: ${{ matrix.config.host }}
JTEST_DB_USER: ${{ matrix.config.user }}
JTEST_DB_NAME: test_joomla
JTEST_DB_PASSWORD: joomla_ut
run: |
sleep 3
./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit.xml.dist
- name: Stop LDAP container
uses: docker://docker
with:
args: docker kill openldap
services:
mysql:
image: mysql:${{ matrix.config.my_version || '8.4' }}
env:
MYSQL_USER: joomla_ut
MYSQL_PASSWORD: joomla_ut
MYSQL_ROOT_PASSWORD: joomla_ut
MYSQL_DATABASE: test_joomla
maria:
image: mariadb:${{ matrix.config.maria_version || '12.0' }}
env:
MARIADB_USER: joomla_ut
MARIADB_PASSWORD: joomla_ut
MARIADB_ROOT_PASSWORD: joomla_ut
MARIADB_DATABASE: test_joomla
postgres:
image: postgres:${{ matrix.config.pg_version || '18' }}-alpine
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: joomla_ut
POSTGRES_DB: test_joomla
tests-unit-windows:
name: Run Unit tests (Windows)
runs-on: windows-latest
needs: [code-style-php]
strategy:
matrix:
php_version: ['8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
id: cache-php-windows
with:
path: libraries/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
extensions: openssl, mbstring, fileinfo, gd, gmp, pgsql, mysql, mysqli, curl, opcache, ldap
ini-values: post_max_size=256M, date.timezone="UTC"
- name: Install Composer dependencies
if: steps.cache-php-windows.outputs.cache-hit != 'true'
run: composer install --no-progress --ignore-platform-reqs
- name: Run Unit tests
run: php libraries/vendor/bin/phpunit --testsuite Unit
tests-integration-windows:
name: Run integration tests (Windows)
runs-on: windows-latest
needs: [code-style-php]
strategy:
matrix:
php_version: ['8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: libraries/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "mariadb-10.4"
root-password: "joomla_ut"
user: "joomla_ut"
password: "joomla_ut"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
extensions: openssl, mbstring, fileinfo, gd, gmp, pgsql, mysql, mysqli, curl, opcache, ldap
ini-values: post_max_size=256M, date.timezone="UTC"
- name: Install Composer dependencies
if: steps.cache-php-windows.outputs.cache-hit != 'true'
run: |
composer install --no-progress --ignore-platform-reqs
mysql -uroot -pjoomla_ut -e 'CREATE DATABASE IF NOT EXISTS test_joomla;'
- name: Run Integration tests
run: |
sleep 3
php libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-windows.xml.dist
tests-system-prepare:
name: Prepare system tests
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:cypress8.4
needs: [composer, npm]
env:
CYPRESS_VERIFY_TIMEOUT: 100000
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: |
node_modules
media
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json', 'build/media_source/**', 'administrator/components/com_media/resources/**') }}
- uses: actions/cache@v4
id: cache-cypress
with:
path: |
/root/.cache/Cypress
/github/home/.cache/Cypress
key: ${{ runner.os }}-cypress-${{ hashFiles('package-lock.json') }}
- name: Install Cypress dependencies
if: steps.cache-cypress.outputs.cache-hit != 'true'
run: |
npx cypress install
npx cypress verify
tests-system:
name: Run system tests
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:cypress${{ matrix.config.php_version }}
needs: [tests-system-prepare]
strategy:
matrix:
browser: ['chrome', 'edge']
config:
- php_version: '8.5'
test_group: cmysqlmax
db_engine: mysqli
db_host: mysql
my_version: '8.4'
- php_version: '8.1'
test_group: cmysql
db_engine: mysqli
db_host: mysql
my_version: '8.0.13'
- php_version: '8.4'
test_group: cmariamax
db_engine: mysqli
db_host: maria
maria_version: '12.0'
- php_version: '8.1'
test_group: cmaria
db_engine: mysqli
db_host: maria
maria_version: '10.4'
- php_version: '8.1'
test_group: cpostgres
db_engine: pgsql
db_host: postgres
pg_version: '12.0'
- php_version: '8.5'
test_group: cpostgresmax
db_engine: pgsql
db_host: postgres
pg_version: '18.0'
env:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: libraries/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
- uses: actions/cache/restore@v4
with:
path: |
node_modules
media
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json', 'build/media_source/**', 'administrator/components/com_media/resources/**') }}
- uses: actions/cache/restore@v4
with:
path: |
/root/.cache/Cypress
/github/home/.cache/Cypress
key: ${{ runner.os }}-cypress-${{ hashFiles('package-lock.json') }}
- name: Run System tests
run: bash tests/System/entrypoint.sh "$(pwd)" ${{ matrix.config.test_group }} ${{ matrix.config.db_engine }} ${{ matrix.config.db_host }} ${{ matrix.browser }}
- name: Archive test results results
uses: actions/upload-artifact@v4
if: always()
with:
name: system-test-output
path: tests/System/output
if-no-files-found: ignore
services:
mysql:
image: mysql:${{ matrix.config.my_version || '8.4' }}
env:
MYSQL_USER: joomla_ut
MYSQL_PASSWORD: joomla_ut
MYSQL_ROOT_PASSWORD: joomla_ut
MYSQL_DATABASE: test_joomla
maria:
image: mariadb:${{ matrix.config.maria_version || '12.0' }}
env:
MARIADB_USER: joomla_ut
MARIADB_PASSWORD: joomla_ut
MARIADB_ROOT_PASSWORD: joomla_ut
MARIADB_DATABASE: test_joomla
postgres:
image: postgres:${{ matrix.config.pg_version || '18' }}-alpine
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: joomla_ut
POSTGRES_DB: test_joomla
typos:
name: Check for typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Spell Check Repository
uses: crate-ci/typos@v1.34.0
with:
config: .github/workflows/typos.toml