1+ name : Cross-Platform Build
2+
3+ on :
4+ push :
5+ branches : [build]
6+ pull_request :
7+ branches : [build]
8+
9+ 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 }}
24+
25+
26+ steps :
27+ - name : Checkout php-async repo
28+ uses : actions/checkout@v4
29+ with :
30+ path : async
31+
32+ - name : Clone php-src (true-async-stable)
33+ run : |
34+ git clone --depth=1 --branch=true-async-stable https://github.com/true-async/php-src php-src
35+
36+ - name : Copy php-async extension into php-src
37+ run : |
38+ mkdir -p php-src/ext/async
39+ cp -r async/* php-src/ext/async/
40+
41+ # ==================== UBUNTU DEPENDENCIES ====================
42+ - name : Install build dependencies (Ubuntu)
43+ if : matrix.os == 'ubuntu-latest'
44+ run : |
45+ sudo apt-get update
46+ sudo apt-get install -y \
47+ 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
75+
76+ # ==================== MACOS DEPENDENCIES ====================
77+ - name : Install build dependencies (macOS)
78+ if : matrix.os == 'macos-latest'
79+ 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
96+
97+ # ==================== UBUNTU CONFIGURE & BUILD ====================
98+ - name : Configure PHP (Ubuntu)
99+ if : matrix.os == 'ubuntu-latest'
100+ working-directory : php-src
101+ run : |
102+ ./buildconf -f
103+ ./configure \
104+ --enable-zts \
105+ --enable-option-checking=fatal \
106+ --prefix=/usr \
107+ --disable-phpdbg \
108+ --enable-fpm \
109+ --enable-opcache \
110+ --with-pdo-sqlite \
111+ --enable-intl \
112+ --without-pear \
113+ --enable-gd \
114+ --with-jpeg \
115+ --with-webp \
116+ --with-freetype \
117+ --enable-exif \
118+ --with-zip \
119+ --with-zlib \
120+ --enable-soap \
121+ --enable-xmlreader \
122+ --with-xsl \
123+ --with-tidy \
124+ --enable-sysvsem \
125+ --enable-sysvshm \
126+ --enable-shmop \
127+ --enable-pcntl \
128+ --with-readline \
129+ --enable-mbstring \
130+ --with-curl \
131+ --with-gettext \
132+ --enable-sockets \
133+ --with-bz2 \
134+ --with-openssl \
135+ --with-gmp \
136+ --enable-bcmath \
137+ --enable-calendar \
138+ --enable-ftp \
139+ --with-enchant=/usr \
140+ --enable-sysvmsg \
141+ --with-ffi \
142+ --enable-zend-test \
143+ --enable-dl-test=shared \
144+ --with-password-argon2 \
145+ --with-mhash \
146+ --with-sodium \
147+ --enable-dba \
148+ --with-cdb \
149+ --enable-flatfile \
150+ --enable-inifile \
151+ --with-config-file-path=/etc \
152+ --with-config-file-scan-dir=/etc/php.d \
153+ --enable-async
154+
155+ - name : Build PHP (Ubuntu)
156+ if : matrix.os == 'ubuntu-latest'
157+ working-directory : php-src
158+ run : |
159+ make -j"$(nproc)"
160+ sudo make install
161+ sudo mkdir -p /etc/php.d
162+ sudo chmod 777 /etc/php.d
163+ {
164+ echo "opcache.enable_cli=1"
165+ echo "opcache.protect_memory=1"
166+ } > /etc/php.d/opcache.ini
167+
168+ # ==================== WINDOWS CONFIGURE & BUILD ====================
169+ - name : Configure and Build PHP (Windows)
170+ if : matrix.os == 'windows-latest'
171+ working-directory : php-src
172+ run : |
173+ # Use php-sdk for environment setup and build
174+ call C:\php-sdk\bin\phpsdk_buildtree.bat phpdev
175+ call C:\php-sdk\bin\phpsdk_setvars.bat
176+ buildconf.bat
177+ configure.bat --enable-async
178+ nmake
179+ shell : cmd
180+
181+ # ==================== MACOS CONFIGURE & BUILD ====================
182+ - name : Configure PHP (macOS)
183+ if : matrix.os == 'macos-latest'
184+ working-directory : php-src
185+ run : |
186+ ./buildconf -f
187+ ./configure \
188+ --enable-zts \
189+ --enable-fpm \
190+ --enable-opcache \
191+ --with-pdo-sqlite \
192+ --enable-intl \
193+ --without-pear \
194+ --with-zip \
195+ --with-zlib \
196+ --enable-soap \
197+ --enable-xmlreader \
198+ --with-xsl \
199+ --with-tidy=$(brew --prefix tidy-html5) \
200+ --enable-sysvsem \
201+ --enable-sysvshm \
202+ --enable-shmop \
203+ --enable-pcntl \
204+ --with-readline \
205+ --enable-mbstring \
206+ --with-curl \
207+ --with-gettext \
208+ --enable-sockets \
209+ --with-bz2 \
210+ --with-openssl=$(brew --prefix openssl@3) \
211+ --with-gmp \
212+ --enable-bcmath \
213+ --enable-calendar \
214+ --enable-ftp \
215+ --enable-sysvmsg \
216+ --with-ffi \
217+ --enable-zend-test \
218+ --enable-dl-test=shared \
219+ --with-password-argon2 \
220+ --with-mhash \
221+ --with-sodium \
222+ --enable-dba \
223+ --with-cdb \
224+ --enable-flatfile \
225+ --enable-inifile \
226+ --with-config-file-path=/usr/local/etc \
227+ --with-config-file-scan-dir=/usr/local/etc/php.d \
228+ --enable-async
229+
230+ - name : Build PHP (macOS)
231+ if : matrix.os == 'macos-latest'
232+ working-directory : php-src
233+ run : |
234+ make -j"$(sysctl -n hw.ncpu)"
235+ sudo make install
236+ sudo mkdir -p /usr/local/etc/php.d
237+ sudo chmod 777 /usr/local/etc/php.d
238+ {
239+ echo "opcache.enable_cli=1"
240+ echo "opcache.protect_memory=1"
241+ } > /usr/local/etc/php.d/opcache.ini
242+
243+ # ==================== 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+
267+ - name : Run tests (Windows)
268+ if : matrix.os == 'windows-latest'
269+ working-directory : php-src
270+ run : |
271+ php.exe -v
272+ php.exe run-tests.php ^
273+ -d zend_extension=opcache.dll ^
274+ -d opcache.enable_cli=1 ^
275+ -d opcache.jit_buffer_size=64M ^
276+ -d opcache.jit=tracing ^
277+ -d zend_test.observer.enabled=1 ^
278+ -d zend_test.observer.show_output=0 ^
279+ -P -q -x -j2 ^
280+ -g FAIL,BORK,LEAK,XLEAK ^
281+ --no-progress ^
282+ --offline ^
283+ --show-diff ^
284+ --show-slow 1000 ^
285+ --set-timeout 120 ^
286+ --repeat 2 ^
287+ ext/async
288+ shell : cmd
289+
290+ - name : Run tests (macOS)
291+ if : matrix.os == 'macos-latest'
292+ working-directory : php-src
293+ run : |
294+ /usr/local/bin/php -v
295+ /usr/local/bin/php run-tests.php \
296+ -d zend_extension=opcache.so \
297+ -d opcache.enable_cli=1 \
298+ -d opcache.jit_buffer_size=64M \
299+ -d opcache.jit=tracing \
300+ -d zend_test.observer.enabled=1 \
301+ -d zend_test.observer.show_output=0 \
302+ -P -q -x -j2 \
303+ -g FAIL,BORK,LEAK,XLEAK \
304+ --no-progress \
305+ --offline \
306+ --show-diff \
307+ --show-slow 1000 \
308+ --set-timeout 120 \
309+ --repeat 2 \
310+ ext/async
0 commit comments