Skip to content

Commit fed66c8

Browse files
committed
#22: % update build-cross-platform.yml
1 parent 9c094e3 commit fed66c8

File tree

1 file changed

+101
-110
lines changed

1 file changed

+101
-110
lines changed

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

Lines changed: 101 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,24 @@ on:
77
branches: [build]
88

99
jobs:
10-
# Ubuntu build with database services (matches build.yml)
11-
ubuntu-database-build:
12-
runs-on: ubuntu-latest
10+
cross-platform-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: ubuntu
18+
- os: windows-latest
19+
platform: windows
20+
- os: macos-latest
21+
platform: macos
22+
23+
runs-on: ${{ matrix.os }}
1324

1425
services:
1526
mysql:
16-
image: mysql:8.3
27+
image: ${{ matrix.os == 'ubuntu-latest' && 'mysql:8.3' || '' }}
1728
env:
1829
MYSQL_ROOT_PASSWORD: ''
1930
MYSQL_ALLOW_EMPTY_PASSWORD: yes
@@ -26,7 +37,7 @@ jobs:
2637
--health-retries=5
2738
2839
postgres:
29-
image: postgres:16
40+
image: ${{ matrix.os == 'ubuntu-latest' && 'postgres:16' || '' }}
3041
env:
3142
POSTGRES_PASSWORD: postgres
3243
POSTGRES_DB: test
@@ -37,6 +48,7 @@ jobs:
3748
--health-timeout=5s
3849
--health-retries=5
3950
51+
4052
steps:
4153
- name: Checkout php-async repo
4254
uses: actions/checkout@v4
@@ -52,7 +64,9 @@ jobs:
5264
mkdir -p php-src/ext/async
5365
cp -r async/* php-src/ext/async/
5466
55-
- name: Install build dependencies
67+
# ==================== UBUNTU DEPENDENCIES ====================
68+
- name: Install build dependencies (Ubuntu)
69+
if: matrix.os == 'ubuntu-latest'
5670
run: |
5771
sudo apt-get update
5872
sudo apt-get install -y \
@@ -64,7 +78,8 @@ jobs:
6478
firebird-dev \
6579
valgrind cmake
6680
67-
- name: Install LibUV >= 1.44.0
81+
- name: Install LibUV >= 1.44.0 (Ubuntu)
82+
if: matrix.os == 'ubuntu-latest'
6883
run: |
6984
# Check if system libuv meets requirements
7085
if pkg-config --exists libuv && pkg-config --atleast-version=1.44.0 libuv; then
@@ -83,11 +98,64 @@ jobs:
8398
cd ../..
8499
fi
85100
86-
- name: Configure PHP
101+
# ==================== WINDOWS DEPENDENCIES ====================
102+
- name: Install build dependencies (Windows)
103+
if: matrix.os == 'windows-latest'
104+
run: |
105+
# Install php-sdk
106+
git clone https://github.com/Microsoft/php-sdk-binary-tools.git C:\php-sdk
107+
108+
# Install vcpkg and LibUV >= 1.44.0
109+
git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
110+
C:\vcpkg\bootstrap-vcpkg.bat
111+
C:\vcpkg\vcpkg.exe install libuv:x64-windows
112+
113+
# Verify LibUV version
114+
C:\vcpkg\vcpkg.exe list libuv
115+
116+
# Create deps structure for php-sdk
117+
mkdir C:\php-sdk\deps\include\libuv
118+
mkdir C:\php-sdk\deps\lib
119+
120+
# Copy LibUV files
121+
xcopy /E /I C:\vcpkg\installed\x64-windows\include C:\php-sdk\deps\include\libuv\
122+
copy C:\vcpkg\installed\x64-windows\lib\uv.lib C:\php-sdk\deps\lib\libuv.lib
123+
shell: cmd
124+
125+
# ==================== MACOS DEPENDENCIES ====================
126+
- name: Install build dependencies (macOS)
127+
if: matrix.os == 'macos-latest'
128+
run: |
129+
# Core build tools
130+
brew install autoconf automake libtool pkg-config bison
131+
132+
# LibUV >= 1.44.0 - main dependency
133+
brew install libuv
134+
135+
# Verify LibUV version
136+
pkg-config --modversion libuv || true
137+
libuv_version=$(pkg-config --modversion libuv 2>/dev/null || echo "unknown")
138+
echo "Installed LibUV version: $libuv_version"
139+
140+
# Fixed package names
141+
brew install tidy-html5 icu4c openssl@3
142+
143+
# Additional dependencies
144+
brew install gmp libzip bzip2 sqlite oniguruma curl
145+
brew install libxml2 libxslt readline libsodium argon2
146+
147+
# Setup environment variables for keg-only packages
148+
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
149+
echo "PATH=$(brew --prefix bison)/bin:$PATH" >> $GITHUB_ENV
150+
151+
# ==================== UBUNTU CONFIGURE & BUILD ====================
152+
- name: Configure PHP (Ubuntu)
153+
if: matrix.os == 'ubuntu-latest'
87154
working-directory: php-src
88155
run: |
89156
./buildconf -f
90157
./configure \
158+
--host=$(./build/config.guess) \
91159
--enable-zts \
92160
--enable-fpm \
93161
--enable-opcache \
@@ -138,7 +206,8 @@ jobs:
138206
--enable-address-sanitizer \
139207
--enable-async
140208
141-
- name: Build PHP
209+
- name: Build PHP (Ubuntu)
210+
if: matrix.os == 'ubuntu-latest'
142211
working-directory: php-src
143212
run: |
144213
make -j"$(nproc)"
@@ -150,106 +219,6 @@ jobs:
150219
echo "opcache.protect_memory=1"
151220
} > /etc/php.d/opcache.ini
152221
153-
- name: Run tests
154-
working-directory: php-src/ext/async
155-
run: |
156-
/usr/local/bin/php -v
157-
/usr/local/bin/php ../../run-tests.php \
158-
-d zend_extension=opcache.so \
159-
-d opcache.enable_cli=1 \
160-
-d opcache.jit_buffer_size=64M \
161-
-d opcache.jit=tracing \
162-
-d zend_test.observer.enabled=1 \
163-
-d zend_test.observer.show_output=0 \
164-
-P -q -x -j4 \
165-
-g FAIL,BORK,LEAK,XLEAK \
166-
--no-progress \
167-
--offline \
168-
--show-diff \
169-
--show-slow 4000 \
170-
--set-timeout 120 \
171-
--repeat 2
172-
173-
# Cross-platform build without database services
174-
cross-platform-build:
175-
strategy:
176-
fail-fast: false
177-
matrix:
178-
os: [windows-latest, macos-latest]
179-
include:
180-
- os: windows-latest
181-
platform: windows
182-
- os: macos-latest
183-
platform: macos
184-
185-
runs-on: ${{ matrix.os }}
186-
187-
188-
steps:
189-
- name: Checkout php-async repo
190-
uses: actions/checkout@v4
191-
with:
192-
path: async
193-
194-
- name: Clone php-src (true-async-stable)
195-
run: |
196-
git clone --depth=1 --branch=true-async-stable https://github.com/true-async/php-src php-src
197-
198-
- name: Copy php-async extension into php-src
199-
run: |
200-
mkdir -p php-src/ext/async
201-
cp -r async/* php-src/ext/async/
202-
203-
# ==================== WINDOWS DEPENDENCIES ====================
204-
- name: Install build dependencies (Windows)
205-
if: matrix.os == 'windows-latest'
206-
run: |
207-
# Install php-sdk
208-
git clone https://github.com/Microsoft/php-sdk-binary-tools.git C:\php-sdk
209-
210-
# Install vcpkg and LibUV >= 1.44.0
211-
git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
212-
C:\vcpkg\bootstrap-vcpkg.bat
213-
C:\vcpkg\vcpkg.exe install libuv:x64-windows
214-
215-
# Verify LibUV version
216-
C:\vcpkg\vcpkg.exe list libuv
217-
218-
# Create deps structure for php-sdk
219-
mkdir C:\php-sdk\deps\include\libuv
220-
mkdir C:\php-sdk\deps\lib
221-
222-
# Copy LibUV files
223-
xcopy /E /I C:\vcpkg\installed\x64-windows\include C:\php-sdk\deps\include\libuv\
224-
copy C:\vcpkg\installed\x64-windows\lib\uv.lib C:\php-sdk\deps\lib\libuv.lib
225-
shell: cmd
226-
227-
# ==================== MACOS DEPENDENCIES ====================
228-
- name: Install build dependencies (macOS)
229-
if: matrix.os == 'macos-latest'
230-
run: |
231-
# Core build tools
232-
brew install autoconf automake libtool pkg-config bison
233-
234-
# LibUV >= 1.44.0 - main dependency
235-
brew install libuv
236-
237-
# Verify LibUV version
238-
pkg-config --modversion libuv || true
239-
libuv_version=$(pkg-config --modversion libuv 2>/dev/null || echo "unknown")
240-
echo "Installed LibUV version: $libuv_version"
241-
242-
# Fixed package names
243-
brew install tidy-html5 icu4c openssl@3
244-
245-
# Additional dependencies
246-
brew install gmp libzip bzip2 sqlite oniguruma curl
247-
brew install libxml2 libxslt readline libsodium argon2
248-
249-
# Setup environment variables for keg-only packages
250-
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
251-
echo "PATH=$(brew --prefix bison)/bin:$PATH" >> $GITHUB_ENV
252-
253222
# ==================== WINDOWS CONFIGURE & BUILD ====================
254223
- name: Configure and Build PHP (Windows)
255224
if: matrix.os == 'windows-latest'
@@ -259,7 +228,7 @@ jobs:
259228
call C:\php-sdk\bin\phpsdk_buildtree.bat phpdev
260229
call C:\php-sdk\bin\phpsdk_setvars.bat
261230
buildconf.bat
262-
configure.bat --enable-async
231+
configure.bat --enable-opcache --enable-async --enable-pdo --with-pdo-mysql --enable-sockets --with-sqlite3 --with-curl --enable-ftp --with-pdo-pgsql
263232
nmake
264233
shell: cmd
265234

@@ -270,6 +239,7 @@ jobs:
270239
run: |
271240
./buildconf -f
272241
./configure \
242+
--host=$(./build/config.guess) \
273243
--enable-zts \
274244
--enable-fpm \
275245
--enable-opcache \
@@ -327,6 +297,27 @@ jobs:
327297
} > /usr/local/etc/php.d/opcache.ini
328298
329299
# ==================== TESTING FOR ALL PLATFORMS ====================
300+
- name: Run tests (Ubuntu)
301+
if: matrix.os == 'ubuntu-latest'
302+
working-directory: php-src/ext/async
303+
run: |
304+
/usr/local/bin/php -v
305+
/usr/local/bin/php ../../run-tests.php \
306+
-d zend_extension=opcache.so \
307+
-d opcache.enable_cli=1 \
308+
-d opcache.jit_buffer_size=64M \
309+
-d opcache.jit=tracing \
310+
-d zend_test.observer.enabled=1 \
311+
-d zend_test.observer.show_output=0 \
312+
-P -q -x -j4 \
313+
-g FAIL,BORK,LEAK,XLEAK \
314+
--no-progress \
315+
--offline \
316+
--show-diff \
317+
--show-slow 4000 \
318+
--set-timeout 120 \
319+
--repeat 2
320+
330321
- name: Run tests (Windows)
331322
if: matrix.os == 'windows-latest'
332323
working-directory: php-src/ext/async

0 commit comments

Comments
 (0)