From 35c01832f897d2b1ae9ec32f15f84e8d2b63ee9e Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 12 Oct 2023 13:19:55 +0200 Subject: [PATCH 1/6] Add PHPSeclib, Psalm and PHPStan to nightly tests --- .github/workflows/nightly.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 04ecbb83c7434..ef40e9033ce85 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -389,6 +389,28 @@ jobs: echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v + - name: Test Psalm + if: matrix.branch.ref != 'PHP-8.0' + run: | + git clone https://github.com/vimeo/psalm --branch=master + cd psalm + git checkout 7428e49b115a2a837aa29cf0fafd0ca902fe2457 + export ASAN_OPTIONS=exitcode=139 + # Needed to avoid overwriting JIT config + export PSALM_ALLOW_XDEBUG=1 + php /usr/bin/composer install --no-progress --ignore-platform-reqs + php ./psalm --no-cache || exit $? + - name: Test PHPStan + if: matrix.branch.ref != 'PHP-8.0' + run: | + git clone https://github.com/phpstan/phpstan-src + cd phpstan-src + git checkout d02cc99d4480a203a2dbe54a5ded2da016266b11 + sed -E 's/phpVersion(.*)max[^)]+/phpVersion\1max(89999/g' conf/parametersSchema.neon -i + php /usr/bin/composer install --no-progress --ignore-platform-reqs + export ASAN_OPTIONS=exitcode=139 + php bin/phpstan clear-result-cache + php bin/phpstan || exit $? - name: Test AMPHP if: matrix.branch.ref != 'PHP-8.0' run: | @@ -475,6 +497,16 @@ jobs: fi done exit $X + - name: Test PHPSeclib + if: always() + run: | + git clone https://github.com/phpseclib/phpseclib --branch=master + cd phpseclib + git checkout 259bd9f1e8af11726ed74acf527c2c046549061b + export ASAN_OPTIONS=exitcode=139 + export PHPSECLIB_ALLOW_JIT=1 + php /usr/bin/composer install --no-progress --ignore-platform-reqs + php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $? - name: Test PHPUnit if: always() run: | From 2813621441e742dfe247a8267a5eb4985d378a6b Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 22 Oct 2023 13:43:22 +0200 Subject: [PATCH 2/6] Add JIT check --- .github/jit_check.php | 30 +++++++++++++++++++++++++ .github/workflows/nightly.yml | 42 +++++++++++++++++++++-------------- 2 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 .github/jit_check.php diff --git a/.github/jit_check.php b/.github/jit_check.php new file mode 100644 index 0000000000000..393e2ba12ba04 --- /dev/null +++ b/.github/jit_check.php @@ -0,0 +1,30 @@ + /etc/php.d/opcache.ini echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini + echo opcache.enable=1 >> /etc/php.d/opcache.ini echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini + echo opcache.jit=tracing >> /etc/php.d/opcache.ini echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini echo opcache.jit_max_root_traces=100000 >> /etc/php.d/opcache.ini echo opcache.jit_max_side_traces=100000 >> /etc/php.d/opcache.ini @@ -387,30 +389,36 @@ jobs: echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini + echo opcache.jit_blacklist_root_trace=255 >> /etc/php.d/opcache.ini + echo opcache.jit_blacklist_side_trace=255 >> /etc/php.d/opcache.ini + echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini + echo opcache.memory_consumption=256M >> /etc/php.d/opcache.ini + echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini + echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v - name: Test Psalm if: matrix.branch.ref != 'PHP-8.0' run: | - git clone https://github.com/vimeo/psalm --branch=master + git clone https://github.com/vimeo/psalm --branch=master --depth 1 cd psalm - git checkout 7428e49b115a2a837aa29cf0fafd0ca902fe2457 + git rev-parse HEAD export ASAN_OPTIONS=exitcode=139 # Needed to avoid overwriting JIT config export PSALM_ALLOW_XDEBUG=1 php /usr/bin/composer install --no-progress --ignore-platform-reqs - php ./psalm --no-cache || exit $? + php $GITHUB_WORKSPACE/.github/jit_check.php ./psalm --no-cache || exit $? - name: Test PHPStan if: matrix.branch.ref != 'PHP-8.0' run: | - git clone https://github.com/phpstan/phpstan-src + git clone https://github.com/phpstan/phpstan-src --depth 1 cd phpstan-src - git checkout d02cc99d4480a203a2dbe54a5ded2da016266b11 + git rev-parse HEAD sed -E 's/phpVersion(.*)max[^)]+/phpVersion\1max(89999/g' conf/parametersSchema.neon -i php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 - php bin/phpstan clear-result-cache - php bin/phpstan || exit $? + php $GITHUB_WORKSPACE/.github/jit_check.php bin/phpstan clear-result-cache + php $GITHUB_WORKSPACE/.github/jit_check.php bin/phpstan || exit $? - name: Test AMPHP if: matrix.branch.ref != 'PHP-8.0' run: | @@ -423,7 +431,7 @@ jobs: git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 - vendor/bin/phpunit || EXIT_CODE=$? + php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then X=1; fi @@ -440,7 +448,7 @@ jobs: # Hack to disable a test that hangs php -r '$c = file_get_contents("tests/Filesystem/FilesystemTest.php"); $c = str_replace("*/\n public function testSharedGet()", "* @group skip\n */\n public function testSharedGet()", $c); file_put_contents("tests/Filesystem/FilesystemTest.php", $c);' export ASAN_OPTIONS=exitcode=139 - php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$? + php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi @@ -456,7 +464,7 @@ jobs: git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 - vendor/bin/phpunit || EXIT_CODE=$? + php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$? if [ $[EXIT_CODE:-0} -gt 128 ]; then X=1; fi @@ -471,7 +479,7 @@ jobs: git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 - vendor/bin/phpunit || EXIT_CODE=$? + php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi @@ -491,7 +499,7 @@ jobs: export SYMFONY_DEPRECATIONS_HELPER=max[total]=999 X=0 for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do - php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$? + php $GITHUB_WORKSPACE/.github/jit_check.php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then X=1; fi @@ -500,13 +508,13 @@ jobs: - name: Test PHPSeclib if: always() run: | - git clone https://github.com/phpseclib/phpseclib --branch=master + git clone https://github.com/phpseclib/phpseclib --depth 1 cd phpseclib - git checkout 259bd9f1e8af11726ed74acf527c2c046549061b + git rev-parse HEAD export ASAN_OPTIONS=exitcode=139 export PHPSECLIB_ALLOW_JIT=1 php /usr/bin/composer install --no-progress --ignore-platform-reqs - php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $? + php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $? - name: Test PHPUnit if: always() run: | @@ -515,7 +523,7 @@ jobs: git rev-parse HEAD export ASAN_OPTIONS=exitcode=139 php /usr/bin/composer install --no-progress --ignore-platform-reqs - php ./phpunit || EXIT_CODE=$? + php $GITHUB_WORKSPACE/.github/jit_check.php ./phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi @@ -539,7 +547,7 @@ jobs: sed -i 's/youremptytestdbnamehere/test/g' wp-tests-config.php sed -i 's/yourusernamehere/root/g' wp-tests-config.php sed -i 's/yourpasswordhere/root/g' wp-tests-config.php - php vendor/bin/phpunit || EXIT_CODE=$? + php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$? if [ $EXIT_CODE -gt 128 ]; then exit 1 fi From 7d0f0610b44593c58fb9680c16a88d70196c0c00 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 22 Oct 2023 19:43:40 +0200 Subject: [PATCH 3/6] Add infection to testsuite, repeat JIT tests --- .github/actions/test-linux/action.yml | 1 + .github/actions/test-macos/action.yml | 1 + .github/nightly_matrix.php | 15 +++------------ .github/workflows/nightly.yml | 9 +++++++++ ext/standard/tests/dir/bug71542.phpt | 1 + 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index 1b1edf26cc979..84bdcb693ff6b 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -41,6 +41,7 @@ runs: export TEST_PHP_JUNIT=junit.out.xml export STACK_LIMIT_DEFAULTS_CHECK=1 sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \ + ${{ inputs.jitType == 'disable' && '' || '--repeat 2' }} -d opcache.jit=${{ inputs.jitType }} \ -d opcache.protect_memory=1 \ -d opcache.jit_buffer_size=64M \ diff --git a/.github/actions/test-macos/action.yml b/.github/actions/test-macos/action.yml index 20a89b53d52ef..b8ecdcce9ef4d 100644 --- a/.github/actions/test-macos/action.yml +++ b/.github/actions/test-macos/action.yml @@ -20,6 +20,7 @@ runs: export TEST_PHP_JUNIT=junit.out.xml export STACK_LIMIT_DEFAULTS_CHECK=1 sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \ + ${{ inputs.jitType == 'disable' && '' || '--repeat 2' }} -d opcache.jit=${{ inputs.jitType }} \ -d opcache.protect_memory=1 \ -d opcache.jit_buffer_size=64M \ diff --git a/.github/nightly_matrix.php b/.github/nightly_matrix.php index 33a50c55e0271..575193340106f 100644 --- a/.github/nightly_matrix.php +++ b/.github/nightly_matrix.php @@ -46,26 +46,17 @@ function get_matrix_include(array $branches) { $jobs = []; foreach ($branches as $branch) { $jobs[] = [ - 'name' => '_ASAN_UBSAN', + 'name' => '_ASAN_UBSAN_REPEAT', 'branch' => $branch, 'debug' => true, 'zts' => true, 'configuration_parameters' => "CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address'", 'run_tests_parameters' => '--asan', - 'test_function_jit' => false, + 'timeout_minutes' => 3600, + 'test_function_jit' => true, 'asan' => true, ]; if ($branch['ref'] !== 'PHP-8.0') { - $jobs[] = [ - 'name' => '_REPEAT', - 'branch' => $branch, - 'debug' => true, - 'zts' => false, - 'run_tests_parameters' => '--repeat 2', - 'timeout_minutes' => 360, - 'test_function_jit' => true, - 'asan' => false, - ]; $jobs[] = [ 'name' => '_VARIATION', 'branch' => $branch, diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 814db705bfcfc..cc87eb0e44ec0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -397,6 +397,15 @@ jobs: echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v + - name: Test Infection + if: matrix.branch.ref != 'PHP-8.0' + run: | + git clone https://github.com/infection/infection --branch=master --depth 1 + cd infection + git rev-parse HEAD + export ASAN_OPTIONS=exitcode=139 + php /usr/bin/composer install --no-progress --ignore-platform-reqs + php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || exit $? - name: Test Psalm if: matrix.branch.ref != 'PHP-8.0' run: | diff --git a/ext/standard/tests/dir/bug71542.phpt b/ext/standard/tests/dir/bug71542.phpt index 058b877cc6519..314de403e9cbf 100644 --- a/ext/standard/tests/dir/bug71542.phpt +++ b/ext/standard/tests/dir/bug71542.phpt @@ -2,6 +2,7 @@ Bug #71542 (disk_total_space does not work with relative paths) --FILE-- Date: Sun, 22 Oct 2023 20:02:58 +0200 Subject: [PATCH 4/6] Repeat windows JIT tests too --- .github/scripts/windows/test_task.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/windows/test_task.bat b/.github/scripts/windows/test_task.bat index c997eee5cb7ec..bba165838fe72 100644 --- a/.github/scripts/windows/test_task.bat +++ b/.github/scripts/windows/test_task.bat @@ -83,7 +83,7 @@ set OPENSSL_CONF= rem set SSLEAY_CONF= rem prepare for OPcache -if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=100000 -d opcache.jit_max_side_traces=100000 -d opcache.jit_max_exit_counters=100000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 -d opcache.jit=tracing +if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=100000 -d opcache.jit_max_side_traces=100000 -d opcache.jit_max_exit_counters=100000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 -d opcache.jit=tracing --repeat 2 rem work-around for failing to dl(mysqli) with OPcache (https://github.com/php/php-src/issues/8508) if "%OPCACHE%" equ "1" set OPCACHE_OPTS=%OPCACHE_OPTS% -d extension=mysqli From 5c129272f161924367e4cc79a3c2e6da3321194c Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 11 Nov 2023 19:28:22 +0100 Subject: [PATCH 5/6] Fix --- .github/actions/test-linux/action.yml | 2 +- .github/actions/test-macos/action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index bf5b0ba95cefc..ac9b74d97c489 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -43,7 +43,7 @@ runs: export TEST_PHP_JUNIT=junit.out.xml export STACK_LIMIT_DEFAULTS_CHECK=1 sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \ - ${{ inputs.jitType == 'disable' && '' || '--repeat 2' }} + ${{ inputs.jitType == 'disable' && '' || '--repeat 2' }} \ -d opcache.jit=${{ inputs.jitType }} \ -d opcache.protect_memory=1 \ -d opcache.jit_buffer_size=64M \ diff --git a/.github/actions/test-macos/action.yml b/.github/actions/test-macos/action.yml index 713b03260169d..6620599e85d14 100644 --- a/.github/actions/test-macos/action.yml +++ b/.github/actions/test-macos/action.yml @@ -20,7 +20,7 @@ runs: export TEST_PHP_JUNIT=junit.out.xml export STACK_LIMIT_DEFAULTS_CHECK=1 sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \ - ${{ inputs.jitType == 'disable' && '' || '--repeat 2' }} + ${{ inputs.jitType == 'disable' && '' || '--repeat 2' }} \ -d opcache.jit=${{ inputs.jitType }} \ -d opcache.protect_memory=1 \ -d opcache.jit_buffer_size=64M \ From 8f64c9e1703481f70aff7c6d7283e8107d36e54e Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 1 Feb 2024 11:25:39 +0100 Subject: [PATCH 6/6] Cleanup --- .github/jit_check.php | 30 ------ .github/nightly_matrix.php | 81 ++++++++------- .github/workflows/nightly.yml | 180 +++++++++++++++------------------- 3 files changed, 124 insertions(+), 167 deletions(-) delete mode 100644 .github/jit_check.php diff --git a/.github/jit_check.php b/.github/jit_check.php deleted file mode 100644 index 393e2ba12ba04..0000000000000 --- a/.github/jit_check.php +++ /dev/null @@ -1,30 +0,0 @@ - 'master', 'ref' => 'master', 'version' => ['major' => 8, 'minor' => 4]], + ['name' => 'PHP-8.3', 'ref' => 'PHP-8.3', 'version' => ['major' => 8, 'minor' => 3]], + ['name' => 'PHP-8.2', 'ref' => 'PHP-8.2', 'version' => ['major' => 8, 'minor' => 2]], + ['name' => 'PHP-8.1', 'ref' => 'PHP-8.1', 'version' => ['major' => 8, 'minor' => 1]], +]; function get_branch_commit_cache_file_path(): string { return dirname(__DIR__) . '/branch-commit-cache.json'; } -function get_branch_matrix(array $branches) { - $result = array_map(function ($branch) { - $branch_key = strtoupper(str_replace('.', '', $branch)); - return [ - 'name' => $branch_key, - 'ref' => $branch, - ]; - }, $branches); - - return $result; -} - function get_branches() { $branch_commit_cache_file = get_branch_commit_cache_file_path(); $branch_commit_map = []; @@ -27,47 +20,54 @@ function get_branches() { $changed_branches = []; foreach (BRANCHES as $branch) { - $previous_commit_hash = $branch_commit_map[$branch] ?? null; - $current_commit_hash = trim(shell_exec('git rev-parse origin/' . $branch)); + $previous_commit_hash = $branch_commit_map[$branch['ref']] ?? null; + $current_commit_hash = trim(shell_exec('git rev-parse origin/' . $branch['ref'])); if ($previous_commit_hash !== $current_commit_hash) { $changed_branches[] = $branch; } - $branch_commit_map[$branch] = $current_commit_hash; + $branch_commit_map[$branch['ref']] = $current_commit_hash; } file_put_contents($branch_commit_cache_file, json_encode($branch_commit_map)); - return get_branch_matrix($changed_branches); + return $changed_branches; } function get_matrix_include(array $branches) { $jobs = []; foreach ($branches as $branch) { $jobs[] = [ - 'name' => '_ASAN_UBSAN_REPEAT', + 'name' => '_ASAN_UBSAN', 'branch' => $branch, 'debug' => true, 'zts' => true, 'configuration_parameters' => "CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address'", - 'run_tests_parameters' => '--asan', - 'timeout_minutes' => 3600, - 'test_function_jit' => true, + 'run_tests_parameters' => '--asan --repeat 2', + 'test_function_jit' => false, 'asan' => true, ]; - if ($branch['ref'] !== 'PHP-8.0') { - $jobs[] = [ - 'name' => '_VARIATION', - 'branch' => $branch, - 'debug' => true, - 'zts' => true, - 'configuration_parameters' => "CFLAGS='-DZEND_RC_DEBUG=1 -DPROFITABILITY_CHECKS=0 -DZEND_VERIFY_FUNC_INFO=1'", - 'timeout_minutes' => 360, - 'test_function_jit' => true, - 'asan' => false, - ]; - } + $jobs[] = [ + 'name' => '_REPEAT', + 'branch' => $branch, + 'debug' => true, + 'zts' => false, + 'run_tests_parameters' => '--repeat 2', + 'timeout_minutes' => 360, + 'test_function_jit' => true, + 'asan' => false, + ]; + $jobs[] = [ + 'name' => '_VARIATION', + 'branch' => $branch, + 'debug' => true, + 'zts' => true, + 'configuration_parameters' => "CFLAGS='-DZEND_RC_DEBUG=1 -DPROFITABILITY_CHECKS=0 -DZEND_VERIFY_FUNC_INFO=1 -DZEND_VERIFY_TYPE_INFERENCE'", + 'timeout_minutes' => 360, + 'test_function_jit' => true, + 'asan' => false, + ]; } return $jobs; } @@ -91,14 +91,27 @@ function get_windows_matrix_include(array $branches) { return $jobs; } +function get_current_version(): array { + $file = dirname(__DIR__) . '/main/php_version.h'; + $content = file_get_contents($file); + preg_match('(^#define PHP_MAJOR_VERSION (?\d+)$)m', $content, $matches); + $major = $matches['num']; + preg_match('(^#define PHP_MINOR_VERSION (?\d+)$)m', $content, $matches); + $minor = $matches['num']; + return ['major' => $major, 'minor' => $minor]; +} + $trigger = $argv[1] ?? 'schedule'; $attempt = (int) ($argv[2] ?? 1); $discard_cache = ($trigger === 'schedule' && $attempt !== 1) || $trigger === 'workflow_dispatch'; if ($discard_cache) { @unlink(get_branch_commit_cache_file_path()); } +$branch = $argv[3] ?? 'master'; -$branches = get_branches(); +$branches = $branch === 'master' + ? get_branches() + : [['name' => strtoupper($branch), 'ref' => $branch, 'version' => get_current_version()]]; $matrix_include = get_matrix_include($branches); $windows_matrix_include = get_windows_matrix_include($branches); diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 5deb78f0cc4fe..d00ca74e184fb 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -32,7 +32,7 @@ jobs: nightly- - name: Generate Matrix id: set-matrix - run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" + run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.head_ref || github.ref_name }}" - name: Notify Slack if: failure() uses: ./.github/actions/notify-slack @@ -48,6 +48,15 @@ jobs: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: test + firebird: + image: jacobalberty/firebird + ports: + - 3050:3050 + env: + ISC_PASSWORD: test + FIREBIRD_DATABASE: test.fdb + FIREBIRD_USER: test + FIREBIRD_PASSWORD: test strategy: fail-fast: false matrix: @@ -60,7 +69,7 @@ jobs: zts: [true, false] include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.matrix-include) }} name: "${{ matrix.branch.name }}_LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - runs-on: ubuntu-${{ ((matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && !matrix.asan) && '22.04' || '20.04' }} + runs-on: ubuntu-${{ (matrix.branch.version.minor >= 3 && !matrix.asan) && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -99,6 +108,7 @@ jobs: testArtifacts: ${{ matrix.branch.name }}_${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} runTestsParameters: >- ${{ matrix.run_tests_parameters }} + idleCpu: ${{ matrix.asan && 'true' || 'false' }} - name: Test Tracing JIT uses: ./.github/actions/test-linux with: @@ -147,7 +157,7 @@ jobs: name: "${{ matrix.branch.name }}_LINUX_X32_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" runs-on: ubuntu-latest container: - image: ubuntu:${{ (matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && '22.04' || '20.04' }} + image: ubuntu:${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} services: mysql: image: mysql:8 @@ -224,7 +234,7 @@ jobs: debug: [true, false] zts: [true, false] name: "${{ matrix.branch.name }}_MACOS_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - runs-on: macos-12 + runs-on: macos-${{ matrix.branch.version.minor >= 4 && '13' || '12' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -287,6 +297,15 @@ jobs: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: test + firebird: + image: jacobalberty/firebird + ports: + - 3050:3050 + env: + ISC_PASSWORD: test + FIREBIRD_DATABASE: test.fdb + FIREBIRD_USER: test + FIREBIRD_PASSWORD: test runs-on: ubuntu-22.04 steps: - name: git checkout @@ -330,9 +349,16 @@ jobs: fail-fast: false matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} - name: "${{ matrix.branch.name }}_COMMUNITY" - runs-on: ubuntu-${{ (matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && '22.04' || '20.04' }} + type: ['asan', 'verify_type_inference'] + # These branches don't include type verification + exclude: + - { branch: { name: 'PHP-8.1', ref: 'PHP-8.1', major: 8, minor: 1 }, type: 'verify_type_inference' } + - { branch: { name: 'PHP-8.2', ref: 'PHP-8.2', major: 8, minor: 2 }, type: 'verify_type_inference' } + - { branch: { name: 'PHP-8.3', ref: 'PHP-8.3', major: 8, minor: 3 }, type: 'verify_type_inference' } + name: "${{ matrix.branch.name }}_COMMUNITY_${{ matrix.type }}" + runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} env: + ASAN_OPTIONS: exitcode=139 UBSAN_OPTIONS: print_stacktrace=1 USE_ZEND_ALLOC: 0 USE_TRACKED_ALLOC: 1 @@ -346,11 +372,11 @@ jobs: - name: ./configure uses: ./.github/actions/configure-x64 with: + # CFLAGS removes O2, so we have to add it again... configurationParameters: >- - --enable-debug --enable-zts - CFLAGS='-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC' - LDFLAGS='-fsanitize=undefined,address' + ${{ matrix.type == 'asan' && '--enable-debug CFLAGS="-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address"' || '' }} + ${{ matrix.type == 'verify_type_inference' && 'CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE -O2"' || '' }} - name: make run: make -j$(/usr/bin/nproc) >/dev/null - name: make install @@ -360,12 +386,20 @@ jobs: sudo service mysql start mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test" mysql -uroot -proot -e "SET GLOBAL local_infile = true" - - name: Enable Opcache and JIT + - name: Enable Opcache run: | + echo memory_limit=-1 >> /etc/php.d/opcache.ini echo zend_extension=opcache.so > /etc/php.d/opcache.ini echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini echo opcache.enable=1 >> /etc/php.d/opcache.ini echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini + echo opcache.memory_consumption=256M >> /etc/php.d/opcache.ini + echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini + echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini + echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini + - name: Enable JIT + if: matrix.type != 'verify_type_inference' + run: | echo opcache.jit=tracing >> /etc/php.d/opcache.ini echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini echo opcache.jit_max_root_traces=100000 >> /etc/php.d/opcache.ini @@ -375,47 +409,8 @@ jobs: echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini - echo opcache.jit_blacklist_root_trace=255 >> /etc/php.d/opcache.ini - echo opcache.jit_blacklist_side_trace=255 >> /etc/php.d/opcache.ini - echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini - echo opcache.memory_consumption=256M >> /etc/php.d/opcache.ini - echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini - echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini - echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v - - name: Test Infection - if: matrix.branch.ref != 'PHP-8.0' - run: | - git clone https://github.com/infection/infection --branch=master --depth 1 - cd infection - git rev-parse HEAD - export ASAN_OPTIONS=exitcode=139 - php /usr/bin/composer install --no-progress --ignore-platform-reqs - php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || exit $? - - name: Test Psalm - if: matrix.branch.ref != 'PHP-8.0' - run: | - git clone https://github.com/vimeo/psalm --branch=master --depth 1 - cd psalm - git rev-parse HEAD - export ASAN_OPTIONS=exitcode=139 - # Needed to avoid overwriting JIT config - export PSALM_ALLOW_XDEBUG=1 - php /usr/bin/composer install --no-progress --ignore-platform-reqs - php $GITHUB_WORKSPACE/.github/jit_check.php ./psalm --no-cache || exit $? - - name: Test PHPStan - if: matrix.branch.ref != 'PHP-8.0' - run: | - git clone https://github.com/phpstan/phpstan-src --depth 1 - cd phpstan-src - git rev-parse HEAD - sed -E 's/phpVersion(.*)max[^)]+/phpVersion\1max(89999/g' conf/parametersSchema.neon -i - php /usr/bin/composer install --no-progress --ignore-platform-reqs - export ASAN_OPTIONS=exitcode=139 - php $GITHUB_WORKSPACE/.github/jit_check.php bin/phpstan clear-result-cache - php $GITHUB_WORKSPACE/.github/jit_check.php bin/phpstan || exit $? - name: Test AMPHP - if: matrix.branch.ref != 'PHP-8.0' run: | repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" X=0 @@ -425,8 +420,7 @@ jobs: cd "amphp-$repository" git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs - export ASAN_OPTIONS=exitcode=139 - php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$? + vendor/bin/phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then X=1; fi @@ -434,21 +428,18 @@ jobs: done exit $X - name: Test Laravel - if: matrix.branch.ref != 'PHP-8.0' run: | git clone https://github.com/laravel/framework.git --branch=master --depth=1 cd framework git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs # Hack to disable a test that hangs - php -r '$c = file_get_contents("tests/Filesystem/FilesystemTest.php"); $c = str_replace("*/\n public function testSharedGet()", "* @group skip\n */\n public function testSharedGet()", $c); file_put_contents("tests/Filesystem/FilesystemTest.php", $c);' - export ASAN_OPTIONS=exitcode=139 - php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$? + 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);' + php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi - name: Test ReactPHP - if: matrix.branch.ref != 'PHP-8.0' run: | repositories="async cache child-process datagram dns event-loop promise promise-stream promise-timer stream" X=0 @@ -458,8 +449,7 @@ jobs: cd "reactphp-$repository" git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs - export ASAN_OPTIONS=exitcode=139 - php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$? + vendor/bin/phpunit || EXIT_CODE=$? if [ $[EXIT_CODE:-0} -gt 128 ]; then X=1; fi @@ -467,19 +457,16 @@ jobs: done exit $X - name: Test Revolt PHP - if: matrix.branch.ref != 'PHP-8.0' run: | git clone https://github.com/revoltphp/event-loop.git --depth=1 cd event-loop git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs - export ASAN_OPTIONS=exitcode=139 - php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$? + vendor/bin/phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi - name: Test Symfony - if: matrix.branch.ref != 'PHP-8.0' run: | git clone https://github.com/symfony/symfony.git --depth=1 cd symfony @@ -490,40 +477,27 @@ jobs: 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);' # Buggy FFI test in Symfony, see https://github.com/symfony/symfony/issues/47668 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);' - export ASAN_OPTIONS=exitcode=139 export SYMFONY_DEPRECATIONS_HELPER=max[total]=999 X=0 for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do - php $GITHUB_WORKSPACE/.github/jit_check.php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$? + php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then X=1; fi done exit $X - - name: Test PHPSeclib - if: always() - run: | - git clone https://github.com/phpseclib/phpseclib --depth 1 - cd phpseclib - git rev-parse HEAD - export ASAN_OPTIONS=exitcode=139 - export PHPSECLIB_ALLOW_JIT=1 - php /usr/bin/composer install --no-progress --ignore-platform-reqs - php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $? - name: Test PHPUnit if: always() run: | git clone https://github.com/sebastianbergmann/phpunit.git --branch=main --depth=1 cd phpunit git rev-parse HEAD - export ASAN_OPTIONS=exitcode=139 php /usr/bin/composer install --no-progress --ignore-platform-reqs - php $GITHUB_WORKSPACE/.github/jit_check.php ./phpunit || EXIT_CODE=$? + php ./phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi - name: 'Symfony Preloading' - if: matrix.branch.ref != 'PHP-8.0' run: | php /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress --ignore-platform-reqs cd symfony_demo @@ -536,13 +510,12 @@ jobs: git clone https://github.com/WordPress/wordpress-develop.git wordpress --depth=1 cd wordpress git rev-parse HEAD - export ASAN_OPTIONS=exitcode=139 php /usr/bin/composer install --no-progress --ignore-platform-reqs cp wp-tests-config-sample.php wp-tests-config.php sed -i 's/youremptytestdbnamehere/test/g' wp-tests-config.php sed -i 's/yourusernamehere/root/g' wp-tests-config.php sed -i 's/yourpasswordhere/root/g' wp-tests-config.php - php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$? + php vendor/bin/phpunit || EXIT_CODE=$? if [ $EXIT_CODE -gt 128 ]; then exit 1 fi @@ -561,12 +534,21 @@ jobs: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: test + firebird: + image: jacobalberty/firebird + ports: + - 3050:3050 + env: + ISC_PASSWORD: test + FIREBIRD_DATABASE: test.fdb + FIREBIRD_USER: test + FIREBIRD_PASSWORD: test strategy: fail-fast: false matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} name: "${{ matrix.branch.name }}_OPCACHE_VARIATION" - runs-on: ubuntu-${{ (matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && '22.04' || '20.04' }} + runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -642,7 +624,7 @@ jobs: matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} name: "${{ matrix.branch.name }}_MSAN" - runs-on: ubuntu-${{ (matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && '22.04' || '20.04' }} + runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -695,7 +677,7 @@ jobs: --enable-memory-sanitizer \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d \ - ${{ matrix.branch.ref != 'PHP-8.0' && '--enable-dl-test=shared' || '' }} + --enable-dl-test=shared - name: make run: make -j$(/usr/bin/nproc) >/dev/null - name: make install @@ -739,10 +721,8 @@ jobs: fail-fast: false matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} - exclude: - - branch: { name: 'PHP-80', ref: 'PHP-8.0' } name: "${{ matrix.branch.name }}_LIBMYSQLCLIENT" - runs-on: ubuntu-${{ (matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && '22.04' || '20.04' }} + runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -758,30 +738,23 @@ jobs: mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test" # Ensure local_infile tests can run. mysql -uroot -proot -e "SET GLOBAL local_infile = true" - # Does not support caching_sha2_auth :( - # - name: Build mysql-5.6 - # uses: ./.github/actions/build-libmysqlclient - # with: - # libmysql: mysql-5.6.49-linux-glibc2.12-x86_64.tar.gz - # - name: Test mysql-5.6 - # uses: ./.github/actions/test-libmysqlclient - - name: Build mysql-5.7 + - name: Build mysql-8.0 uses: ./.github/actions/build-libmysqlclient with: - libmysql: mysql-5.7.41-linux-glibc2.12-x86_64.tar.gz + configurationParameters: --enable-werror + libmysql: mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }} - - name: Test mysql-5.7 + - name: Test mysql-8.0 uses: ./.github/actions/test-libmysqlclient with: withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }} - - name: Build mysql-8.0 + - name: Build mysql-8.2 uses: ./.github/actions/build-libmysqlclient with: - # FIXME: There are new warnings - # configurationParameters: --enable-werror - libmysql: mysql-8.0.33-linux-glibc2.12-x86_64.tar.xz + configurationParameters: --enable-werror + libmysql: mysql-8.2.0-linux-glibc2.28-x86_64.tar.xz withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }} - - name: Test mysql-8.0 + - name: Test mysql-8.2 uses: ./.github/actions/test-libmysqlclient with: withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }} @@ -819,13 +792,13 @@ jobs: repository: php-memcached-dev/php-memcached path: memcached - name: git checkout redis + # Currently fails to build + if: false uses: actions/checkout@v4 with: repository: phpredis/phpredis path: redis - name: git checkout xdebug - # Currently breaks due to a PHP <=8.3 version check - if: false uses: actions/checkout@v4 with: repository: xdebug/xdebug @@ -880,13 +853,14 @@ jobs: ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config make -j$(/usr/bin/nproc) - name: build redis + # Currently fails to build + if: false run: | cd redis /opt/php/bin/phpize ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config make -j$(/usr/bin/nproc) - name: build xdebug - if: false run: | cd xdebug /opt/php/bin/phpize