From 27e8860594d99154b2885b38542cc028154094b0 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Tue, 29 Oct 2024 15:30:34 +0100 Subject: [PATCH] Backport nightly.yml and nightly_matrix.php to PHP-8.1 These files are usually only used on master, as the cron trigger runs on master. However, workflow_dispatch does use the file from the triggered branch. Furthermore, we're looking into migrating to a workflow_call trigger, which will also run on the target branch. Backport these files now to make those changes easier. --- .github/nightly_matrix.php | 151 +++++++---- .github/workflows/nightly.yml | 454 ++++++++++++++++++++++++++++------ 2 files changed, 493 insertions(+), 112 deletions(-) diff --git a/.github/nightly_matrix.php b/.github/nightly_matrix.php index 868ecb41375c5..d83f198133f76 100644 --- a/.github/nightly_matrix.php +++ b/.github/nightly_matrix.php @@ -1,23 +1,17 @@ 'master', 'ref' => 'master', 'version' => ['major' => 8, 'minor' => 5]], + ['name' => 'PHP-8.4', 'ref' => 'PHP-8.4', '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,19 +21,19 @@ 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) { @@ -53,27 +47,29 @@ function get_matrix_include(array $branches) { 'configuration_parameters' => "CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address'", 'run_tests_parameters' => '--asan', 'test_function_jit' => false, + 'asan' => true, + ]; + $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'", + 'run_tests_parameters' => '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0', + 'timeout_minutes' => 360, + 'test_function_jit' => true, + 'asan' => false, ]; - 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, - ]; - $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, - ]; - } } return $jobs; } @@ -97,17 +93,88 @@ function get_windows_matrix_include(array $branches) { return $jobs; } +function get_macos_matrix_include(array $branches) { + $jobs = []; + foreach ($branches as $branch) { + foreach([true, false] as $debug) { + foreach([true, false] as $zts) { + $jobs[] = [ + 'branch' => $branch, + 'debug' => $debug, + 'zts' => $zts, + 'os' => '13', + 'arch' => 'X64', + 'test_jit' => true, + ]; + if ($branch['version']['minor'] >= 4 || $branch['version']['major'] >= 9) { + $jobs[] = [ + 'branch' => $branch, + 'debug' => $debug, + 'zts' => $zts, + 'os' => '14', + 'arch' => 'ARM64', + 'test_jit' => !$zts, + ]; + } + } + } + } + return $jobs; +} + +function get_alpine_matrix_include(array $branches) { + $jobs = []; + foreach ($branches as $branch) { + if ([$branch['version']['major'], $branch['version']['minor']] < [8, 4]) { + continue; + } + $jobs[] = [ + 'name' => '_ASAN_UBSAN', + 'branch' => $branch, + 'debug' => true, + 'zts' => true, + 'asan' => true, + 'test_jit' => true, + 'configuration_parameters' => "CFLAGS='-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address -fno-sanitize=function' CC=clang-17 CXX=clang++-17", + 'run_tests_parameters' => '--asan -x', + ]; + } + 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'; +$monday = date('w', time()) === '1'; +$discard_cache = $monday + || ($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); +$macos_matrix_include = get_macos_matrix_include($branches); +$alpine_matrix_include = get_alpine_matrix_include($branches); -echo '::set-output name=branches::' . json_encode($branches, JSON_UNESCAPED_SLASHES) . "\n"; -echo '::set-output name=matrix-include::' . json_encode($matrix_include, JSON_UNESCAPED_SLASHES) . "\n"; -echo '::set-output name=windows-matrix-include::' . json_encode($windows_matrix_include, JSON_UNESCAPED_SLASHES) . "\n"; +$f = fopen(getenv('GITHUB_OUTPUT'), 'a'); +fwrite($f, 'branches=' . json_encode($branches, JSON_UNESCAPED_SLASHES) . "\n"); +fwrite($f, 'matrix-include=' . json_encode($matrix_include, JSON_UNESCAPED_SLASHES) . "\n"); +fwrite($f, 'windows-matrix-include=' . json_encode($windows_matrix_include, JSON_UNESCAPED_SLASHES) . "\n"); +fwrite($f, 'macos-matrix-include=' . json_encode($macos_matrix_include, JSON_UNESCAPED_SLASHES) . "\n"); +fwrite($f, 'alpine-matrix-include=' . json_encode($alpine_matrix_include, JSON_UNESCAPED_SLASHES) . "\n"); +fclose($f); diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d05df1bf74320..bb1755769e9ca 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -3,15 +3,19 @@ on: schedule: - cron: "0 1 * * *" workflow_dispatch: ~ +permissions: + contents: read jobs: GENERATE_MATRIX: name: Generate Matrix - if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch' + if: github.repository == 'php/php-src' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest outputs: branches: ${{ steps.set-matrix.outputs.branches }} matrix-include: ${{ steps.set-matrix.outputs.matrix-include }} windows-matrix-include: ${{ steps.set-matrix.outputs.windows-matrix-include }} + macos-matrix-include: ${{ steps.set-matrix.outputs.macos-matrix-include }} + alpine-matrix-include: ${{ steps.set-matrix.outputs.alpine-matrix-include }} steps: - uses: actions/checkout@v4 with: @@ -20,7 +24,7 @@ jobs: # the correct commit hashes. fetch-depth: 0 - name: Grab the commit mapping - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: branch-commit-cache.json # The cache key needs to change every time for the @@ -30,15 +34,97 @@ 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 with: token: ${{ secrets.ACTION_MONITORING_SLACK }} + ALPINE: + needs: GENERATE_MATRIX + if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} + strategy: + fail-fast: false + matrix: + include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.alpine-matrix-include) }} + name: "${{ matrix.branch.name }}_ALPINE_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" + runs-on: ubuntu-22.04 + container: + image: 'alpine:3.20.1' + steps: + - name: git checkout + uses: actions/checkout@v4 + with: + ref: ${{ matrix.branch.ref }} + - name: apk + uses: ./.github/actions/apk + - name: LLVM 17 (ASAN-only) + if: ${{ matrix.asan }} + # libclang_rt.asan-x86_64.a is provided by compiler-rt, and only for clang17: + # https://pkgs.alpinelinux.org/contents?file=libclang_rt.asan-x86_64.a&path=&name=&branch=v3.20 + run: | + apk add clang17 compiler-rt + - name: System info + run: | + echo "::group::Show host CPU info" + lscpu + echo "::endgroup::" + echo "::group::Show installed package versions" + apk list + echo "::endgroup::" + - name: ./configure + uses: ./.github/actions/configure-alpine + with: + configurationParameters: >- + ${{ matrix.configuration_parameters }} + --${{ matrix.debug && 'enable' || 'disable' }}-debug + --${{ matrix.zts && 'enable' || 'disable' }}-zts + skipSlow: ${{ matrix.asan }} + - name: make + run: make -j$(/usr/bin/nproc) >/dev/null + - name: make install + uses: ./.github/actions/install-alpine + - name: Test Tracing JIT + if: matrix.test_jit + uses: ./.github/actions/test-alpine + with: + jitType: tracing + runTestsParameters: >- + ${{ matrix.run_tests_parameters }} + -d zend_extension=opcache.so + -d opcache.enable_cli=1 + - name: Notify Slack + if: failure() + uses: ./.github/actions/notify-slack + with: + token: ${{ secrets.ACTION_MONITORING_SLACK }} + LINUX_X64: needs: GENERATE_MATRIX if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} + services: + mysql: + image: mysql:8.3 + ports: + - 3306:3306 + env: + MYSQL_DATABASE: test + MYSQL_ROOT_PASSWORD: root + postgres: + image: postgres + env: + 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: @@ -51,7 +137,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-20.04 + runs-on: ubuntu-${{ (matrix.branch.version.minor >= 3 && !matrix.asan) && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -59,10 +145,18 @@ jobs: ref: ${{ matrix.branch.ref }} - name: Create MSSQL container uses: ./.github/actions/setup-mssql - - name: Create Oracle container - uses: ./.github/actions/setup-oracle - name: apt uses: ./.github/actions/apt-x64 + with: + asan: ${{ matrix.asan && 'true' || 'false' }} + - name: System info + run: | + echo "::group::Show host CPU info" + lscpu + echo "::endgroup::" + echo "::group::Show installed package versions" + dpkg -l + echo "::endgroup::" - name: ./configure uses: ./.github/actions/configure-x64 with: @@ -70,6 +164,7 @@ jobs: ${{ matrix.configuration_parameters }} --${{ matrix.debug && 'enable' || 'disable' }}-debug --${{ matrix.zts && 'enable' || 'disable' }}-zts + asan: ${{ matrix.asan && 'true' || 'false' }} - name: make run: make -j$(/usr/bin/nproc) >/dev/null - name: make install @@ -81,6 +176,7 @@ jobs: with: runTestsParameters: >- ${{ matrix.run_tests_parameters }} + idleCpu: ${{ matrix.asan && 'true' || 'false' }} - name: Test Tracing JIT uses: ./.github/actions/test-linux with: @@ -126,14 +222,10 @@ jobs: name: "${{ matrix.branch.name }}_LINUX_X32_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" runs-on: ubuntu-latest container: - image: ubuntu:20.04 - env: - MYSQL_TEST_HOST: mysql - PDO_MYSQL_TEST_DSN: mysql:host=mysql;dbname=test - PDO_MYSQL_TEST_HOST: mysql + image: ubuntu:${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} services: mysql: - image: mysql:8 + image: mysql:8.3 ports: - 3306:3306 env: @@ -146,6 +238,14 @@ jobs: ref: ${{ matrix.branch.ref }} - name: apt uses: ./.github/actions/apt-x32 + - name: System info + run: | + echo "::group::Show host CPU info" + lscpu + echo "::endgroup::" + echo "::group::Show installed package versions" + dpkg -l + echo "::endgroup::" - name: ./configure uses: ./.github/actions/configure-x32 with: @@ -195,11 +295,9 @@ jobs: strategy: fail-fast: false matrix: - branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} - debug: [true, false] - zts: [true, false] - name: "${{ matrix.branch.name }}_MACOS_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - runs-on: macos-13 + include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.macos-matrix-include) }} + name: "${{ matrix.branch.name }}_MACOS_${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" + runs-on: macos-${{ matrix.os }} steps: - name: git checkout uses: actions/checkout@v4 @@ -215,35 +313,34 @@ jobs: --${{ matrix.zts && 'enable' || 'disable' }}-zts - name: make run: |- - export PATH="/usr/local/opt/bison/bin:$PATH" + export PATH="$(brew --prefix)/opt/bison/bin:$PATH" make -j$(sysctl -n hw.logicalcpu) >/dev/null - name: make install run: sudo make install - name: Test uses: ./.github/actions/test-macos - name: Test Tracing JIT + if: matrix.test_jit uses: ./.github/actions/test-macos with: jitType: tracing runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.protect_memory=1 - name: Test OpCache uses: ./.github/actions/test-macos with: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.protect_memory=1 - name: Test Function JIT + if: matrix.test_jit uses: ./.github/actions/test-macos with: jitType: function runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.protect_memory=1 - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files - name: Notify Slack @@ -252,15 +349,36 @@ jobs: with: token: ${{ secrets.ACTION_MONITORING_SLACK }} COVERAGE_DEBUG_NTS: - if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-20.04 + if: github.repository == 'php/php-src' || github.event_name == 'workflow_dispatch' + services: + mysql: + image: mysql:8.3 + ports: + - 3306:3306 + env: + MYSQL_DATABASE: test + MYSQL_ROOT_PASSWORD: root + postgres: + image: postgres + env: + 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 uses: actions/checkout@v4 - name: Create MSSQL container uses: ./.github/actions/setup-mssql - - name: Create Oracle container - uses: ./.github/actions/setup-oracle - name: apt uses: ./.github/actions/apt-x64 - name: Install gcovr @@ -279,12 +397,16 @@ jobs: - name: Test OpCache uses: ./.github/actions/test-linux with: + jitType: tracing runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - - name: Upload Test Coverage to Codecov.io + - uses: codecov/codecov-action@v4 if: always() - run: bash <(curl -s https://codecov.io/bash) + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true - name: Notify Slack if: failure() uses: ./.github/actions/notify-slack @@ -297,9 +419,16 @@ jobs: fail-fast: false matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} - name: "${{ matrix.branch.name }}_COMMUNITY" - runs-on: ubuntu-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 @@ -313,11 +442,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 @@ -327,14 +456,50 @@ 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 + echo opcache.jit_max_side_traces=100000 >> /etc/php.d/opcache.ini + echo opcache.jit_max_exit_counters=100000 >> /etc/php.d/opcache.ini + echo opcache.jit_hot_loop=1 >> /etc/php.d/opcache.ini + 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 + php -v + - name: Test AMPHP + if: always() + run: | + repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" + X=0 + for repository in $repositories; do + printf "Testing amp/%s\n" "$repository" + git clone "https://github.com/amphp/$repository.git" "amphp-$repository" --depth 1 + cd "amphp-$repository" + git rev-parse HEAD + php /usr/bin/composer install --no-progress --ignore-platform-reqs + vendor/bin/phpunit || EXIT_CODE=$? + if [ ${EXIT_CODE:-0} -gt 128 ]; then + X=1; + fi + cd .. + done + exit $X - name: Test Laravel - if: matrix.branch.ref != 'PHP-8.0' + if: always() run: | git clone https://github.com/laravel/framework.git --branch=master --depth=1 cd framework @@ -342,13 +507,41 @@ jobs: 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("public function testSharedGet()", "#[\\PHPUnit\\Framework\\Attributes\\Group('"'"'skip'"'"')]\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=$? - if [ $EXIT_CODE -gt 128 ]; then + if [ ${EXIT_CODE:-0} -gt 128 ]; then + exit 1 + fi + - name: Test ReactPHP + if: always() + run: | + repositories="async cache child-process datagram dns event-loop promise promise-stream promise-timer stream" + X=0 + for repository in $repositories; do + printf "Testing reactphp/%s\n" "$repository" + git clone "https://github.com/reactphp/$repository.git" "reactphp-$repository" --depth 1 + cd "reactphp-$repository" + git rev-parse HEAD + php /usr/bin/composer install --no-progress --ignore-platform-reqs + vendor/bin/phpunit || EXIT_CODE=$? + if [ $[EXIT_CODE:-0} -gt 128 ]; then + X=1; + fi + cd .. + done + exit $X + - name: Test Revolt PHP + if: always() + 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 + 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' + if: always() run: | git clone https://github.com/symfony/symfony.git --depth=1 cd symfony @@ -358,13 +551,12 @@ jobs: # Test causes a heap-buffer-overflow but I cannot reproduce it locally... 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 + php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("public function testCastNonTrailingCharPointer()", "/** @group skip */\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);' 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=$? - if [ $EXIT_CODE -gt 128 ]; then + if [ ${EXIT_CODE:-0} -gt 128 ]; then X=1; fi done @@ -375,14 +567,13 @@ jobs: 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 ./phpunit || EXIT_CODE=$? - if [ $EXIT_CODE -gt 128 ]; then + if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi - name: 'Symfony Preloading' - if: matrix.branch.ref != 'PHP-8.0' + if: always() run: | php /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress --ignore-platform-reqs cd symfony_demo @@ -395,7 +586,6 @@ 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 @@ -413,12 +603,35 @@ jobs: OPCACHE_VARIATION: needs: GENERATE_MATRIX if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} + services: + mysql: + image: mysql:8.3 + ports: + - 3306:3306 + env: + MYSQL_DATABASE: test + MYSQL_ROOT_PASSWORD: root + postgres: + image: postgres + env: + 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-20.04 + runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -426,8 +639,6 @@ jobs: ref: ${{ matrix.branch.ref }} - name: Create MSSQL container uses: ./.github/actions/setup-mssql - - name: Create Oracle container - uses: ./.github/actions/setup-oracle - name: apt uses: ./.github/actions/apt-x64 - name: ./configure @@ -494,7 +705,7 @@ jobs: matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} name: "${{ matrix.branch.name }}_MSAN" - runs-on: ubuntu-22.04 + runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -546,7 +757,8 @@ jobs: --enable-werror \ --enable-memory-sanitizer \ --with-config-file-path=/etc \ - --with-config-file-scan-dir=/etc/php.d + --with-config-file-scan-dir=/etc/php.d \ + --enable-dl-test=shared - name: make run: make -j$(/usr/bin/nproc) >/dev/null - name: make install @@ -590,10 +802,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-20.04 + runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -609,30 +819,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.44-linux-glibc2.12-x86_64.tar.gz + configurationParameters: --enable-werror + libmysql: mysql-8.0.37-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.4 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.4.0-linux-glibc2.28-x86_64.tar.xz withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }} - - name: Test mysql-8.0 + - name: Test mysql-8.4 uses: ./.github/actions/test-libmysqlclient with: withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }} @@ -643,6 +846,117 @@ jobs: uses: ./.github/actions/notify-slack with: token: ${{ secrets.ACTION_MONITORING_SLACK }} + PECL: + if: github.repository == 'php/php-src' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-22.04 + env: + CC: ccache gcc + CXX: ccache g++ + steps: + - name: git checkout PHP + uses: actions/checkout@v4 + with: + path: php + - name: git checkout apcu + uses: actions/checkout@v4 + with: + repository: krakjoe/apcu + path: apcu + - name: git checkout imagick + uses: actions/checkout@v4 + with: + repository: Imagick/imagick + path: imagick + - name: git checkout memcached + uses: actions/checkout@v4 + with: + repository: php-memcached-dev/php-memcached + path: memcached + - name: git checkout redis + uses: actions/checkout@v4 + with: + repository: phpredis/phpredis + path: redis + - name: git checkout xdebug + if: false + uses: actions/checkout@v4 + with: + repository: xdebug/xdebug + path: xdebug + - name: git checkout yaml + uses: actions/checkout@v4 + with: + repository: php/pecl-file_formats-yaml + path: yaml + - name: apt + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + ccache \ + libmemcached-dev \ + bison \ + re2c + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: "${{github.job}}-${{hashFiles('php/main/php_version.h')}}" + append-timestamp: false + save: ${{ github.event_name != 'pull_request' }} + - name: build PHP + run: | + cd php + ./buildconf --force + ./configure \ + --enable-option-checking=fatal \ + --prefix=/opt/php \ + --enable-cli \ + --disable-all \ + --enable-session \ + --enable-werror + make -j$(/usr/bin/nproc) + sudo make install + - name: build apcu + run: | + cd apcu + /opt/php/bin/phpize + ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config + make -j$(/usr/bin/nproc) + - name: build imagick + run: | + cd imagick + /opt/php/bin/phpize + ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config + make -j$(/usr/bin/nproc) + - name: build memcached + run: | + cd memcached + /opt/php/bin/phpize + ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config + make -j$(/usr/bin/nproc) + - name: build redis + 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 + ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config + make -j$(/usr/bin/nproc) + - name: build yaml + run: | + cd yaml + /opt/php/bin/phpize + ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config + make -j$(/usr/bin/nproc) + - name: Notify Slack + if: failure() + uses: ./.github/actions/notify-slack + with: + token: ${{ secrets.ACTION_MONITORING_SLACK }} WINDOWS: needs: GENERATE_MATRIX if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} @@ -651,13 +965,13 @@ jobs: matrix: include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.windows-matrix-include) }} name: "${{ matrix.branch.name }}_WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - runs-on: windows-2019 + runs-on: ${{ (matrix.branch.version.minor >= 4) && 'windows-2022' || 'windows-2019' }} env: PHP_BUILD_CACHE_BASE_DIR: C:\build-cache PHP_BUILD_OBJ_DIR: C:\obj PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk - PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0 - PHP_BUILD_CRT: vs16 + PHP_BUILD_SDK_BRANCH: php-sdk-2.3.0 + PHP_BUILD_CRT: ${{ (matrix.branch.version.minor >= 4) && 'vs17' || 'vs16' }} PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }} THREAD_SAFE: "${{ matrix.zts && '1' || '0' }}" INTRINSICS: "${{ matrix.zts && 'AVX2' || '' }}"