-
Notifications
You must be signed in to change notification settings - Fork 0
205 lines (184 loc) · 6.1 KB
/
test.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
name: PHPUnit for Hyperf
on: [ push, pull_request ]
env:
SW_VERSION: 'develop'
jobs:
unix-tests:
name: Test on ${{ matrix.os }} with PHP ${{ matrix.php-version }}
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest' ]
php-version: ['8.1','8.2' ]
max-parallel: 4
fail-fast: false
env:
setupphp_exts: igbinary, msgpack, redis
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.setupphp_exts }}
key: ${{ runner.os }}-setupphpext-v1-
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: phpize, php-config
extensions: ${{ env.setupphp_exts }}
ini-values: extension=swow, opcache.enable_cli=0
coverage: none
- name: Setup Valgrind
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y valgrind
- name: Fetch Swow revison
id: swow-getref
shell: php {0}
run: |
<?php
$context = stream_context_create([
'http'=>[
'header'=>
"User-Agent: not-curl/0.1\r\n".
"Accept: application/vnd.github.v3+json\r\n".
"Authorization: Bearer ${{ github.token }}\r\n"
]]);
$uri = 'https://api.github.com/repos/swow/swow/git/ref/heads/${{ env.SW_VERSION }}';
$ref = json_decode(file_get_contents($uri, false, $context))->object->sha;
echo "::set-output name=swowref::" . $ref . PHP_EOL;
- name: Cache Swow
uses: actions/cache@v2
id: swow-cache
with:
path: swow
key: ${{ runner.os }}-swowext-${{ matrix.php-version }}-${{ steps.swow-getref.outputs.swowref }}
- name: Checkout Swow
if: steps.swow-cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: swow/swow
ref: ${{ steps.swow-getref.outputs.swowref }}
path: swow
- name: Setup Swow
run: |
if [ x${{ steps.swow-cache.outputs.cache-hit }} != 'xtrue' ]
then
echo "::group::Build swow"
cd swow/ext
phpize
./configure --enable-swow-debug
make -j `${{ runner.os == 'Linux' && 'nproc' || 'sysctl -n hw.logicalcpu' }}`
echo "::endgroup::"
else
cd swow/ext || exit 1
fi
echo "::group::Install swow"
sudo make install || exit 1
echo "::endgroup::"
- name: Setup Packages
run: composer update -o
- name: Run Test Cases
run: |
composer analyse
composer test
win-tests:
name: Test on ${{ matrix.os }} with PHP ${{ matrix.php-version }}
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os: [ 'windows-2019' ]
php-version: [ '8.1', '8.2' ]
max-parallel: 2
fail-fast: false
env:
setupphp_exts: igbinary, msgpack, redis
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.setupphp_exts }}
key: ${{ runner.os }}-setupphpext-v1-
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.setupphp_exts }},pdo_mysql
coverage: none
- name: Fetch Swow revison
id: swow-getref
shell: php {0}
run: |
<?php
$context = stream_context_create([
'http'=>[
'header'=>
"User-Agent: not-curl/0.1\r\n".
"Accept: application/vnd.github.v3+json\r\n".
"Authorization: Bearer ${{ github.token }}\r\n"
]]);
$uri = 'https://api.github.com/repos/swow/swow/git/ref/heads/${{ env.SW_VERSION }}';
$ref = json_decode(file_get_contents($uri, false, $context))->object->sha;
echo "::set-output name=swowref::" . $ref . PHP_EOL;
- name: Cache Swow
uses: actions/cache@v2
id: swow-cache
with:
path: swow
key: ${{ runner.os }}-swowext-${{ matrix.php-version }}-${{ steps.swow-getref.outputs.swowref }}
- name: Checkout Swow
if: steps.swow-cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: swow/swow
ref: ${{ steps.swow-getref.outputs.swowref }}
path: swow
- name: Build Swow
if: steps.swow-cache.outputs.cache-hit != 'true'
uses: ./swow/.github/workflows/winext
with:
ext-path: ./swow/ext
tools-path: C:\tools\phpdev
conf-args: --enable-swow-debug --enable-swow-ssl --enable-swow-curl
ext-name: swow
deps: openssl,libcurl,libssh2,zlib,nghttp2
install: 0
- name: Install Swow
shell: powershell
env:
BUILD_DIR: 'x64\Release'
UNIX_COLOR: '1'
run: |
Write-Host "::group::Installing Swow"
.\swow\.github\workflows\winext\install.ps1 `
-ExtPath swow\ext `
-ExtName swow `
-Enable 1
if ($lastexitcode -Ne 0) {
exit 1
}
- name: Setup Packages
run: composer update -o
- name: Run Test Cases
run: |
composer analyse
composer test