Skip to content

Merge pull request #27 from true-async/25-fix-the-degradation-of-phps… #1

Merge pull request #27 from true-async/25-fix-the-degradation-of-phps…

Merge pull request #27 from true-async/25-fix-the-degradation-of-phps… #1

name: Cross-Platform Build
on:
push:
branches: [build]
pull_request:
branches: [build]
jobs:
# Ubuntu build with database services (matches build.yml)
ubuntu-database-build:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.3
env:
MYSQL_ROOT_PASSWORD: ''
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test
ports: ['3306:3306']
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=5
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
ports: ['5432:5432']
options: >-
--health-cmd="pg_isready"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout php-async repo
uses: actions/checkout@v4
with:
path: async
- name: Clone php-src (true-async-stable)
run: |
git clone --depth=1 --branch=true-async-stable https://github.com/true-async/php-src php-src
- name: Copy php-async extension into php-src
run: |
mkdir -p php-src/ext/async
cp -r async/* php-src/ext/async/
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
gcc g++ autoconf bison re2c \
libgmp-dev libicu-dev libtidy-dev libsasl2-dev \
libzip-dev libbz2-dev libsqlite3-dev libonig-dev libcurl4-openssl-dev \
libxml2-dev libxslt1-dev libpq-dev libreadline-dev libldap2-dev libsodium-dev \
libargon2-dev \
firebird-dev \
valgrind cmake
- name: Install LibUV >= 1.44.0
run: |
# Check if system libuv meets requirements
if pkg-config --exists libuv && pkg-config --atleast-version=1.44.0 libuv; then
echo "System libuv version: $(pkg-config --modversion libuv)"
sudo apt-get install -y libuv1-dev
else
echo "Installing LibUV 1.44.0 from source"
wget https://github.com/libuv/libuv/archive/v1.44.0.tar.gz
tar -xzf v1.44.0.tar.gz
cd libuv-1.44.0
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo make install
sudo ldconfig
cd ../..
fi
- name: Configure PHP
working-directory: php-src
run: |
./buildconf -f
./configure \
--enable-zts \
--enable-fpm \
--enable-opcache \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pgsql \
--with-pdo-pgsql \
--with-pdo-sqlite \
--enable-intl \
--without-pear \
--with-zip \
--with-zlib \
--enable-soap \
--enable-xmlreader \
--with-xsl \
--with-tidy \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
--enable-pcntl \
--with-readline \
--enable-mbstring \
--with-curl \
--with-gettext \
--enable-sockets \
--with-bz2 \
--with-openssl \
--with-gmp \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-sysvmsg \
--with-ffi \
--enable-zend-test \
--enable-dl-test=shared \
--with-ldap \
--with-ldap-sasl \
--with-password-argon2 \
--with-mhash \
--with-sodium \
--enable-dba \
--with-cdb \
--enable-flatfile \
--enable-inifile \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--with-pdo-firebird \
--enable-address-sanitizer \
--enable-async
- name: Build PHP
working-directory: php-src
run: |
make -j"$(nproc)"
sudo make install
sudo mkdir -p /etc/php.d
sudo chmod 777 /etc/php.d
{
echo "opcache.enable_cli=1"
echo "opcache.protect_memory=1"
} > /etc/php.d/opcache.ini
- name: Run tests
working-directory: php-src/ext/async
run: |
/usr/local/bin/php -v
/usr/local/bin/php ../../run-tests.php \
-d zend_extension=opcache.so \
-d opcache.enable_cli=1 \
-d opcache.jit_buffer_size=64M \
-d opcache.jit=tracing \
-d zend_test.observer.enabled=1 \
-d zend_test.observer.show_output=0 \
-P -q -x -j4 \
-g FAIL,BORK,LEAK,XLEAK \
--no-progress \
--offline \
--show-diff \
--show-slow 4000 \
--set-timeout 120 \
--repeat 2
# Cross-platform build without database services
cross-platform-build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
include:
- os: windows-latest
platform: windows
- os: macos-latest
platform: macos
runs-on: ${{ matrix.os }}
steps:
- name: Checkout php-async repo
uses: actions/checkout@v4
with:
path: async
- name: Clone php-src (true-async-stable)
run: |
git clone --depth=1 --branch=true-async-stable https://github.com/true-async/php-src php-src
- name: Copy php-async extension into php-src
run: |
mkdir -p php-src/ext/async
cp -r async/* php-src/ext/async/
# ==================== WINDOWS DEPENDENCIES ====================
- name: Install build dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
# Install php-sdk
git clone https://github.com/Microsoft/php-sdk-binary-tools.git C:\php-sdk
# Install vcpkg and LibUV >= 1.44.0
git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
C:\vcpkg\bootstrap-vcpkg.bat
C:\vcpkg\vcpkg.exe install libuv:x64-windows
# Verify LibUV version
C:\vcpkg\vcpkg.exe list libuv
# Create deps structure for php-sdk
mkdir C:\php-sdk\deps\include\libuv
mkdir C:\php-sdk\deps\lib
# Copy LibUV files
xcopy /E /I C:\vcpkg\installed\x64-windows\include C:\php-sdk\deps\include\libuv\
copy C:\vcpkg\installed\x64-windows\lib\uv.lib C:\php-sdk\deps\lib\libuv.lib
shell: cmd
# ==================== MACOS DEPENDENCIES ====================
- name: Install build dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
# Core build tools
brew install autoconf automake libtool pkg-config bison
# LibUV >= 1.44.0 - main dependency
brew install libuv
# Verify LibUV version
pkg-config --modversion libuv || true
libuv_version=$(pkg-config --modversion libuv 2>/dev/null || echo "unknown")
echo "Installed LibUV version: $libuv_version"
# Fixed package names
brew install tidy-html5 icu4c openssl@3
# Additional dependencies
brew install gmp libzip bzip2 sqlite oniguruma curl
brew install libxml2 libxslt readline libsodium argon2
# Setup environment variables for keg-only packages
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
echo "PATH=$(brew --prefix bison)/bin:$PATH" >> $GITHUB_ENV
# ==================== WINDOWS CONFIGURE & BUILD ====================
- name: Configure and Build PHP (Windows)
if: matrix.os == 'windows-latest'
working-directory: php-src
run: |
# Use php-sdk for environment setup and build
call C:\php-sdk\bin\phpsdk_buildtree.bat phpdev
call C:\php-sdk\bin\phpsdk_setvars.bat
buildconf.bat
configure.bat --enable-async
nmake
shell: cmd
# ==================== MACOS CONFIGURE & BUILD ====================
- name: Configure PHP (macOS)
if: matrix.os == 'macos-latest'
working-directory: php-src
run: |
./buildconf -f
./configure \
--enable-zts \
--enable-fpm \
--enable-opcache \
--with-pdo-sqlite \
--enable-intl \
--without-pear \
--with-zip \
--with-zlib \
--enable-soap \
--enable-xmlreader \
--with-xsl \
--with-tidy=$(brew --prefix tidy-html5) \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
--enable-pcntl \
--with-readline \
--enable-mbstring \
--with-curl \
--with-gettext \
--enable-sockets \
--with-bz2 \
--with-openssl=$(brew --prefix openssl@3) \
--with-gmp \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-sysvmsg \
--with-ffi \
--enable-zend-test \
--enable-dl-test=shared \
--with-password-argon2 \
--with-mhash \
--with-sodium \
--enable-dba \
--with-cdb \
--enable-flatfile \
--enable-inifile \
--with-config-file-path=/usr/local/etc \
--with-config-file-scan-dir=/usr/local/etc/php.d \
--enable-address-sanitizer \
--enable-async
- name: Build PHP (macOS)
if: matrix.os == 'macos-latest'
working-directory: php-src
run: |
make -j"$(sysctl -n hw.ncpu)"
sudo make install
sudo mkdir -p /usr/local/etc/php.d
sudo chmod 777 /usr/local/etc/php.d
{
echo "opcache.enable_cli=1"
echo "opcache.protect_memory=1"
} > /usr/local/etc/php.d/opcache.ini
# ==================== TESTING FOR ALL PLATFORMS ====================
- name: Run tests (Windows)
if: matrix.os == 'windows-latest'
working-directory: php-src/ext/async
run: |
php.exe -v
php.exe ../../run-tests.php ^
-d zend_extension=opcache.dll ^
-d opcache.enable_cli=1 ^
-d opcache.jit_buffer_size=64M ^
-d opcache.jit=tracing ^
-d zend_test.observer.enabled=1 ^
-d zend_test.observer.show_output=0 ^
-P -q -x -j4 ^
-g FAIL,BORK,LEAK,XLEAK ^
--no-progress ^
--offline ^
--show-diff ^
--show-slow 4000 ^
--set-timeout 120 ^
--repeat 2
shell: cmd
- name: Run tests (macOS)
if: matrix.os == 'macos-latest'
working-directory: php-src/ext/async
run: |
/usr/local/bin/php -v
/usr/local/bin/php ../../run-tests.php \
-d zend_extension=opcache.so \
-d opcache.enable_cli=1 \
-d opcache.jit_buffer_size=64M \
-d opcache.jit=tracing \
-d zend_test.observer.enabled=1 \
-d zend_test.observer.show_output=0 \
-P -q -x -j4 \
-g FAIL,BORK,LEAK,XLEAK \
--no-progress \
--offline \
--show-diff \
--show-slow 4000 \
--set-timeout 120 \
--repeat 2