Skip to content

Commit c964452

Browse files
committed
Split CI for type inference verification
1 parent 749b60c commit c964452

File tree

3 files changed

+229
-30
lines changed

3 files changed

+229
-30
lines changed

.github/workflows/nightly.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,16 @@ jobs:
349349
fail-fast: false
350350
matrix:
351351
branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
352-
name: "${{ matrix.branch.name }}_COMMUNITY"
352+
type: ['asan', 'verify_type_inference']
353+
# These branches don't include type verification
354+
exclude:
355+
- { branch: { name: 'PHP-8.1', ref: 'PHP-8.1', major: 8, minor: 1 }, type: 'verify_type_inference' }
356+
- { branch: { name: 'PHP-8.2', ref: 'PHP-8.2', major: 8, minor: 2 }, type: 'verify_type_inference' }
357+
- { branch: { name: 'PHP-8.3', ref: 'PHP-8.3', major: 8, minor: 3 }, type: 'verify_type_inference' }
358+
name: "${{ matrix.branch.name }}_COMMUNITY_${{ matrix.type }}"
353359
runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }}
354360
env:
361+
ASAN_OPTIONS: exitcode=139
355362
UBSAN_OPTIONS: print_stacktrace=1
356363
USE_ZEND_ALLOC: 0
357364
USE_TRACKED_ALLOC: 1
@@ -365,11 +372,11 @@ jobs:
365372
- name: ./configure
366373
uses: ./.github/actions/configure-x64
367374
with:
375+
# CFLAGS removes O2, so we have to add it again...
368376
configurationParameters: >-
369-
--enable-debug
370377
--enable-zts
371-
CFLAGS='-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC -DZEND_VERIFY_TYPE_INFERENCE'
372-
LDFLAGS='-fsanitize=undefined,address'
378+
${{ matrix.type == 'asan' && '--enable-debug CFLAGS="-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address"' || '' }}
379+
${{ matrix.type == 'verify_type_inference' && 'CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE -O2"' || '' }}
373380
- name: make
374381
run: make -j$(/usr/bin/nproc) >/dev/null
375382
- name: make install
@@ -379,12 +386,19 @@ jobs:
379386
sudo service mysql start
380387
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
381388
mysql -uroot -proot -e "SET GLOBAL local_infile = true"
382-
- name: Enable Opcache and JIT
389+
- name: Enable Opcache
383390
run: |
391+
echo memory_limit=-1 >> /etc/php.d/opcache.ini
384392
echo zend_extension=opcache.so > /etc/php.d/opcache.ini
385393
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
386394
echo opcache.enable=1 >> /etc/php.d/opcache.ini
387-
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
395+
echo opcache.memory_consumption=256M >> /etc/php.d/opcache.ini
396+
echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini
397+
echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini
398+
echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini
399+
- name: Enable JIT
400+
if: matrix.type != 'verify_type_inference'
401+
run: |
388402
echo opcache.jit=tracing >> /etc/php.d/opcache.ini
389403
echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini
390404
echo opcache.jit_max_root_traces=100000 >> /etc/php.d/opcache.ini
@@ -394,11 +408,6 @@ jobs:
394408
echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini
395409
echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini
396410
echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini
397-
echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini
398-
echo opcache.memory_consumption=256M >> /etc/php.d/opcache.ini
399-
echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini
400-
echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini
401-
echo memory_limit=-1 >> /etc/php.d/opcache.ini
402411
php -v
403412
- name: Test AMPHP
404413
if: matrix.branch.ref != 'PHP-8.0'
@@ -411,7 +420,6 @@ jobs:
411420
cd "amphp-$repository"
412421
git rev-parse HEAD
413422
php /usr/bin/composer install --no-progress --ignore-platform-reqs
414-
export ASAN_OPTIONS=exitcode=139
415423
vendor/bin/phpunit || EXIT_CODE=$?
416424
if [ ${EXIT_CODE:-0} -gt 128 ]; then
417425
X=1;
@@ -428,7 +436,6 @@ jobs:
428436
php /usr/bin/composer install --no-progress --ignore-platform-reqs
429437
# Hack to disable a test that hangs
430438
php -r '$c = file_get_contents("tests/Filesystem/FilesystemTest.php"); $c = str_replace("public function testSharedGet()", "#[\\PHPUnit\\Framework\\Attributes\\Group('"'"'skip'"'"')]\n public function testSharedGet()", $c); file_put_contents("tests/Filesystem/FilesystemTest.php", $c);'
431-
export ASAN_OPTIONS=exitcode=139
432439
php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$?
433440
if [ ${EXIT_CODE:-0} -gt 128 ]; then
434441
exit 1
@@ -444,7 +451,6 @@ jobs:
444451
cd "reactphp-$repository"
445452
git rev-parse HEAD
446453
php /usr/bin/composer install --no-progress --ignore-platform-reqs
447-
export ASAN_OPTIONS=exitcode=139
448454
vendor/bin/phpunit || EXIT_CODE=$?
449455
if [ $[EXIT_CODE:-0} -gt 128 ]; then
450456
X=1;
@@ -459,7 +465,6 @@ jobs:
459465
cd event-loop
460466
git rev-parse HEAD
461467
php /usr/bin/composer install --no-progress --ignore-platform-reqs
462-
export ASAN_OPTIONS=exitcode=139
463468
vendor/bin/phpunit || EXIT_CODE=$?
464469
if [ ${EXIT_CODE:-0} -gt 128 ]; then
465470
exit 1
@@ -476,7 +481,6 @@ jobs:
476481
php -r '$c = file_get_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php"); $c = str_replace("public function testSanitizeDeepNestedString()", "/** @group skip */\n public function testSanitizeDeepNestedString()", $c); file_put_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php", $c);'
477482
# Buggy FFI test in Symfony, see https://github.com/symfony/symfony/issues/47668
478483
php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("*/\n public function testCastNonTrailingCharPointer()", "* @group skip\n */\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);'
479-
export ASAN_OPTIONS=exitcode=139
480484
export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
481485
X=0
482486
for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do
@@ -492,7 +496,6 @@ jobs:
492496
git clone https://github.com/sebastianbergmann/phpunit.git --branch=main --depth=1
493497
cd phpunit
494498
git rev-parse HEAD
495-
export ASAN_OPTIONS=exitcode=139
496499
php /usr/bin/composer install --no-progress --ignore-platform-reqs
497500
php ./phpunit || EXIT_CODE=$?
498501
if [ ${EXIT_CODE:-0} -gt 128 ]; then
@@ -512,7 +515,6 @@ jobs:
512515
git clone https://github.com/WordPress/wordpress-develop.git wordpress --depth=1
513516
cd wordpress
514517
git rev-parse HEAD
515-
export ASAN_OPTIONS=exitcode=139
516518
php /usr/bin/composer install --no-progress --ignore-platform-reqs
517519
cp wp-tests-config-sample.php wp-tests-config.php
518520
sed -i 's/youremptytestdbnamehere/test/g' wp-tests-config.php

.github/workflows/push.yml

Lines changed: 192 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ env:
4545
CXX: ccache g++
4646
jobs:
4747
LINUX_X64:
48+
if: false
4849
services:
4950
mysql:
5051
image: mysql:8
@@ -150,6 +151,7 @@ jobs:
150151
if: ${{ !matrix.asan }}
151152
uses: ./.github/actions/verify-generated-files
152153
MACOS_DEBUG_NTS:
154+
if: false
153155
runs-on: macos-13
154156
steps:
155157
- name: git checkout
@@ -182,6 +184,7 @@ jobs:
182184
- name: Verify generated files are up to date
183185
uses: ./.github/actions/verify-generated-files
184186
WINDOWS:
187+
if: false
185188
name: WINDOWS_X64_ZTS
186189
runs-on: windows-2019
187190
env:
@@ -208,7 +211,8 @@ jobs:
208211
run: .github/scripts/windows/test.bat
209212
BENCHMARKING:
210213
name: BENCHMARKING
211-
if: github.repository_owner == 'php' || github.event_name == 'pull_request'
214+
# if: github.repository_owner == 'php' || github.event_name == 'pull_request'
215+
if: false
212216
runs-on: ubuntu-22.04
213217
steps:
214218
- name: git checkout
@@ -307,3 +311,190 @@ jobs:
307311
name: profiles
308312
path: ${{ github.workspace }}/benchmark/profiles
309313
retention-days: 30
314+
COMMUNITY:
315+
strategy:
316+
fail-fast: false
317+
matrix:
318+
branch:
319+
- { name: 'master', ref: 'master', major: 8, minor: 4 }
320+
- { name: 'PHP-8.3', ref: 'PHP-8.3', major: 8, minor: 3 }
321+
type: ['asan', 'verify_type_inference']
322+
# These branches don't include type verification
323+
exclude:
324+
- { branch: { name: 'PHP-8.1', ref: 'PHP-8.1', major: 8, minor: 1 }, type: 'verify_type_inference' }
325+
- { branch: { name: 'PHP-8.2', ref: 'PHP-8.2', major: 8, minor: 2 }, type: 'verify_type_inference' }
326+
- { branch: { name: 'PHP-8.3', ref: 'PHP-8.3', major: 8, minor: 3 }, type: 'verify_type_inference' }
327+
name: "${{ matrix.branch.name }}_COMMUNITY_${{ matrix.type }}"
328+
runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }}
329+
env:
330+
ASAN_OPTIONS: exitcode=139
331+
UBSAN_OPTIONS: print_stacktrace=1
332+
USE_ZEND_ALLOC: 0
333+
USE_TRACKED_ALLOC: 1
334+
steps:
335+
- name: git checkout
336+
uses: actions/checkout@v4
337+
with:
338+
ref: ${{ matrix.branch.ref }}
339+
- name: apt
340+
uses: ./.github/actions/apt-x64
341+
- name: ./configure
342+
uses: ./.github/actions/configure-x64
343+
with:
344+
# CFLAGS removes O2, so we have to add it again...
345+
configurationParameters: >-
346+
--enable-zts
347+
${{ matrix.type == 'asan' && '--enable-debug CFLAGS="-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address"' || '' }}
348+
${{ matrix.type == 'verify_type_inference' && 'CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE -O2"' || '' }}
349+
- name: make
350+
run: make -j$(/usr/bin/nproc) >/dev/null
351+
- name: make install
352+
uses: ./.github/actions/install-linux
353+
- name: Setup
354+
run: |
355+
sudo service mysql start
356+
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
357+
mysql -uroot -proot -e "SET GLOBAL local_infile = true"
358+
- name: Enable Opcache
359+
run: |
360+
echo memory_limit=-1 >> /etc/php.d/opcache.ini
361+
echo zend_extension=opcache.so > /etc/php.d/opcache.ini
362+
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
363+
echo opcache.enable=1 >> /etc/php.d/opcache.ini
364+
echo opcache.memory_consumption=256M >> /etc/php.d/opcache.ini
365+
echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini
366+
echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini
367+
echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini
368+
- name: Enable JIT
369+
if: matrix.type != 'verify_type_inference'
370+
run: |
371+
echo opcache.jit=tracing >> /etc/php.d/opcache.ini
372+
echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini
373+
echo opcache.jit_max_root_traces=100000 >> /etc/php.d/opcache.ini
374+
echo opcache.jit_max_side_traces=100000 >> /etc/php.d/opcache.ini
375+
echo opcache.jit_max_exit_counters=100000 >> /etc/php.d/opcache.ini
376+
echo opcache.jit_hot_loop=1 >> /etc/php.d/opcache.ini
377+
echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini
378+
echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini
379+
echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini
380+
php -v
381+
- name: Test AMPHP
382+
if: matrix.branch.ref != 'PHP-8.0'
383+
run: |
384+
repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server"
385+
X=0
386+
for repository in $repositories; do
387+
printf "Testing amp/%s\n" "$repository"
388+
git clone "https://github.com/amphp/$repository.git" "amphp-$repository" --depth 1
389+
cd "amphp-$repository"
390+
git rev-parse HEAD
391+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
392+
vendor/bin/phpunit || EXIT_CODE=$?
393+
if [ ${EXIT_CODE:-0} -gt 128 ]; then
394+
X=1;
395+
fi
396+
cd ..
397+
done
398+
exit $X
399+
- name: Test Laravel
400+
if: matrix.branch.ref != 'PHP-8.0'
401+
run: |
402+
git clone https://github.com/laravel/framework.git --branch=master --depth=1
403+
cd framework
404+
git rev-parse HEAD
405+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
406+
# Hack to disable a test that hangs
407+
php -r '$c = file_get_contents("tests/Filesystem/FilesystemTest.php"); $c = str_replace("public function testSharedGet()", "#[\\PHPUnit\\Framework\\Attributes\\Group('"'"'skip'"'"')]\n public function testSharedGet()", $c); file_put_contents("tests/Filesystem/FilesystemTest.php", $c);'
408+
php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$?
409+
if [ ${EXIT_CODE:-0} -gt 128 ]; then
410+
exit 1
411+
fi
412+
- name: Test ReactPHP
413+
if: matrix.branch.ref != 'PHP-8.0'
414+
run: |
415+
repositories="async cache child-process datagram dns event-loop promise promise-stream promise-timer stream"
416+
X=0
417+
for repository in $repositories; do
418+
printf "Testing reactphp/%s\n" "$repository"
419+
git clone "https://github.com/reactphp/$repository.git" "reactphp-$repository" --depth 1
420+
cd "reactphp-$repository"
421+
git rev-parse HEAD
422+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
423+
vendor/bin/phpunit || EXIT_CODE=$?
424+
if [ $[EXIT_CODE:-0} -gt 128 ]; then
425+
X=1;
426+
fi
427+
cd ..
428+
done
429+
exit $X
430+
- name: Test Revolt PHP
431+
if: matrix.branch.ref != 'PHP-8.0'
432+
run: |
433+
git clone https://github.com/revoltphp/event-loop.git --depth=1
434+
cd event-loop
435+
git rev-parse HEAD
436+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
437+
vendor/bin/phpunit || EXIT_CODE=$?
438+
if [ ${EXIT_CODE:-0} -gt 128 ]; then
439+
exit 1
440+
fi
441+
- name: Test Symfony
442+
if: matrix.branch.ref != 'PHP-8.0'
443+
run: |
444+
git clone https://github.com/symfony/symfony.git --depth=1
445+
cd symfony
446+
git rev-parse HEAD
447+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
448+
php ./phpunit install
449+
# Test causes a heap-buffer-overflow but I cannot reproduce it locally...
450+
php -r '$c = file_get_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php"); $c = str_replace("public function testSanitizeDeepNestedString()", "/** @group skip */\n public function testSanitizeDeepNestedString()", $c); file_put_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php", $c);'
451+
# Buggy FFI test in Symfony, see https://github.com/symfony/symfony/issues/47668
452+
php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("*/\n public function testCastNonTrailingCharPointer()", "* @group skip\n */\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);'
453+
export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
454+
X=0
455+
for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do
456+
php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$?
457+
if [ ${EXIT_CODE:-0} -gt 128 ]; then
458+
X=1;
459+
fi
460+
done
461+
exit $X
462+
- name: Test PHPUnit
463+
if: always()
464+
run: |
465+
git clone https://github.com/sebastianbergmann/phpunit.git --branch=main --depth=1
466+
cd phpunit
467+
git rev-parse HEAD
468+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
469+
php ./phpunit || EXIT_CODE=$?
470+
if [ ${EXIT_CODE:-0} -gt 128 ]; then
471+
exit 1
472+
fi
473+
- name: 'Symfony Preloading'
474+
if: matrix.branch.ref != 'PHP-8.0'
475+
run: |
476+
php /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress --ignore-platform-reqs
477+
cd symfony_demo
478+
git rev-parse HEAD
479+
sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php
480+
php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php
481+
- name: Test Wordpress
482+
if: always()
483+
run: |
484+
git clone https://github.com/WordPress/wordpress-develop.git wordpress --depth=1
485+
cd wordpress
486+
git rev-parse HEAD
487+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
488+
cp wp-tests-config-sample.php wp-tests-config.php
489+
sed -i 's/youremptytestdbnamehere/test/g' wp-tests-config.php
490+
sed -i 's/yourusernamehere/root/g' wp-tests-config.php
491+
sed -i 's/yourpasswordhere/root/g' wp-tests-config.php
492+
php vendor/bin/phpunit || EXIT_CODE=$?
493+
if [ $EXIT_CODE -gt 128 ]; then
494+
exit 1
495+
fi
496+
- name: Notify Slack
497+
if: failure()
498+
uses: ./.github/actions/notify-slack
499+
with:
500+
token: ${{ secrets.ACTION_MONITORING_SLACK }}

0 commit comments

Comments
 (0)