-
-
Notifications
You must be signed in to change notification settings - Fork 169
503 lines (484 loc) · 18.2 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
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
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
name: ci
on:
push:
paths-ignore:
- "doc/**"
- "mddoc/**"
- "res/**"
- "split-repository/**"
- "website/**"
- ".markdownlint.json"
- "README.md"
pull_request:
jobs:
ci:
name: Linux Swoole-${{ matrix.swoole.version }} RoadRunner-${{ matrix.roadrunner }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
swoole:
- version: 5.0-php8.2
postgresql_version: ""
- version: 5.0-php8.1
postgresql_version: ""
- version: 5.0-php8.0
postgresql_version: ""
- version: 4.8-php8.1
postgresql_version: ""
- version: 4.8-php8.0
postgresql_version: "v4.8.0"
- version: 4.8-php7.4
postgresql_version: "v4.8.0"
roadrunner: [2.7.*]
env:
ENV_SERVICE: swoole
POSTGRESQL_VERSION: ${{ matrix.swoole.postgresql_version }}
SWOOLE_DOCKER_VERSION: ${{ matrix.swoole.version }}
MYSQL_DOCKER_VERSION: "8.0"
REDIS_SERVER_HOST: redis
ROADRUNNER_DOCKER_VERSION: ${{ matrix.roadrunner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache dependencies
uses: actions/cache@v4
with:
path: /tmp/composer
key: ${{ runner.os }}-composer-${{ matrix.swoole.version }}-${{ hashFiles('/composer.json') }}
- name: Prepare
uses: ./.github/actions/ci-prepare
with:
env: ${{ env.ENV_SERVICE }}
- name: Test
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test
- name: Test swoole
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-swoole
- name: Test workerman
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-workerman
- name: Test workerman-gateway
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-workerman-gateway
- name: Test roadrunner
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-roadrunner
- name: Test fpm
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-fpm
- name: Test jwt
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-jwt
- name: Test queue
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-queue
- name: Test amqp
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-amqp
- name: Test kafka
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-kafka
- name: Test grpc
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-grpc
- name: Test snowflake
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-snowflake
- name: Test mqtt
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-mqtt
- name: Test smarty
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-smarty
- name: Test pgsql
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-pgsql
- name: Test phar
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-phar
- name: Print logs
if: failure()
run: docker exec ${ENV_SERVICE} php .github/print-logs.php
ci-unix:
name: Linux Swoole-${{ matrix.swoole.version }} RoadRunner-${{ matrix.roadrunner }} With Redis UnixSocket
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
swoole:
- version: 4.8-php8.0
postgresql_version: f5eda17f89d160d0a89ac7c5db4636bdaefd48e6
roadrunner: [2.7.*]
env:
ENV_SERVICE: swoole
POSTGRESQL_VERSION: ${{ matrix.swoole.postgresql_version }}
SWOOLE_DOCKER_VERSION: ${{ matrix.swoole.version }}
MYSQL_DOCKER_VERSION: "8.0"
REDIS_SERVER_HOST: /tmp/docker/redis.sock
ROADRUNNER_DOCKER_VERSION: ${{ matrix.roadrunner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache dependencies
uses: actions/cache@v4
with:
path: /tmp/composer
key: ${{ runner.os }}-composer-${{ matrix.swoole.version }}-${{ hashFiles('/composer.json') }}
- name: Prepare
uses: ./.github/actions/ci-prepare
with:
env: ${{ env.ENV_SERVICE }}
- name: Test
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test
- name: Test swoole
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-swoole
- name: Test workerman
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-workerman
- name: Test workerman-gateway
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-workerman-gateway
- name: Test roadrunner
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-roadrunner
- name: Test fpm
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-fpm
- name: Test jwt
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-jwt
- name: Test queue
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-queue
- name: Test amqp
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-amqp
- name: Test kafka
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-kafka
- name: Test grpc
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-grpc
- name: Test snowflake
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-snowflake
- name: Test mqtt
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-mqtt
- name: Test smarty
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-smarty
- name: Test pgsql
if: ${{ env.test_prepared && always() }}
run: docker exec ${ENV_SERVICE} composer test-pgsql
- name: Print logs
if: failure()
run: docker exec ${ENV_SERVICE} php .github/print-logs.php
ci-swoole-cli:
name: Swoole-cli-${{ matrix.swoole-cli }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
swoole-cli: [v5.0.3, v4.8.11]
env:
MYSQL_DOCKER_VERSION: "8.0"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Services
shell: bash
run: |
sudo apt update && sudo apt install -y rsync
docker compose -f ./.github/docker-compose.yml up -d mysql postgres redis rabbitmq kafka1
echo "127.0.0.1 kafka1" | sudo tee -a /etc/hosts
- name: Setup swoole-cli
run: .github/script/install-swoole-cli.sh ${{ matrix.swoole-cli }}
- name: Check Version
run: |
swoole-cli -v
php -v
php -m
composer -V
php --ri swoole
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.swoole-cli }}-${{ hashFiles('/composer.json') }}
- name: Prepare
run: |
composer update --prefer-dist --no-progress
.github/prepare-kafka.sh
docker exec mysql mysql -uroot -p -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';flush privileges;"
tests/db/install-db.sh
docker exec postgres psql -d db_imi_test -U root -f /imi/.github/pgsql.sql
echo "test_prepared=1" >> $GITHUB_ENV
- name: Test
if: ${{ env.test_prepared && always() }}
run: composer test
- name: Test swoole
if: ${{ env.test_prepared && always() }}
run: composer test-swoole
- name: Test workerman
if: ${{ env.test_prepared && always() }}
run: composer test-workerman
- name: Test workerman-gateway
if: ${{ env.test_prepared && always() }}
run: composer test-workerman-gateway
- name: Test jwt
if: ${{ env.test_prepared && always() }}
run: composer test-jwt
- name: Test queue
if: ${{ env.test_prepared && always() }}
run: composer test-queue
- name: Test amqp
if: ${{ env.test_prepared && always() }}
run: composer test-amqp
- name: Test kafka
if: ${{ env.test_prepared && always() }}
run: composer test-kafka
- name: Test grpc
if: ${{ env.test_prepared && always() }}
run: composer test-grpc
- name: Test snowflake
if: ${{ env.test_prepared && always() }}
run: composer test-snowflake
- name: Test mqtt
if: ${{ env.test_prepared && always() }}
run: composer test-mqtt
- name: Test smarty
if: ${{ env.test_prepared && always() }}
run: composer test-smarty
# - name: Test pgsql
# if: ${{ matrix.swoole-cli == 'v5.0.3' && env.test_prepared && always() }}
# run: composer test-pgsql
- name: Test phar
if: ${{ env.test_prepared && always() }}
run: composer test-phar
- name: Print logs
if: failure()
run: php .github/print-logs.php
ci-macos:
name: MacOS PHP-${{ matrix.php }} Swoole-${{ matrix.swoole }} RoadRunner-${{ matrix.roadrunner }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
php: ["7.4", "8.0", "8.1", "8.2"]
swoole: [v5.0.3, v4.8.13]
roadrunner: [2.7.*]
exclude:
- php: 7.4
swoole: v5.0.3
- php: 8.2
swoole: v4.8.13
env:
MYSQL_SERVER_PASSWORD: "root"
PHP_VERSION: ${{ matrix.php }}
IMI_TEST_AMQP_SERVER_UTIL: 0
IMI_ROADRUNNER_BINARY: ${{ github.workspace }}/rr
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ROADRUNNER_DOCKER_VERSION: ${{ matrix.roadrunner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MySQL
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "8.0"
root-password: root
my-cnf: |
socket=/tmp/mysql.sock
- name: Setup Redis
uses: shogo82148/actions-setup-redis@v1
with:
redis-version: "6.x"
# MacOS Arm64 下需要下面的修复,否则无法编译成功
- name: Fix include
run: |
sudo mkdir -p /usr/local/include
sudo ln -s $(brew --prefix pcre2)/include/pcre2.h /usr/local/include/
- name: Get Openssl Dir
id: opecssl-dir
run: echo "path=$(brew --prefix openssl@1.1)" >> $GITHUB_OUTPUT
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: pecl
extensions: >
apcu, bcmath, curl, openssl, mbstring, intl, json, redis, mysqli, pdo, pdo_mysql, sockets, zip, :opcache,
swoole-swoole/swoole-src@${{ matrix.swoole }}
env:
SWOOLE_CONFIGURE_OPTS: >
--enable-openssl
--with-openssl-dir=${{ steps.opecssl-dir.outputs.path }}
--enable-http2
--enable-mysqlnd
--enable-swoole-json
--enable-swoole-curl
- name: Check Version
run: |
php -v
php -m
composer -V
php --ri swoole
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ env.php-versions }}-${{ hashFiles('/composer.json') }}
- name: Prepare
run: |
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS db_imi_test;'
composer update --prefer-dist --no-progress
tests/db/install-db.sh
- name: Install RoadRunner
run: |
echo no | src/Components/roadrunner/vendor/bin/rr get-binary -f $ROADRUNNER_DOCKER_VERSION
./rr -v
- name: Prepared
run: |
echo "test_prepared=1" >> $GITHUB_ENV
- name: Test
if: ${{ env.test_prepared && always() }}
run: composer test
- name: Test swoole
if: ${{ env.test_prepared && always() }}
run: composer test-swoole
- name: Test workerman
if: ${{ env.test_prepared && always() }}
run: composer test-workerman
- name: Test workerman-gateway
if: ${{ env.test_prepared && always() }}
run: composer test-workerman-gateway
- name: Test roadrunner
if: ${{ env.test_prepared && always() }}
run: composer test-roadrunner
- name: Test fpm
if: ${{ env.test_prepared && always() }}
run: composer test-fpm
- name: Test jwt
if: ${{ env.test_prepared && always() }}
run: composer test-jwt
- name: Test queue
if: ${{ env.test_prepared && always() }}
run: composer test-queue
- name: Test grpc
if: ${{ env.test_prepared && always() }}
run: composer test-grpc
- name: Test snowflake
if: ${{ env.test_prepared && always() }}
run: composer test-snowflake
- name: Test mqtt
if: ${{ env.test_prepared && always() }}
run: composer test-mqtt
- name: Test smarty
if: ${{ env.test_prepared && always() }}
run: composer test-smarty
- name: Test phar
if: ${{ env.test_prepared && always() }}
run: composer test-phar
- name: Print logs
if: failure()
run: php .github/print-logs.php
ci-windows:
name: Windows PHP-${{ matrix.php.version }} RoadRunner-${{ matrix.roadrunner }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
php:
- version: "7.4"
extensions: "apcu, bcmath, curl, openssl, mbstring, intl, json, redis, mysqli, pdo, pdo_mysql, sockets, :opcache"
- version: "8.0"
extensions: "apcu, bcmath, curl, openssl, mbstring, intl, json, redis, mysqli, pdo, pdo_mysql, sockets, :opcache"
- version: "8.1"
extensions: "apcu, bcmath, curl, openssl, mbstring, intl, json, redis, mysqli, pdo, pdo_mysql, sockets, :opcache"
- version: "8.2"
extensions: "bcmath, curl, openssl, mbstring, intl, json, mysqli, pdo, pdo_mysql, sockets, :opcache"
roadrunner: [2.7.*]
env:
IMI_ROADRUNNER_BINARY: ${{ github.workspace }}\rr.exe
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ROADRUNNER_DOCKER_VERSION: ${{ matrix.roadrunner }}
steps:
- uses: actions/checkout@v4
- name: Setup MySQL
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "8.0"
root-password: root
- name: Setup Redis-server
run: |
nuget install redis-64 -excludeversion
redis-64\tools\redis-server.exe --service-install
redis-64\tools\redis-server.exe --service-start
'@ECHO Redis Started'
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php.version }}
ini-values: session.save_path=C:\temp
tools: pecl
extensions: ${{ matrix.php.extensions }}
env:
fail-fast: true
- name: Install Custom PHP Extension
if: ${{ matrix.php.version >= 8.2 }}
run: |
git clone https://github.com/imiphp/php-extensions-binary.git C:\php-extensions-binary
cp C:\php-extensions-binary\apcu\windows-${{ matrix.php.version }}-x64-nts\php_apcu.dll C:\tools\php\ext\
cp C:\php-extensions-binary\redis\windows-${{ matrix.php.version }}-x64-nts\php_redis.dll C:\tools\php\ext\
echo extension=php_apcu.dll >> C:\tools\php\php.ini
echo extension=php_redis.dll >> C:\tools\php\php.ini
- name: Prepare
run: |
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS db_imi_test;'
composer update --prefer-dist --no-progress
php src\Cli\bin\imi-cli generate/table --app-namespace "Imi\Test\Component"
- name: Install RoadRunner
run: |
echo no | src\Components\roadrunner\vendor\bin\rr get-binary -f $env:ROADRUNNER_DOCKER_VERSION
.\rr -v
- name: Prepared
run: |
echo "test_prepared=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Test
if: ${{ env.test_prepared && always() }}
run: composer test
- name: Test fpm
if: ${{ env.test_prepared && always() }}
run: composer test-fpm
- name: Test workerman
if: ${{ env.test_prepared && always() }}
run: composer test-workerman
- name: Test workerman-gateway
if: ${{ env.test_prepared && always() }}
run: composer test-workerman-gateway-w
- name: Test roadrunner
if: ${{ env.test_prepared && always() }}
run: composer test-roadrunner
- name: Test jwt
if: ${{ env.test_prepared && always() }}
run: composer test-jwt
- name: Test snowflake
if: ${{ env.test_prepared && always() }}
run: composer test-snowflake
- name: Print logs
if: failure()
run: php .github\print-logs.php