-
-
Notifications
You must be signed in to change notification settings - Fork 5
345 lines (301 loc) · 10.5 KB
/
ci.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
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
name: CI
on:
push:
branches: [master]
pull_request:
env:
EXTNAME: 'alfredoramos/markdown'
SNIFF: 1
IMAGE_ICC: 1
EPV: 1
EXECUTABLE_FILES: 1
PHPBB_BRANCH: 3.3.x
jobs:
basic-tests:
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
name: php ${{ matrix.php-version }}, none none
runs-on: ubuntu-20.04
env:
PHP_VERSION: ${{ matrix.php-version }}
strategy:
matrix:
php-version: ['7.2']
steps:
- name: Checkout phpBB
uses: actions/checkout@v4
with:
repository: phpbb/phpbb
ref: ${{ env.PHPBB_BRANCH }}
path: phpBB3
- name: Checkout extension
uses: actions/checkout@v4
with:
path: extension
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, intl, gd, exif, iconv, pgsql
tools: composer:v2
coverage: none
- name: Setup Composer
id: setup-composer
working-directory: phpBB3/phpBB
run: echo "cache-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Setup cache
uses: actions/cache@v4
with:
path: ${{ steps.setup-composer.outputs.cache-dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock', '**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup environment for phpBB
working-directory: phpBB3
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: 'extension/.tool-versions'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install Node dependencies
working-directory: extension
run: npm install
- name: Setup extension
working-directory: extension
run: |
chmod +x .github/setup-extension.sh
.github/setup-extension.sh $EXTNAME $NOTESTS
- name: Setup EPV
if: ${{ env.EPV == 1 }}
working-directory: phpBB3/phpBB
run: composer require -n --prefer-dist --no-progress phpbb/epv:dev-master
- name: Run code sniffer
if: ${{ env.SNIFF == 1 }}
working-directory: phpBB3
run: .github/ext-sniff.sh $EXTNAME $NOTESTS
- name: Check image ICC profiles
if: ${{ env.IMAGE_ICC == 1 }}
working-directory: phpBB3
run: .github/check-image-icc-profiles.sh
- name: Check executable files
if: ${{ env.EXECUTABLE_FILES == 1 }}
working-directory: phpBB3
run: .github/ext-check-executable-files.sh ./ $EXTNAME
- name: Run EPV
if: ${{ env.EPV == 1 }}
working-directory: phpBB3
run: phpBB/vendor/bin/EPV.php run --dir="phpBB/ext/$EXTNAME"
mysql-tests:
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
name: php ${{ matrix.php-version }}, ${{ matrix.db-type }} ${{ matrix.db-version }}
runs-on: ubuntu-20.04
services:
mysql:
image: ${{ (matrix.db-type == 'mysql' || matrix.db-type == 'mariadb') && matrix.db-type || 'mariadb' }}:${{ (matrix.db-type == 'mysql' || matrix.db-type == 'mariadb' && matrix.db-version != 'none') && matrix.db-version || 'latest' }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: phpbb_tests
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
env:
DB: ${{ matrix.db-type }}
MYISAM: 0
PHP_VERSION: ${{ matrix.php-version }}
strategy:
matrix:
include:
- php-version: '7.2'
db-type: 'mysql'
db-version: '5.7'
- php-version: '7.2'
db-type: 'mariadb'
db-version: '10.5'
- php-version: '7.3'
db-type: 'mariadb'
db-version: '10.5'
- php-version: '7.4'
db-type: 'mysql'
db-version: '8.0'
- php-version: '7.4'
db-type: 'mariadb'
db-version: '10.5'
- php-version: '8.0'
db-type: 'mariadb'
db-version: '10.5'
- php-version: '8.1'
db-type: 'mariadb'
db-version: '10.6'
- php-version: '8.2'
db-type: 'mariadb'
db-version: '10.6'
steps:
- name: Checkout phpBB
uses: actions/checkout@v4
with:
repository: phpbb/phpbb
ref: ${{ env.PHPBB_BRANCH }}
path: phpBB3
- name: Checkout extension
uses: actions/checkout@v4
with:
path: extension
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, intl, gd, exif, iconv, pgsql
tools: composer:v2
coverage: none
- name: Setup Composer
id: setup-composer
working-directory: phpBB3/phpBB
run: echo "cache-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Setup cache
uses: actions/cache@v4
with:
path: ${{ steps.setup-composer.outputs.cache-dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock', '**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup environment for phpBB
working-directory: phpBB3
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: 'extension/.tool-versions'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install Node dependencies
working-directory: extension
run: npm install
- name: Setup extension
working-directory: extension
run: |
chmod +x .github/setup-extension.sh
.github/setup-extension.sh $EXTNAME $NOTESTS
- name: Setup database
working-directory: phpBB3
run: .github/setup-database.sh $DB $MYISAM
- name: Setup PHPUnit files
working-directory: phpBB3
run: |
mkdir -p phpBB/ext/$EXTNAME/ci
cp -a .github/phpunit* phpBB/ext/$EXTNAME/ci/
- name: Run unit tests
working-directory: phpBB3
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/ci/phpunit-$DB-github.xml --bootstrap tests/bootstrap.php
postgresql-tests:
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
name: php ${{ matrix.php-version }}, ${{ matrix.db-type }} ${{ matrix.db-version }}
runs-on: ubuntu-20.04
services:
postgres:
image: ${{ (matrix.db-type == 'postgres') && matrix.db-type || 'postgres' }}:${{ (matrix.db-type == 'postgres' && matrix.db-version != 'none') && matrix.db-version || 'alpine' }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
-v /var/run/postgresql:/var/run/postgresql
--health-cmd="pg_isready"
--health-interval=10s
--health-timeout=5s
--health-retries=3
env:
DB: ${{ matrix.db-type }}
MYISAM: 0
PHP_VERSION: ${{ matrix.php-version }}
strategy:
matrix:
include:
- php-version: '7.2'
db-type: 'postgres'
db-version: '15-alpine'
- php-version: '8.2'
db-type: 'postgres'
db-version: '16-alpine'
steps:
- name: Checkout phpBB
uses: actions/checkout@v4
with:
repository: phpbb/phpbb
ref: ${{ env.PHPBB_BRANCH }}
path: phpBB3
- name: Checkout extension
uses: actions/checkout@v4
with:
path: extension
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, intl, gd, exif, iconv, pgsql
tools: composer:v2
coverage: none
- name: Setup Composer
id: setup-composer
working-directory: phpBB3/phpBB
run: echo "cache-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Setup cache
uses: actions/cache@v4
with:
path: ${{ steps.setup-composer.outputs.cache-dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock', '**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup environment for phpBB
working-directory: phpBB3
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: 'extension/.tool-versions'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install Node dependencies
working-directory: extension
run: npm install
- name: Setup extension
working-directory: extension
run: |
chmod +x .github/setup-extension.sh
.github/setup-extension.sh $EXTNAME $NOTESTS
- name: Setup database
working-directory: phpBB3
run: .github/setup-database.sh $DB $MYISAM
- name: Setup PHPUnit files
working-directory: phpBB3
run: |
mkdir -p phpBB/ext/$EXTNAME/ci
cp -a .github/phpunit* phpBB/ext/$EXTNAME/ci/
- name: Run unit tests
working-directory: phpBB3
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/ci/phpunit-$DB-github.xml --bootstrap tests/bootstrap.php
lint:
if: ${{ !contains(github.event.head_commit.message, 'skip lint') }}
runs-on: ubuntu-latest
steps:
- name: Checkout extension
uses: actions/checkout@v4
with:
path: extension
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: 'extension/.tool-versions'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install Node dependencies
working-directory: extension
run: npm install
- name: Test SCSS
working-directory: extension
run: npm run lint-scss