Skip to content

Commit 1bd310e

Browse files
committed
Alpine/Musl CI
1 parent ff58a7f commit 1bd310e

File tree

9 files changed

+269
-5
lines changed

9 files changed

+269
-5
lines changed

.github/actions/apk/action.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: apk
2+
runs:
3+
using: composite
4+
steps:
5+
- shell: sh
6+
run: |
7+
set -x
8+
9+
apk update -q
10+
apk add \
11+
util-linux \
12+
bash \
13+
sudo \
14+
build-base \
15+
autoconf \
16+
unzip \
17+
tar \
18+
bison \
19+
re2c \
20+
pkgconf \
21+
mysql-client \
22+
aspell-dev \
23+
hunspell-dev \
24+
hunspell-en \
25+
bzip2-dev \
26+
curl-dev \
27+
freetype-dev \
28+
gettext-dev \
29+
gnu-libiconv-dev \
30+
gmp-dev \
31+
icu-dev \
32+
icu-data-full \
33+
jpeg-dev \
34+
libffi-dev \
35+
libpng-dev \
36+
libsodium-dev \
37+
libwebp-dev \
38+
libxml2-dev \
39+
libxpm-dev \
40+
libxslt-dev \
41+
libzip-dev \
42+
oniguruma-dev \
43+
openssl-dev \
44+
readline-dev \
45+
sqlite-dev \
46+
tidyhtml-dev \
47+
krb5-dev \
48+
gdbm-dev \
49+
lmdb-dev \
50+
argon2-dev \
51+
enchant2-dev \
52+
enchant2-hunspell \
53+
freetds-dev \
54+
imap-dev \
55+
net-snmp-dev \
56+
openldap-dev \
57+
unixodbc-dev \
58+
postgresql14-dev \
59+
tzdata \
60+
musl-locales \
61+
musl-locales-lang
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: ./configure
2+
inputs:
3+
configurationParameters:
4+
default: ''
5+
required: false
6+
configureArtifacts:
7+
default: null
8+
required: false
9+
runs:
10+
using: composite
11+
steps:
12+
- shell: bash
13+
run: |
14+
set -x
15+
./buildconf --force
16+
./configure \
17+
--enable-option-checking=fatal \
18+
--prefix=/usr \
19+
--enable-phpdbg \
20+
--enable-fpm \
21+
--with-pdo-mysql=mysqlnd \
22+
--with-mysqli=mysqlnd \
23+
${{ inputs.skipSlow == 'false' && '--with-pgsql' || '' }} \
24+
${{ inputs.skipSlow == 'false' && '--with-pdo-pgsql' || '' }} \
25+
${{ inputs.skipSlow == 'false' && '--with-pdo-sqlite' || '' }} \
26+
--enable-intl \
27+
--without-pear \
28+
--enable-gd \
29+
--with-jpeg \
30+
--with-webp \
31+
--with-freetype \
32+
--with-xpm \
33+
--enable-exif \
34+
--with-zip \
35+
--with-zlib \
36+
--enable-soap \
37+
--enable-xmlreader \
38+
--with-xsl \
39+
${{ inputs.skipSlow == 'false' && '--with-tidy' || '' }} \
40+
--enable-sysvsem \
41+
--enable-sysvshm \
42+
--enable-shmop \
43+
--enable-pcntl \
44+
--with-readline \
45+
--enable-mbstring \
46+
--with-iconv=/usr \
47+
--with-curl \
48+
--with-gettext \
49+
--enable-sockets \
50+
--with-bz2 \
51+
--with-openssl \
52+
--with-gmp \
53+
--enable-bcmath \
54+
--enable-calendar \
55+
--enable-ftp \
56+
${{ inputs.skipSlow == 'false' && '--with-enchant=/usr' || '' }} \
57+
--enable-sysvmsg \
58+
--with-ffi \
59+
--enable-zend-test \
60+
${{ inputs.skipSlow == 'false' && '--enable-dl-test=shared' || '' }} \
61+
${{ inputs.skipSlow == 'false' && '--with-ldap' || '' }} \
62+
${{ inputs.skipSlow == 'false' && '--with-ldap-sasl' || '' }} \
63+
--with-password-argon2 \
64+
--with-mhash \
65+
--with-sodium \
66+
--enable-dba \
67+
--with-cdb \
68+
--enable-flatfile \
69+
--enable-inifile \
70+
--with-lmdb \
71+
--with-gdbm \
72+
${{ inputs.skipSlow == 'false' && '--with-snmp' || '' }} \
73+
${{ inputs.skipSlow == 'false' && '--with-unixODBC' || '' }} \
74+
${{ inputs.skipSlow == 'false' && '--with-pdo-odbc=unixODBC,/usr' || '' }} \
75+
--with-config-file-path=/etc \
76+
--with-config-file-scan-dir=/etc/php.d \
77+
${{ inputs.skipSlow == 'false' && '--with-pdo-dblib' || '' }} \
78+
--enable-werror \
79+
${{ inputs.configurationParameters }}
80+
- uses: actions/upload-artifact@v4
81+
if: always() && inputs.configureArtifacts != null
82+
with:
83+
name: ${{ github.job }}_CONFIGURE_${{ inputs.configureArtifacts }}
84+
path: ${{ github.workspace }}/config.log
85+
retention-days: 5
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Install
2+
runs:
3+
using: composite
4+
steps:
5+
- shell: bash
6+
run: |
7+
set -x
8+
sudo make install
9+
sudo mkdir -p /etc/php.d
10+
sudo chmod 777 /etc/php.d
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Test
2+
inputs:
3+
testArtifacts:
4+
default: null
5+
required: false
6+
runTestsParameters:
7+
default: ''
8+
required: false
9+
jitType:
10+
default: 'disable'
11+
required: false
12+
runs:
13+
using: composite
14+
steps:
15+
- shell: bash
16+
run: |
17+
set -x
18+
export SKIP_IO_CAPTURE_TESTS=1
19+
export TEST_PHP_JUNIT=junit.out.xml
20+
export STACK_LIMIT_DEFAULTS_CHECK=1
21+
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
22+
-d opcache.jit=${{ inputs.jitType }} \
23+
-d opcache.protect_memory=1 \
24+
-d opcache.jit_buffer_size=64M \
25+
-j$(($(nproc) - 1)) \
26+
-g FAIL,BORK,LEAK,XLEAK \
27+
--no-progress \
28+
--offline \
29+
--show-diff \
30+
--show-slow 1000 \
31+
--set-timeout 120
32+
- uses: actions/upload-artifact@v4
33+
if: always() && inputs.testArtifacts != null
34+
with:
35+
name: ${{ github.job }}_${{ inputs.testArtifacts }}
36+
path: ${{ github.workspace }}/junit.out.xml
37+
retention-days: 5

