Skip to content

Commit e3399eb

Browse files
authored
Merge pull request #3 from forkgroup/2.2-unit
Added v2.1 support for Hyperf
2 parents 2fcb4ce + 466eed2 commit e3399eb

3 files changed

Lines changed: 79 additions & 11 deletions

File tree

.github/workflows/test.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: PHPUnit
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
SWOOLE_VERSION: '4.7.0'
7+
SWOW_VERSION: 'develop'
8+
9+
jobs:
10+
ci:
11+
name: Test PHP ${{ matrix.php-version }} on ${{ matrix.engine }}
12+
runs-on: "${{ matrix.os }}"
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
php-version: ['7.3', '7.4', '8.0']
17+
engine: ['none', 'swoole', 'swow']
18+
max-parallel: 5
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: ${{ matrix.php-version }}
26+
tools: phpize
27+
ini-values: opcache.enable_cli=1
28+
coverage: none
29+
- name: Setup Swoole
30+
if: ${{ matrix.engine == 'swoole' }}
31+
run: |
32+
sudo apt-get install libcurl4-openssl-dev
33+
wget https://github.com/swoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz
34+
mkdir -p swoole
35+
tar -xf swoole.tar.gz -C swoole --strip-components=1
36+
rm swoole.tar.gz
37+
cd swoole
38+
phpize
39+
./configure --enable-openssl --enable-http2 --enable-swoole-curl --enable-swoole-json
40+
make -j$(nproc)
41+
sudo make install
42+
sudo sh -c "echo extension=swoole > /etc/php/${{ matrix.php-version }}/cli/conf.d/swoole.ini"
43+
php --ri swoole
44+
- name: Setup Swow
45+
if: ${{ matrix.engine == 'swow' }}
46+
run: |
47+
wget https://github.com/swow/swow/archive/"${SWOW_VERSION}".tar.gz -O swow.tar.gz
48+
mkdir -p swow
49+
tar -xf swow.tar.gz -C swow --strip-components=1
50+
rm swow.tar.gz
51+
cd swow/ext || exit
52+
53+
phpize
54+
./configure --enable-debug
55+
make -j "$(nproc)"
56+
sudo make install
57+
sudo sh -c "echo extension=swow > /etc/php/${{ matrix.php-version }}/cli/conf.d/swow.ini"
58+
php --ri swow
59+
- name: Setup Packages
60+
run: composer update -o --no-scripts
61+
- name: Run Test Cases
62+
run: |
63+
composer analyse
64+
composer test

.travis/swoole.install.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#!/usr/bin/env bash
2-
wget https://github.com/swoole/swoole-src/archive/v"${SW_VERSION}".tar.gz -O swoole.tar.gz
2+
sudo apt-get update
3+
sudo apt-get install libcurl4-openssl-dev
4+
wget https://github.com/swoole/swoole-src/archive/${SW_VERSION}.tar.gz -O swoole.tar.gz
35
mkdir -p swoole
46
tar -xf swoole.tar.gz -C swoole --strip-components=1
57
rm swoole.tar.gz
6-
cd swoole || exit
8+
cd swoole
79
phpize
8-
./configure --enable-openssl --enable-mysqlnd --enable-http2
9-
make -j "$(nproc)"
10-
make install
10+
./configure --enable-openssl --enable-http2 --enable-swoole-curl --enable-swoole-json
11+
make -j$(nproc)
12+
sudo make install
13+
sudo sh -c "echo extension=swoole > /etc/php/${PHP_VERSION}/cli/conf.d/swoole.ini"
14+
sudo sh -c "echo swoole.use_shortname='Off' >> /etc/php/${PHP_VERSION}/cli/conf.d/swoole.ini"
15+
php --ri swoole

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,21 @@
3030
},
3131
"require": {
3232
"php": ">=7.3",
33-
"ext-swoole": ">=4.5",
34-
"hyperf/config": "~2.2.0",
35-
"hyperf/di": "~2.2.0",
36-
"hyperf/framework": "~2.2.0"
33+
"hyperf/config": "^2.1",
34+
"hyperf/di": "^2.1",
35+
"hyperf/framework": "^2.1"
3736
},
3837
"require-dev": {
3938
"friendsofphp/php-cs-fixer": "^3.0",
40-
"hyperf/testing": "~2.2.0",
39+
"hyperf/testing": "^2.1",
4140
"phpstan/phpstan": "^0.12",
4241
"swoole/ide-helper": "dev-master"
4342
},
4443
"config": {
4544
"sort-packages": true
4645
},
4746
"scripts": {
48-
"test": "co-phpunit --prepend tests/bootstrap.php -c phpunit.xml --colors=always",
47+
"test": "phpunit --prepend tests/bootstrap.php -c phpunit.xml --colors=always",
4948
"analyse": "phpstan analyse --memory-limit 1024M -l 0 ./src",
5049
"cs-fix": "php-cs-fixer fix $1"
5150
},

0 commit comments

Comments
 (0)