-
Notifications
You must be signed in to change notification settings - Fork 81
294 lines (253 loc) · 11.9 KB
/
test-application.yaml
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
name: Test application
on:
pull_request:
push:
branches:
- '[0-9]+.x'
- '[0-9]+.[0-9]+'
schedule:
- cron: "0 0 * * *"
jobs:
test:
name: "PHP ${{ matrix.php-version }} and Node.js ${{ matrix.node-version }}"
runs-on: ubuntu-latest
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
include:
- php-version: '8.2'
node-version: '18'
npm-version: '8'
mysql-version: '5.7'
create-project: false
create-database: false
checkout-directory: 'project'
working-directory: 'project'
php-extensions: 'ctype, iconv, mysql, gd'
tools: 'composer:v2'
env:
APP_ENV: test
APP_SECRET: a448d1dfcaa563fce56c2fd9981f662b
MAILER_URL: null://localhost
SULU_ADMIN_EMAIL:
DATABASE_URL: "mysql://root:@127.0.0.1:3306/sulu_test?serverVersion=5.7"
- php-version: '8.3'
node-version: '20'
npm-version: '9'
mysql-version: '8.0'
create-project: true
create-database: true
checkout-directory: 'project'
working-directory: 'create-project-test'
php-extensions: 'ctype, iconv, mysql, gd'
tools: 'composer:v2'
env:
APP_ENV: test
APP_SECRET: a448d1dfcaa563fce56c2fd9981f662b
MAILER_URL: null://localhost
SULU_ADMIN_EMAIL:
DATABASE_URL: "mysql://root:@127.0.0.1:3306/sulu_test?serverVersion=8.0"
- php-version: '8.4'
node-version: '22'
npm-version: '10'
mysql-version: '8.0'
create-project: true
create-database: true
checkout-directory: 'project'
working-directory: 'create-project-test'
php-extensions: 'ctype, iconv, mysql, gd'
tools: 'composer:v2'
env:
APP_ENV: test
APP_SECRET: a448d1dfcaa563fce56c2fd9981f662b
MAILER_URL: null://localhost
SULU_ADMIN_EMAIL:
DATABASE_URL: "mysql://root:@127.0.0.1:3306/sulu_test?serverVersion=8.0"
PHP_CS_FIXER_IGNORE_ENV: true # remove when php cs fixer add support for PHP 8.4
services:
mysql:
image: mysql:${{ matrix.mysql-version }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
path: ${{ matrix.checkout-directory }}
- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ matrix.php-extensions }}
tools: ${{ matrix.tools }}
coverage: none
- name: Install composer dependencies
if: ${{ !matrix.create-project }}
uses: ramsey/composer-install@v3
with:
composer-options: '--no-cache'
dependency-versions: 'highest'
working-directory: "${{ matrix.working-directory }}"
- name: Create project
if: ${{ matrix.create-project }}
run: |
composer create-project sulu/skeleton ${{ matrix.working-directory }} --repository="{\"type\":\"path\",\"url\":\"./${{ matrix.checkout-directory }}/\"}" --stability=dev --no-cache --no-interaction
cd ${{ matrix.working-directory }}
echo 'DATABASE_URL=mysql://root:@127.0.0.1:3306/sulu?serverVersion=5.7' >> .env.local
echo 'DATABASE_URL=mysql://root:@127.0.0.1:3306/sulu_test?serverVersion=5.7' >> .env.test.local
- name: Create database
if: ${{ matrix.create-database }}
run: bin/adminconsole doctrine:database:create
env: ${{ matrix.env }}
working-directory: ${{ matrix.working-directory }}
- name: Build sulu
run: bin/adminconsole sulu:build dev --env dev --no-interaction
env: ${{ matrix.env }}
working-directory: ${{ matrix.working-directory }}
- name: Test phpcr
run: |
bin/console doctrine:phpcr:node:dump "/cmf/website/contents" --env dev --no-interaction
bin/console doctrine:phpcr:node:dump "/cmf/website/contents" --env prod --no-interaction
env: ${{ matrix.env }}
working-directory: ${{ matrix.working-directory }}
- name: Build container
run: |
bin/adminconsole cache:clear --env dev
bin/websiteconsole cache:clear --env dev
bin/adminconsole cache:clear --env test
bin/websiteconsole cache:clear --env test
bin/adminconsole cache:clear --env stage
bin/websiteconsole cache:clear --env stage
bin/adminconsole cache:clear --env prod
bin/websiteconsole cache:clear --env prod
env: ${{ matrix.env }}
working-directory: ${{ matrix.working-directory }}
- name: Lint Code
env: ${{ matrix.env }}
working-directory: ${{ matrix.working-directory }}
run: composer lint
- name: Bootstrap tests
env: ${{ matrix.env }}
working-directory: ${{ matrix.working-directory }}
run: composer bootstrap-test-environment
- name: Execute test cases
env: ${{ matrix.env }}
working-directory: ${{ matrix.working-directory }}
run: composer test
- name: Test download-language script
run: bin/adminconsole sulu:admin:download-language nl
env: ${{ matrix.env }}
working-directory: ${{ matrix.working-directory }}
- name: Install and configure Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install npm
if: ${{ matrix.npm-version }}
run: npm install --global npm@${{ matrix.npm-version }}
- name: Install npm dependencies
uses: bahmutov/npm-install@v1
with:
working-directory: ${{ matrix.working-directory }}/assets/admin
useLockFile: false
- name: Build administration interface application
run: npm run build
working-directory: ${{ matrix.working-directory }}/assets/admin
php-windows:
name: "PHP ${{ matrix.php-version }} and Node.js ${{ matrix.node-version }} on Windows"
runs-on: windows-latest
env:
APP_ENV: test
APP_SECRET: a448d1dfcaa563fce56c2fd9981f662b
MAILER_URL: null://localhost
SULU_ADMIN_EMAIL:
DATABASE_URL: mysql://root:[email protected]:3306/sulu_test?serverVersion=${{ matrix.mysql-version }}
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOCK_DSN: flock
strategy:
fail-fast: false
matrix:
include:
- php-version: '8.3'
node-version: '20'
npm-version: '10'
mysql-version: '8.0'
php-extensions: 'ctype, iconv, intl, mysql, pdo_mysql, php_fileinfo, gd, sodium, zip'
tools: 'composer:v2'
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ matrix.php-extensions }}
tools: ${{ matrix.tools }}
ini-values: 'memory_limit=-1'
# Github clones with false line endings on Windows make php-cs-fix fail
# Rector seems to fail on Windows with child processes
- name: Disable php-cs and rector
run: |
echo '<?php file_put_contents("composer.json", str_replace("\"lint-php-cs", "\"deactivate-lint-php-cs-fix", file_get_contents("composer.json"))); file_put_contents("composer.json", str_replace("\"lint-rector", "\"deactivate-lint-rector", file_get_contents("composer.json")));' > disable.php
cat disable.php
php disable.php
cat composer.json
rm disable.php
- name: Install and configure MySQL
uses: shogo82148/[email protected]
with:
mysql-version: ${{ matrix.mysql-version }}
root-password: 'root'
my-cnf: |
[mysqld]
default-authentication-plugin=mysql_native_password
- name: Install composer dependencies
uses: ramsey/composer-install@v3
with:
composer-options: '--no-cache'
dependency-versions: 'highest'
- name: Build sulu
run: php bin/adminconsole sulu:build dev --env dev --no-interaction
- name: Test phpcr
run: |
php bin/console doctrine:phpcr:node:dump "/cmf/website/contents" --env dev --no-interaction
php bin/console doctrine:phpcr:node:dump "/cmf/website/contents" --env prod --no-interaction
- name: Build container
run: |
php bin/adminconsole cache:clear --env dev
php bin/websiteconsole cache:clear --env dev
php bin/adminconsole cache:clear --env test
php bin/websiteconsole cache:clear --env test
php bin/adminconsole cache:clear --env stage
php bin/websiteconsole cache:clear --env stage
php bin/adminconsole cache:clear --env prod
php bin/websiteconsole cache:clear --env prod
- name: Lint Code
run: |
composer lint
- name: Bootstrap tests
run: composer bootstrap-test-environment
- name: Execute test cases
run: composer test
- name: Test download-language script
run: php bin/adminconsole sulu:admin:download-language nl
- name: Install and configure Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install npm
if: ${{ matrix.npm-version }}
run: npm install --global npm@${{ matrix.npm-version }}
- name: Install npm dependencies
uses: bahmutov/npm-install@v1
with:
working-directory: assets/admin
useLockFile: false
- name: Build administration interface application
run: npm run build
working-directory: assets/admin