.github/workflows/push.yml

+71
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,77 @@ jobs:
191191
runTestsParameters: >-
192192
-d zend_extension=opcache.so
193193
-d opcache.enable_cli=1
194+
ALPINE:
195+
if: github.repository_owner == 'php' || github.event_name == 'pull_request'
196+
strategy:
197+
fail-fast: false
198+
matrix:
199+
include:
200+
- debug: false
201+
zts: false
202+
asan: false
203+
- debug: true
204+
zts: true
205+
asan: true
206+
name: "ALPINE_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}"
207+
runs-on: ubuntu-22.04
208+
container:
209+
image: 'alpine:3.19.1'
210+
steps:
211+
- name: git checkout
212+
uses: actions/checkout@v4
213+
- name: apk
214+
uses: ./.github/actions/apk
215+
- name: LLVM 17 (ASAN-only)
216+
if: ${{ matrix.asan }}
217+
# libclang_rt.asan-x86_64.a is provided by compiler-rt, and only for clang17
218+
run: |
219+
apk add clang17 compiler-rt
220+
- name: System info
221+
run: |
222+
echo "::group::Show host CPU info"
223+
lscpu
224+
echo "::endgroup::"
225+
echo "::group::Show installed package versions"
226+
apk list
227+
echo "::endgroup::"
228+
- name: ccache
229+
uses: hendrikmuhs/[email protected]
230+
with:
231+
# This duplicates the "job.name" expression above because
232+
# GitHub has no way to query the job name (github.job is the
233+
# job id, not the job name)
234+
key: "ALPINE_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}-${{hashFiles('main/php_version.h')}}"
235+
append-timestamp: false
236+
- name: ./configure
237+
uses: ./.github/actions/configure-alpine
238+
with:
239+
# -Wno-error=address: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114609
240+
# -Wno-error=stringop-overread: main/getopt.c: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114622
241+
configurationParameters: >-
242+
--${{ matrix.debug && 'enable' || 'disable' }}-debug
243+
--${{ matrix.zts && 'enable' || 'disable' }}-zts
244+
${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address -fno-sanitize=function" CC=clang-17 CXX=clang++-17' || 'CFLAGS="-Wno-error=address -Wno-error=stringop-overread"' }}
245+
skipSlow: ${{ matrix.asan }}
246+
configureArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}
247+
- name: make
248+
run: make -j$(/usr/bin/nproc) >/dev/null
249+
- name: make install
250+
uses: ./.github/actions/install-alpine
251+
- name: Test
252+
if: matrix.asan == false
253+
uses: ./.github/actions/test-alpine
254+
with:
255+
testArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}
256+
- name: Test Tracing JIT
257+
uses: ./.github/actions/test-alpine
258+
with:
259+
testArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}_Tracing JIT
260+
jitType: tracing
261+
runTestsParameters: >-
262+
-d zend_extension=opcache.so
263+
-d opcache.enable_cli=1
264+
${{ matrix.asan && '--asan -x' || '' }}
194265
MACOS_DEBUG_NTS:
195266
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
196267
strategy:

