Skip to content

Commit a6ca563

Browse files
authored
Merge pull request #24 from true-async/9-coroutine-edge-case-tests
9 coroutine edge case tests
2 parents 781c826 + a0958c1 commit a6ca563

File tree

144 files changed

+7207
-301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+7207
-301
lines changed

.github/workflows/build-cross-platform.yml

Lines changed: 171 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,35 @@ on:
77
branches: [build]
88

99
jobs:
10-
build:
11-
strategy:
12-
fail-fast: false
13-
matrix:
14-
os: [ubuntu-latest, windows-latest, macos-latest]
15-
include:
16-
- os: ubuntu-latest
17-
platform: linux
18-
- os: windows-latest
19-
platform: windows
20-
- os: macos-latest
21-
platform: macos
22-
23-
runs-on: ${{ matrix.os }}
10+
# Ubuntu build with database services (matches build.yml)
11+
ubuntu-database-build:
12+
runs-on: ubuntu-latest
2413

14+
services:
15+
mysql:
16+
image: mysql:8.3
17+
env:
18+
MYSQL_ROOT_PASSWORD: ''
19+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
20+
MYSQL_DATABASE: test
21+
ports: ['3306:3306']
22+
options: >-
23+
--health-cmd="mysqladmin ping --silent"
24+
--health-interval=10s
25+
--health-timeout=5s
26+
--health-retries=5
27+
28+
postgres:
29+
image: postgres:16
30+
env:
31+
POSTGRES_PASSWORD: postgres
32+
POSTGRES_DB: test
33+
ports: ['5432:5432']
34+
options: >-
35+
--health-cmd="pg_isready"
36+
--health-interval=10s
37+
--health-timeout=5s
38+
--health-retries=5
2539
2640
steps:
2741
- name: Checkout php-async repo
@@ -38,83 +52,52 @@ jobs:
3852
mkdir -p php-src/ext/async
3953
cp -r async/* php-src/ext/async/
4054
41-
# ==================== UBUNTU DEPENDENCIES ====================
42-
- name: Install build dependencies (Ubuntu)
43-
if: matrix.os == 'ubuntu-latest'
55+
- name: Install build dependencies
4456
run: |
4557
sudo apt-get update
4658
sudo apt-get install -y \
4759
gcc g++ autoconf bison re2c \
48-
libgmp-dev libicu-dev libtidy-dev libenchant-2-dev \
49-
libzip-dev libbz2-dev libsqlite3-dev libwebp-dev libonig-dev libcurl4-openssl-dev \
50-
libxml2-dev libxslt1-dev libreadline-dev libsodium-dev \
51-
libargon2-dev libjpeg-dev libpng-dev libfreetype6-dev libuv1-dev
52-
g++ --version
53-
sudo mkdir -p /var/lib/snmp && sudo chown $(id -u):$(id -g) /var/lib/snmp
54-
55-
# ==================== WINDOWS DEPENDENCIES ====================
56-
- name: Install build dependencies (Windows)
57-
if: matrix.os == 'windows-latest'
58-
run: |
59-
# Install php-sdk
60-
git clone https://github.com/Microsoft/php-sdk-binary-tools.git C:\php-sdk
61-
62-
# Install vcpkg and LibUV
63-
git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
64-
C:\vcpkg\bootstrap-vcpkg.bat
65-
C:\vcpkg\vcpkg.exe install libuv:x64-windows
66-
67-
# Create deps structure for php-sdk
68-
mkdir C:\php-sdk\deps\include\libuv
69-
mkdir C:\php-sdk\deps\lib
70-
71-
# Copy LibUV files
72-
xcopy /E /I C:\vcpkg\installed\x64-windows\include C:\php-sdk\deps\include\libuv\
73-
copy C:\vcpkg\installed\x64-windows\lib\uv.lib C:\php-sdk\deps\lib\libuv.lib
74-
shell: cmd
60+
libgmp-dev libicu-dev libtidy-dev libsasl2-dev \
61+
libzip-dev libbz2-dev libsqlite3-dev libonig-dev libcurl4-openssl-dev \
62+
libxml2-dev libxslt1-dev libpq-dev libreadline-dev libldap2-dev libsodium-dev \
63+
libargon2-dev \
64+
firebird-dev \
65+
valgrind cmake
7566
76-
# ==================== MACOS DEPENDENCIES ====================
77-
- name: Install build dependencies (macOS)
78-
if: matrix.os == 'macos-latest'
67+
- name: Install LibUV >= 1.44.0
7968
run: |
80-
# Core build tools
81-
brew install autoconf automake libtool pkg-config bison
82-
83-
# LibUV - main dependency
84-
brew install libuv
85-
86-
# Fixed package names
87-
brew install tidy-html5 icu4c openssl@3
88-
89-
# Additional dependencies
90-
brew install gmp libzip bzip2 sqlite oniguruma curl
91-
brew install libxml2 libxslt readline libsodium argon2
92-
93-
# Setup environment variables for keg-only packages
94-
echo "PKG_CONFIG_PATH=$(brew --prefix openssl@3)/lib/pkgconfig:$(brew --prefix icu4c)/lib/pkgconfig:$(brew --prefix libxml2)/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
95-
echo "PATH=$(brew --prefix bison)/bin:$PATH" >> $GITHUB_ENV
69+
# Check if system libuv meets requirements
70+
if pkg-config --exists libuv && pkg-config --atleast-version=1.44.0 libuv; then
71+
echo "System libuv version: $(pkg-config --modversion libuv)"
72+
sudo apt-get install -y libuv1-dev
73+
else
74+
echo "Installing LibUV 1.44.0 from source"
75+
wget https://github.com/libuv/libuv/archive/v1.44.0.tar.gz
76+
tar -xzf v1.44.0.tar.gz
77+
cd libuv-1.44.0
78+
mkdir build && cd build
79+
cmake .. -DCMAKE_BUILD_TYPE=Release
80+
make -j$(nproc)
81+
sudo make install
82+
sudo ldconfig
83+
cd ../..
84+
fi
9685
97-
# ==================== UBUNTU CONFIGURE & BUILD ====================
98-
- name: Configure PHP (Ubuntu)
99-
if: matrix.os == 'ubuntu-latest'
86+
- name: Configure PHP
10087
working-directory: php-src
10188
run: |
10289
./buildconf -f
10390
./configure \
10491
--enable-zts \
105-
--enable-option-checking=fatal \
106-
--prefix=/usr \
107-
--disable-phpdbg \
10892
--enable-fpm \
10993
--enable-opcache \
94+
--with-pdo-mysql=mysqlnd \
95+
--with-mysqli=mysqlnd \
96+
--with-pgsql \
97+
--with-pdo-pgsql \
11098
--with-pdo-sqlite \
11199
--enable-intl \
112100
--without-pear \
113-
--enable-gd \
114-
--with-jpeg \
115-
--with-webp \
116-
--with-freetype \
117-
--enable-exif \
118101
--with-zip \
119102
--with-zlib \
120103
--enable-soap \
@@ -136,11 +119,12 @@ jobs:
136119
--enable-bcmath \
137120
--enable-calendar \
138121
--enable-ftp \
139-
--with-enchant=/usr \
140122
--enable-sysvmsg \
141123
--with-ffi \
142124
--enable-zend-test \
143125
--enable-dl-test=shared \
126+
--with-ldap \
127+
--with-ldap-sasl \
144128
--with-password-argon2 \
145129
--with-mhash \
146130
--with-sodium \
@@ -150,10 +134,10 @@ jobs:
150134
--enable-inifile \
151135
--with-config-file-path=/etc \
152136
--with-config-file-scan-dir=/etc/php.d \
137+
--with-pdo-firebird \
153138
--enable-async
154139
155-
- name: Build PHP (Ubuntu)
156-
if: matrix.os == 'ubuntu-latest'
140+
- name: Build PHP
157141
working-directory: php-src
158142
run: |
159143
make -j"$(nproc)"
@@ -165,6 +149,106 @@ jobs:
165149
echo "opcache.protect_memory=1"
166150
} > /etc/php.d/opcache.ini
167151
152+
- name: Run tests
153+
working-directory: php-src/ext/async
154+
run: |
155+
/usr/local/bin/php -v
156+
/usr/local/bin/php ../../run-tests.php \
157+
-d zend_extension=opcache.so \
158+
-d opcache.enable_cli=1 \
159+
-d opcache.jit_buffer_size=64M \
160+
-d opcache.jit=tracing \
161+
-d zend_test.observer.enabled=1 \
162+
-d zend_test.observer.show_output=0 \
163+
-P -q -x -j4 \
164+
-g FAIL,BORK,LEAK,XLEAK \
165+
--no-progress \
166+
--offline \
167+
--show-diff \
168+
--show-slow 2000 \
169+
--set-timeout 120 \
170+
--repeat 2
171+
172+
# Cross-platform build without database services
173+
cross-platform-build:
174+
strategy:
175+
fail-fast: false
176+
matrix:
177+
os: [windows-latest, macos-latest]
178+
include:
179+
- os: windows-latest
180+
platform: windows
181+
- os: macos-latest
182+
platform: macos
183+
184+
runs-on: ${{ matrix.os }}
185+
186+
187+
steps:
188+
- name: Checkout php-async repo
189+
uses: actions/checkout@v4
190+
with:
191+
path: async
192+
193+
- name: Clone php-src (true-async-stable)
194+
run: |
195+
git clone --depth=1 --branch=true-async-stable https://github.com/true-async/php-src php-src
196+
197+
- name: Copy php-async extension into php-src
198+
run: |
199+
mkdir -p php-src/ext/async
200+
cp -r async/* php-src/ext/async/
201+
202+
# ==================== WINDOWS DEPENDENCIES ====================
203+
- name: Install build dependencies (Windows)
204+
if: matrix.os == 'windows-latest'
205+
run: |
206+
# Install php-sdk
207+
git clone https://github.com/Microsoft/php-sdk-binary-tools.git C:\php-sdk
208+
209+
# Install vcpkg and LibUV >= 1.44.0
210+
git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
211+
C:\vcpkg\bootstrap-vcpkg.bat
212+
C:\vcpkg\vcpkg.exe install libuv:x64-windows
213+
214+
# Verify LibUV version
215+
C:\vcpkg\vcpkg.exe list libuv
216+
217+
# Create deps structure for php-sdk
218+
mkdir C:\php-sdk\deps\include\libuv
219+
mkdir C:\php-sdk\deps\lib
220+
221+
# Copy LibUV files
222+
xcopy /E /I C:\vcpkg\installed\x64-windows\include C:\php-sdk\deps\include\libuv\
223+
copy C:\vcpkg\installed\x64-windows\lib\uv.lib C:\php-sdk\deps\lib\libuv.lib
224+
shell: cmd
225+
226+
# ==================== MACOS DEPENDENCIES ====================
227+
- name: Install build dependencies (macOS)
228+
if: matrix.os == 'macos-latest'
229+
run: |
230+
# Core build tools
231+
brew install autoconf automake libtool pkg-config bison
232+
233+
# LibUV >= 1.44.0 - main dependency
234+
brew install libuv
235+
236+
# Verify LibUV version
237+
pkg-config --modversion libuv || true
238+
libuv_version=$(pkg-config --modversion libuv 2>/dev/null || echo "unknown")
239+
echo "Installed LibUV version: $libuv_version"
240+
241+
# Fixed package names
242+
brew install tidy-html5 icu4c openssl@3
243+
244+
# Additional dependencies
245+
brew install gmp libzip bzip2 sqlite oniguruma curl
246+
brew install libxml2 libxslt readline libsodium argon2
247+
248+
# Setup environment variables for keg-only packages
249+
echo "PKG_CONFIG_PATH=$(brew --prefix openssl@3)/lib/pkgconfig:$(brew --prefix icu4c)/lib/pkgconfig:$(brew --prefix libxml2)/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
250+
echo "PATH=$(brew --prefix bison)/bin:$PATH" >> $GITHUB_ENV
251+
168252
# ==================== WINDOWS CONFIGURE & BUILD ====================
169253
- name: Configure and Build PHP (Windows)
170254
if: matrix.os == 'windows-latest'
@@ -241,70 +325,45 @@ jobs:
241325
} > /usr/local/etc/php.d/opcache.ini
242326
243327
# ==================== TESTING FOR ALL PLATFORMS ====================
244-
- name: Run tests (Ubuntu)
245-
if: matrix.os == 'ubuntu-latest'
246-
working-directory: php-src
247-
env:
248-
MIBS: +ALL
249-
run: |
250-
sapi/cli/php run-tests.php \
251-
-d zend_extension=opcache.so \
252-
-d opcache.enable_cli=1 \
253-
-d opcache.jit_buffer_size=64M \
254-
-d opcache.jit=tracing \
255-
-d zend_test.observer.enabled=1 \
256-
-d zend_test.observer.show_output=0 \
257-
-P -q -x -j2 \
258-
-g FAIL,BORK,LEAK,XLEAK \
259-
--no-progress \
260-
--offline \
261-
--show-diff \
262-
--show-slow 1000 \
263-
--set-timeout 120 \
264-
--repeat 2 \
265-
ext/async
266-
267328
- name: Run tests (Windows)
268329
if: matrix.os == 'windows-latest'
269-
working-directory: php-src
330+
working-directory: php-src/ext/async
270331
run: |
271332
php.exe -v
272-
php.exe run-tests.php ^
333+
php.exe ../../run-tests.php ^
273334
-d zend_extension=opcache.dll ^
274335
-d opcache.enable_cli=1 ^
275336
-d opcache.jit_buffer_size=64M ^
276337
-d opcache.jit=tracing ^
277338
-d zend_test.observer.enabled=1 ^
278339
-d zend_test.observer.show_output=0 ^
279-
-P -q -x -j2 ^
340+
-P -q -x -j4 ^
280341
-g FAIL,BORK,LEAK,XLEAK ^
281342
--no-progress ^
282343
--offline ^
283344
--show-diff ^
284-
--show-slow 1000 ^
345+
--show-slow 2000 ^
285346
--set-timeout 120 ^
286-
--repeat 2 ^
287-
ext/async
347+
--repeat 2
288348
shell: cmd
289349

290350
- name: Run tests (macOS)
291351
if: matrix.os == 'macos-latest'
292-
working-directory: php-src
352+
working-directory: php-src/ext/async
293353
run: |
294354
/usr/local/bin/php -v
295-
/usr/local/bin/php run-tests.php \
355+
/usr/local/bin/php ../../run-tests.php \
296356
-d zend_extension=opcache.so \
297357
-d opcache.enable_cli=1 \
298358
-d opcache.jit_buffer_size=64M \
299359
-d opcache.jit=tracing \
300360
-d zend_test.observer.enabled=1 \
301361
-d zend_test.observer.show_output=0 \
302-
-P -q -x -j2 \
362+
-P -q -x -j4 \
303363
-g FAIL,BORK,LEAK,XLEAK \
304364
--no-progress \
305365
--offline \
306366
--show-diff \
307-
--show-slow 1000 \
367+
--show-slow 2000 \
308368
--set-timeout 120 \
309-
--repeat 2 \
310-
ext/async
369+
--repeat 2

0 commit comments

Comments
 (0)