Skip to content

Commit 5cc7ef3

Browse files
authored
Upgrade swoole version to v6 (#108)
1 parent 961ba56 commit 5cc7ef3

File tree

3 files changed

+47
-85
lines changed

3 files changed

+47
-85
lines changed

.github/workflows/phpstan.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ concurrency:
1111
jobs:
1212
tests:
1313
name: PHP${{ matrix.php-version }} Static Code Analysis on Linux
14-
runs-on: "${{ matrix.os }}"
14+
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
os: [ ubuntu-latest ]
18-
php-version: [ '8.0', '8.1', '8.2', '8.3' ]
17+
php-version: [ '8.0', '8.1', '8.2', '8.3', '8.4' ]
1918
max-parallel: 5
2019
fail-fast: false
2120
steps:

.github/workflows/test.yml

Lines changed: 44 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ name: PHPUnit for MQTT
22

33
on:
44
push:
5+
branches:
6+
- master
7+
- ci
58
pull_request:
9+
branches:
10+
- master
611
schedule:
712
- cron: '11 2 * * 1'
813

@@ -11,77 +16,26 @@ concurrency:
1116
cancel-in-progress: true
1217

1318
jobs:
14-
linux:
15-
name: PHP${{ matrix.php-version }} Swoole-${{ matrix.swoole-version }} Test on Linux
16-
runs-on: "${{ matrix.os }}"
19+
test:
20+
name: PHP${{ matrix.php-version }} Swoole-${{ matrix.swoole-version }} Test on ${{ matrix.os }}
21+
runs-on: ${{ matrix.os }}
1722
strategy:
1823
matrix:
19-
os: [ ubuntu-latest ]
20-
php-version: [ '8.0', '8.1', '8.2', '8.3' ]
21-
swoole-version: [ 'v4.8.13', 'v5.1.5', 'master' ]
24+
os: [ubuntu-latest, macos-latest]
25+
php-version: [ '8.0', '8.1', '8.2', '8.3', '8.4' ]
26+
swoole-version: [ 'v4.8.13', 'v5.1.6', 'v6.0.0', 'master' ]
2227
exclude:
23-
- php-version: '8.3'
28+
- php-version: '8.4'
29+
swoole-version: 'v5.1.6'
30+
- php-version: '8.4'
2431
swoole-version: 'v4.8.13'
25-
- php-version: '8.0'
26-
swoole-version: 'master'
27-
max-parallel: 15
28-
fail-fast: false
29-
env:
30-
SWOOLE_VERSION: ${{ matrix.swoole-version }}
31-
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
35-
- name: Setup PHP
36-
uses: shivammathur/setup-php@v2
37-
with:
38-
php-version: ${{ matrix.php-version }}
39-
tools: phpize
40-
ini-values: extension=swoole
41-
coverage: none
42-
43-
- name: Build Swoole
44-
run: |
45-
wget https://github.com/swoole/swoole-src/archive/${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz
46-
mkdir -p swoole
47-
tar -xf swoole.tar.gz -C swoole --strip-components=1
48-
rm swoole.tar.gz
49-
cd swoole
50-
phpize
51-
./configure --enable-openssl --enable-mysqlnd --enable-http2
52-
make -j$(nproc)
53-
sudo make install
54-
php --ri swoole
55-
56-
- name: Setup Dependencies
57-
env:
58-
COMPOSER_ROOT_VERSION: 1.x-dev
59-
run:
60-
composer install -o
61-
62-
- name: Coding Standards Check
63-
if: matrix.php-version == '8.1'
64-
run: |
65-
composer cs-check
66-
67-
- name: Run Test Cases
68-
run: |
69-
composer test
70-
71-
macos:
72-
name: PHP${{ matrix.php-version }} Swoole-${{ matrix.swoole-version }} Test on macOS
73-
runs-on: "${{ matrix.os }}"
74-
strategy:
75-
matrix:
76-
os: [ macos-latest ]
77-
php-version: [ '8.0', '8.1', '8.2', '8.3' ]
78-
swoole-version: [ 'v4.8.13', 'v5.1.5', 'master' ]
79-
exclude:
8032
- php-version: '8.3'
8133
swoole-version: 'v4.8.13'
34+
- php-version: '8.0'
35+
swoole-version: 'v6.0.0'
8236
- php-version: '8.0'
8337
swoole-version: 'master'
84-
max-parallel: 15
38+
max-parallel: 10
8539
fail-fast: false
8640
env:
8741
SWOOLE_VERSION: ${{ matrix.swoole-version }}
@@ -99,29 +53,39 @@ jobs:
9953

10054
- name: Build Swoole
10155
run: |
102-
export CPPFLAGS="$CPPFLAGS -I$(brew --prefix pcre2)/include -L$(brew --prefix pcre2)/lib"
103-
wget https://github.com/swoole/swoole-src/archive/${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz
104-
mkdir -p swoole
105-
tar -xf swoole.tar.gz -C swoole --strip-components=1
106-
rm swoole.tar.gz
107-
cd swoole
108-
phpize
109-
./configure --enable-openssl --with-openssl-dir=$(brew --prefix openssl) --enable-mysqlnd --enable-http2
110-
make -j$(sysctl -n hw.logicalcpu)
111-
sudo make install
112-
php --ri swoole
56+
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
57+
wget https://github.com/swoole/swoole-src/archive/${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz
58+
mkdir -p swoole
59+
tar -xf swoole.tar.gz -C swoole --strip-components=1
60+
rm swoole.tar.gz
61+
cd swoole
62+
phpize
63+
./configure --enable-openssl --enable-http2
64+
make -j$(nproc)
65+
sudo make install
66+
php --ri swoole
67+
else
68+
export CPPFLAGS="$CPPFLAGS -I$(brew --prefix pcre2)/include -L$(brew --prefix pcre2)/lib"
69+
wget https://github.com/swoole/swoole-src/archive/${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz
70+
mkdir -p swoole
71+
tar -xf swoole.tar.gz -C swoole --strip-components=1
72+
rm swoole.tar.gz
73+
cd swoole
74+
phpize
75+
./configure --enable-openssl --with-openssl-dir=$(brew --prefix openssl) --enable-http2
76+
make -j$(sysctl -n hw.logicalcpu)
77+
sudo make install
78+
php --ri swoole
79+
fi
11380
11481
- name: Setup Dependencies
11582
env:
11683
COMPOSER_ROOT_VERSION: 1.x-dev
117-
run:
118-
composer install -o
84+
run: composer install -o
11985

12086
- name: Coding Standards Check
12187
if: matrix.php-version == '8.1'
122-
run: |
123-
composer cs-check
88+
run: composer cs-check
12489

12590
- name: Run Test Cases
126-
run: |
127-
composer test
91+
run: composer test

src/Packet/UnPackV5.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public static function connect(string $remaining): array
6262
'user_name' => $userName,
6363
'password' => $password,
6464
'keep_alive' => $keepAlive,
65+
'client_id' => $clientId,
6566
];
6667

6768
if ($propertiesTotalLength) {
@@ -70,8 +71,6 @@ public static function connect(string $remaining): array
7071
unset($package['properties']);
7172
}
7273

73-
$package['client_id'] = $clientId;
74-
7574
if ($willFlag) {
7675
if ($willPropertiesTotalLength) {
7776
$package['will']['properties'] = $willProperties;

0 commit comments

Comments
 (0)