Zend/zend.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@ ZEND_API ZEND_COLD void zend_error_zstr_at(
14031403
zval retval;
14041404
zval orig_user_error_handler;
14051405
bool in_compilation;
1406-
zend_class_entry *saved_class_entry;
1406+
zend_class_entry *saved_class_entry = NULL;
14071407
zend_stack loop_var_stack;
14081408
zend_stack delayed_oplines_stack;
14091409
int type = orig_type & E_ALL;

ext/intl/formatter/formatter_format.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ PHP_FUNCTION( numfmt_format )
114114
}
115115
RETURN_THROWS();
116116
default:
117-
zend_argument_value_error(hasThis() ? 2 : 3, "must be a NumberFormatter::TYPE_* constant");
117+
zend_argument_value_error(ZEND_IS_METHOD_CALL() ? 2 : 3, "must be a NumberFormatter::TYPE_* constant");
118118
RETURN_THROWS();
119119
}
120120

ext/intl/formatter/formatter_parse.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ PHP_FUNCTION( numfmt_parse )
9696
}
9797
goto cleanup;
9898
default:
99-
zend_argument_value_error(hasThis() ? 2 : 3, "must be a NumberFormatter::TYPE_* constant");
99+
zend_argument_value_error(ZEND_IS_METHOD_CALL() ? 2 : 3, "must be a NumberFormatter::TYPE_* constant");
100100
goto cleanup;
101101
}
102102

ext/opcache/jit/zend_jit_ir.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -4570,7 +4570,7 @@ static struct jit_observer_fcall_is_unobserved_data jit_observer_fcall_is_unobse
45704570
ir_ref tmp = ir_LOAD_U8(ir_ADD_OFFSET(func_ref, offsetof(zend_function, type)));
45714571
ir_ref if_internal_func = ir_IF(ir_AND_U8(tmp, ir_CONST_U8(ZEND_INTERNAL_FUNCTION)));
45724572
ir_IF_TRUE(if_internal_func);
4573-
4573+
45744574
ir_ref observer_handler_internal = ir_ADD_OFFSET(run_time_cache, zend_observer_fcall_internal_function_extension * sizeof(void *));
45754575

45764576
ir_ref if_internal_func_end = ir_END();
@@ -17103,7 +17103,7 @@ static ir_ref jit_frameless_observer(zend_jit_ctx *jit, const zend_op *opline) {
1710317103
// Not need for runtime cache or generator checks here, we just need if_unobserved
1710417104
ir_ref if_unobserved = jit_observer_fcall_is_unobserved_start(jit, fbc, &observer_handler, IR_UNUSED, IR_UNUSED).if_unobserved;
1710517105

17106-
// Call zend_frameless_observed_call for the main logic.
17106+
// Call zend_frameless_observed_call for the main logic.
1710717107
ir_CALL_1(IR_VOID, ir_CONST_ADDR((size_t)zend_frameless_observed_call), jit_FP(jit));
1710817108

1710917109
ir_ref skip = ir_END();

0 commit comments

Comments
 (0)