Skip to content

Commit 13e4a76

Browse files
committed
#22: + new build files
1 parent adec656 commit 13e4a76

File tree

4 files changed

+632
-435
lines changed

4 files changed

+632
-435
lines changed

.github/workflows/build-alpine.yml

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
name: True Async Alpine Build
2+
3+
on:
4+
push:
5+
branches: [build-x]
6+
pull_request:
7+
branches: [build-x]
8+
9+
jobs:
10+
build-alpine:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
debug: [true, false]
15+
zts: [true, false]
16+
asan: [false, true]
17+
exclude:
18+
# Only run ASAN on debug+zts build to reduce test matrix
19+
- asan: true
20+
debug: false
21+
- asan: true
22+
zts: false
23+
24+
name: "ALPINE_X64_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || ''}}"
25+
runs-on: ubuntu-22.04
26+
container:
27+
image: 'alpine:3.20.1'
28+
timeout-minutes: 45
29+
30+
steps:
31+
- name: Checkout php-async repo
32+
uses: actions/checkout@v4
33+
with:
34+
path: async
35+
36+
- name: Clone php-src (true-async-stable)
37+
run: |
38+
apk add --no-cache git
39+
git clone --depth=1 --branch=true-async-stable https://github.com/true-async/php-src php-src
40+
41+
- name: Copy php-async extension into php-src
42+
run: |
43+
mkdir -p php-src/ext/async
44+
cp -r async/* php-src/ext/async/
45+
46+
- name: Install base packages
47+
run: |
48+
set -x
49+
apk update -q
50+
apk add \
51+
util-linux \
52+
bash \
53+
sudo \
54+
build-base \
55+
autoconf \
56+
unzip \
57+
tar \
58+
bison \
59+
re2c \
60+
pkgconf \
61+
mysql-client \
62+
bzip2-dev \
63+
curl-dev \
64+
freetype-dev \
65+
gettext-dev \
66+
gnu-libiconv-dev \
67+
gmp-dev \
68+
icu-dev \
69+
icu-data-full \
70+
jpeg-dev \
71+
libffi-dev \
72+
libpng-dev \
73+
libsodium-dev \
74+
libwebp-dev \
75+
libxml2-dev \
76+
libxpm-dev \
77+
libxslt-dev \
78+
libzip-dev \
79+
oniguruma-dev \
80+
openssl-dev \
81+
readline-dev \
82+
sqlite-dev \
83+
tidyhtml-dev \
84+
gdbm-dev \
85+
lmdb-dev \
86+
argon2-dev \
87+
enchant2-dev \
88+
freetds-dev \
89+
imap-dev \
90+
net-snmp-dev \
91+
openldap-dev \
92+
unixodbc-dev \
93+
postgresql14-dev \
94+
tzdata \
95+
musl-locales \
96+
musl-locales-lang
97+
98+
- name: Install LibUV and ASAN tools
99+
run: |
100+
# Install LibUV
101+
apk add libuv-dev cmake
102+
103+
# Install ASAN tools if needed
104+
if [ "${{ matrix.asan }}" = "true" ]; then
105+
# libclang_rt.asan-x86_64.a is provided by compiler-rt, and only for clang17
106+
apk add clang17 compiler-rt
107+
fi
108+
109+
- name: System info
110+
run: |
111+
echo "::group::Show host CPU info"
112+
lscpu
113+
echo "::endgroup::"
114+
echo "::group::Show installed package versions"
115+
apk list
116+
echo "::endgroup::"
117+
echo "::group::Show LibUV version"
118+
pkg-config --modversion libuv || echo "LibUV version not available via pkg-config"
119+
echo "::endgroup::"
120+
121+
- name: Configure PHP
122+
working-directory: php-src
123+
run: |
124+
set -x
125+
126+
# Set compiler flags based on matrix
127+
CFLAGS=""
128+
LDFLAGS=""
129+
CC="gcc"
130+
CXX="g++"
131+
132+
if [ "${{ matrix.asan }}" = "true" ]; then
133+
CFLAGS="-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC"
134+
LDFLAGS="-fsanitize=undefined,address -fno-sanitize=function"
135+
CC="clang-17"
136+
CXX="clang++-17"
137+
fi
138+
139+
./buildconf --force
140+
141+
# Configure with async extension
142+
CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CC="$CC" CXX="$CXX" ./configure \
143+
--enable-option-checking=fatal \
144+
--prefix=/usr/local \
145+
--with-pdo-mysql=mysqlnd \
146+
--with-mysqli=mysqlnd \
147+
--with-pgsql \
148+
--with-pdo-pgsql \
149+
--with-pdo-sqlite \
150+
--without-pear \
151+
--enable-gd \
152+
--with-jpeg \
153+
--with-webp \
154+
--with-freetype \
155+
--enable-exif \
156+
--with-zip \
157+
--with-zlib \
158+
--enable-soap \
159+
--enable-xmlreader \
160+
--with-xsl \
161+
--with-tidy \
162+
--with-libxml \
163+
--enable-sysvsem \
164+
--enable-sysvshm \
165+
--enable-shmop \
166+
--enable-pcntl \
167+
--with-readline \
168+
--enable-mbstring \
169+
--with-curl \
170+
--with-gettext \
171+
--enable-sockets \
172+
--with-bz2 \
173+
--with-openssl \
174+
--with-gmp \
175+
--with-iconv \
176+
--enable-bcmath \
177+
--enable-calendar \
178+
--enable-ftp \
179+
--enable-sysvmsg \
180+
--with-ffi \
181+
--enable-zend-test \
182+
--enable-dl-test=shared \
183+
--enable-intl \
184+
--with-mhash \
185+
--with-sodium \
186+
--enable-dba \
187+
--enable-werror \
188+
--with-config-file-path=/etc \
189+
--with-config-file-scan-dir=/etc/php.d \
190+
--${{ matrix.debug && 'enable' || 'disable' }}-debug \
191+
--${{ matrix.zts && 'enable' || 'disable' }}-zts \
192+
--enable-async
193+
194+
- name: Build PHP
195+
working-directory: php-src
196+
run: |
197+
make -j$(nproc) >/dev/null
198+
199+
- name: Install PHP
200+
working-directory: php-src
201+
run: |
202+
make install
203+
mkdir -p /etc/php.d
204+
{
205+
echo "opcache.enable_cli=1"
206+
echo "opcache.protect_memory=1"
207+
} > /etc/php.d/opcache.ini
208+
209+
- name: Run basic tests
210+
working-directory: php-src/ext/async
211+
run: |
212+
/usr/local/bin/php -v
213+
/usr/local/bin/php ../../run-tests.php \
214+
${{ matrix.asan && '--asan' || '' }} \
215+
-P -q -x -j$(nproc) \
216+
-g FAIL,BORK,LEAK,XLEAK \
217+
--no-progress \
218+
--offline \
219+
--show-diff \
220+
--show-slow 4000 \
221+
--set-timeout 120
222+
223+
- name: Test Tracing JIT
224+
# Alpine supports JIT
225+
working-directory: php-src/ext/async
226+
run: |
227+
/usr/local/bin/php ../../run-tests.php \
228+
${{ matrix.asan && '--asan' || '' }} \
229+
-d zend_extension=opcache.so \
230+
-d opcache.enable_cli=1 \
231+
-d opcache.jit_buffer_size=64M \
232+
-d opcache.jit=tracing \
233+
-P -q -x -j$(nproc) \
234+
-g FAIL,BORK,LEAK,XLEAK \
235+
--no-progress \
236+
--offline \
237+
--show-diff \
238+
--show-slow 4000 \
239+
--set-timeout 120
240+
241+
- name: Test OpCache
242+
working-directory: php-src/ext/async
243+
run: |
244+
/usr/local/bin/php ../../run-tests.php \
245+
${{ matrix.asan && '--asan' || '' }} \
246+
-d zend_extension=opcache.so \
247+
-d opcache.enable_cli=1 \
248+
-P -q -x -j$(nproc) \
249+
-g FAIL,BORK,LEAK,XLEAK \
250+
--no-progress \
251+
--offline \
252+
--show-diff \
253+
--show-slow 4000 \
254+
--set-timeout 120

0 commit comments

Comments
 (0)