diff --git a/.github/nightly_matrix.php b/.github/matrix.php similarity index 84% rename from .github/nightly_matrix.php rename to .github/matrix.php index acb27a5cfc1bf..161c2241a963f 100644 --- a/.github/nightly_matrix.php +++ b/.github/matrix.php @@ -1,11 +1,11 @@ 'master', 'version' => [8, 6]], - ['ref' => 'PHP-8.5', 'version' => [8, 5]], - ['ref' => 'PHP-8.4', 'version' => [8, 4]], - ['ref' => 'PHP-8.3', 'version' => [8, 3]], - ['ref' => 'PHP-8.2', 'version' => [8, 2]], + ['name' => 'master', 'ref' => 'refs/heads/master', 'version' => [8, 6]], + ['name' => 'PHP-8.5', 'ref' => 'refs/heads/PHP-8.5', 'version' => [8, 5]], + ['name' => 'PHP-8.4', 'ref' => 'refs/heads/PHP-8.4', 'version' => [8, 4]], + ['name' => 'PHP-8.3', 'ref' => 'refs/heads/PHP-8.3', 'version' => [8, 3]], + ['name' => 'PHP-8.2', 'ref' => 'refs/heads/PHP-8.2', 'version' => [8, 2]], ]; function get_branch_commit_cache_file_path(): string { @@ -46,10 +46,11 @@ function get_current_version(): array { return [$major, $minor]; } -function select_jobs($nightly, $labels, $php_version, $ref, $all_variations) { +function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $ref, $all_variations) { $no_jobs = in_array('CI: No jobs', $labels, true); $all_jobs = in_array('CI: All jobs', $labels, true) || $nightly; $test_alpine = in_array('CI: Alpine', $labels, true); + $test_benchmarking = in_array('CI: Benchmarking', $labels, true); $test_community = in_array('CI: Community', $labels, true); $test_coverage = in_array('CI: COVERAGE', $labels, true); $test_freebsd = in_array('CI: FreeBSD', $labels, true); @@ -67,13 +68,20 @@ function select_jobs($nightly, $labels, $php_version, $ref, $all_variations) { if (version_compare($php_version, '8.4', '>=') && ($all_jobs || !$no_jobs || $test_alpine)) { $jobs['ALPINE'] = true; } + if (version_compare($php_version, '8.4', '>=') + && !$nightly + && ($all_jobs || !$no_jobs || $test_benchmarking) + // push trigger is restricted to official repository. + && ($repository === 'php/php-src' || $trigger === 'pull_request')) { + $jobs['BENCHMARKING'] = true; + } if ($all_jobs || $test_community) { $jobs['COMMUNITY']['matrix'] = version_compare($php_version, '8.4', '>=') ? ['type' => ['asan', 'verify_type_inference']] : ['type' => ['asan']]; $jobs['COMMUNITY']['config']['symfony_version'] = version_compare($php_version, '8.4', '>=') ? '8.1' : '7.4'; } - if (($all_jobs && $ref === 'master') || $test_coverage) { + if (($all_jobs && $ref === 'refs/heads/master') || $test_coverage) { $jobs['COVERAGE'] = true; } if ($all_jobs || $test_libmysqlclient) { @@ -121,7 +129,7 @@ function select_jobs($nightly, $labels, $php_version, $ref, $all_variations) { if ($all_jobs || $test_opcache_variation) { $jobs['OPCACHE_VARIATION'] = true; } - if (($all_jobs && $ref === 'master') || $test_pecl) { + if (($all_jobs && $ref === 'refs/heads/master') || $test_pecl) { $jobs['PECL'] = true; } if ($all_jobs || !$no_jobs || $test_windows) { @@ -152,19 +160,21 @@ function select_jobs($nightly, $labels, $php_version, $ref, $all_variations) { if ($discard_cache) { @unlink(get_branch_commit_cache_file_path()); } -$branch = $argv[3] ?? 'master'; -$branches = $branch === 'master' +$branch = $argv[3] ?? 'refs/heads/master'; +$nightly = $trigger === 'schedule' || $trigger === 'workflow_dispatch'; +$branches = $nightly && $branch === 'refs/heads/master' ? get_branches() - : [['ref' => $branch, 'version' => get_current_version()]]; + : [['name' => 'Suite', 'ref' => $branch, 'version' => get_current_version()]]; $labels = json_decode($argv[4] ?? '[]', true) ?? []; $labels = array_column($labels, 'name'); -$nightly = $trigger === 'schedule' || $trigger === 'workflow_dispatch'; $all_variations = $nightly || in_array('CI: All variations', $labels, true); +$repository = $argv[5] ?? null; + foreach ($branches as &$branch) { $php_version = $branch['version'][0] . '.' . $branch['version'][1]; - $branch['jobs'] = select_jobs($nightly, $labels, $php_version, $branch['ref'], $all_variations); + $branch['jobs'] = select_jobs($repository, $trigger, $nightly, $labels, $php_version, $branch['ref'], $all_variations); $branch['config']['ubuntu_version'] = version_compare($php_version, '8.5', '>=') ? '24.04' : '22.04'; } diff --git a/.github/workflows/nightly-results.yml b/.github/workflows/nightly-results.yml index a222582da1c6f..fea01e1b0264d 100644 --- a/.github/workflows/nightly-results.yml +++ b/.github/workflows/nightly-results.yml @@ -2,13 +2,13 @@ name: Nightly results on: workflow_run: workflows: - - Nightly + - Test types: - completed jobs: on-failure: runs-on: ubuntu-latest - if: ${{ github.repository == 'php/php-src' && github.event.workflow_run.conclusion == 'failure' }} + if: ${{ github.repository == 'php/php-src' && github.event.workflow_run.event == 'schedule' && github.event.workflow_run.conclusion == 'failure' }} steps: - run: | export DEBIAN_FRONTEND=noninteractive diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index 7f2bcf2ca9e53..0000000000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,160 +0,0 @@ -name: Push -on: - push: - paths-ignore: &ignore_paths - - docs/** - - NEWS - - UPGRADING - - UPGRADING.INTERNALS - - '**/README.*' - - CONTRIBUTING.md - - CODING_STANDARDS.md - - .cirrus.yml - - .circleci/** - branches: - - PHP-8.2 - - PHP-8.3 - - PHP-8.4 - - PHP-8.5 - - master - pull_request: - paths-ignore: *ignore_paths - branches: - - '**' - workflow_dispatch: ~ -permissions: - contents: read -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.url || github.run_id }} - cancel-in-progress: true -env: - CC: ccache gcc - CXX: ccache g++ -jobs: - GENERATE_MATRIX: - name: Generate Matrix - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' - runs-on: ubuntu-latest - outputs: - all_variations: ${{ steps.set-matrix.outputs.all_variations }} - branches: ${{ steps.set-matrix.outputs.branches }} - steps: - - uses: actions/checkout@v6 - - name: Generate Matrix - id: set-matrix - run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.ref }}" '${{ toJSON(github.event.pull_request.labels) }}' - PUSH: - needs: GENERATE_MATRIX - name: ${{ matrix.branch.ref }} - uses: ./.github/workflows/nightly.yml - strategy: - fail-fast: false - matrix: - branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} - with: - all_variations: ${{ needs.GENERATE_MATRIX.outputs.all_variations == 'true' }} - branch: ${{ toJSON(matrix.branch) }} - secrets: inherit - BENCHMARKING: - name: BENCHMARKING - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' - runs-on: ubuntu-24.04 - timeout-minutes: 50 - steps: - - name: git checkout - uses: actions/checkout@v6 - with: - fetch-depth: 0 - # ASLR can cause a lot of noise due to missed sse opportunities for memcpy - # and other operations, so we disable it during benchmarking. - - name: Disable ASLR - run: echo 0 | sudo tee /proc/sys/kernel/randomize_va_space - - name: apt - run: | - set -x - sudo apt-get update - sudo apt-get install \ - bison \ - libgmp-dev \ - libonig-dev \ - libsqlite3-dev \ - openssl \ - re2c \ - valgrind - - name: ccache - uses: ./.github/actions/ccache - with: - name: "${{ github.job }}" - - name: ./configure - run: | - set -x - ./buildconf --force - ./configure \ - --disable-debug \ - --enable-mbstring \ - --enable-option-checking=fatal \ - --enable-sockets \ - --enable-werror \ - --prefix=/usr \ - --with-config-file-scan-dir=/etc/php.d \ - --with-gmp \ - --with-mysqli=mysqlnd \ - --with-openssl \ - --with-pdo-sqlite \ - --with-valgrind - - name: make - run: make -j$(/usr/bin/nproc) >/dev/null - - name: make install - run: | - set -x - sudo make install - sudo mkdir -p /etc/php.d - sudo chmod 777 /etc/php.d - echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini - echo opcache.enable=1 >> /etc/php.d/opcache.ini - echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini - - name: Setup - run: | - git config --global user.name "Benchmark" - git config --global user.email "benchmark@php.net" - sudo service mysql start - mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS wordpress" - mysql -uroot -proot -e "CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress'; FLUSH PRIVILEGES;" - mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'wordpress'@'localhost' WITH GRANT OPTION;" - - name: git checkout benchmarking-data - uses: actions/checkout@v6 - with: - repository: php/benchmarking-data - ssh-key: ${{ secrets.BENCHMARKING_DATA_DEPLOY_KEY }} - path: benchmark/repos/data - - name: Benchmark - run: php benchmark/benchmark.php true - - name: Store result - if: github.event_name == 'push' - run: | - set -x - cd benchmark/repos/data - git pull --autostash - if [ -e ".git/MERGE_HEAD" ]; then - echo "Merging, can't proceed" - exit 1 - fi - git add . - if git diff --cached --quiet; then - exit 0 - fi - git commit -m "Add result for ${{ github.repository }}@${{ github.sha }}" - git push - - name: Show diff - if: github.event_name == 'pull_request' - run: |- - set -x - php benchmark/generate_diff.php \ - ${{ github.sha }} \ - $(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) \ - > $GITHUB_STEP_SUMMARY - - uses: actions/upload-artifact@v6 - with: - name: profiles - path: ${{ github.workspace }}/benchmark/profiles - retention-days: 30 diff --git a/.github/workflows/root.yml b/.github/workflows/root.yml deleted file mode 100644 index 9a47d5ceec4b9..0000000000000 --- a/.github/workflows/root.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Nightly -on: - schedule: - - cron: "0 1 * * *" - workflow_dispatch: ~ -permissions: - contents: read -jobs: - GENERATE_MATRIX: - name: Generate Matrix - if: github.repository == 'php/php-src' || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - outputs: - all_variations: ${{ steps.set-matrix.outputs.all_variations }} - branches: ${{ steps.set-matrix.outputs.branches }} - steps: - - uses: actions/checkout@v6 - with: - # Set fetch-depth to 0 to clone the full repository - # including all branches. This is required to find - # the correct commit hashes. - fetch-depth: 0 - - name: Grab the commit mapping - uses: actions/cache@v5 - with: - path: branch-commit-cache.json - # The cache key needs to change every time for the - # cache to be updated after this job finishes. - key: nightly-${{ github.run_id }}-${{ github.run_attempt }} - restore-keys: | - nightly- - - name: Generate Matrix - id: set-matrix - run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.head_ref || github.ref_name }}" '[]' - NIGHTLY: - needs: GENERATE_MATRIX - name: ${{ matrix.branch.ref }} - if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} - uses: ./.github/workflows/nightly.yml - strategy: - fail-fast: false - matrix: - branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} - with: - all_variations: ${{ needs.GENERATE_MATRIX.outputs.all_variations == 'true' }} - branch: ${{ toJSON(matrix.branch) }} - secrets: inherit diff --git a/.github/workflows/nightly.yml b/.github/workflows/test-suite.yml similarity index 90% rename from .github/workflows/nightly.yml rename to .github/workflows/test-suite.yml index 4fffc701f9260..97d28253f546f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/test-suite.yml @@ -964,3 +964,107 @@ jobs: configurationParameters: >- --${{ matrix.zts && 'enable' || 'disable' }}-zts runExtraTests: true + BENCHMARKING: + name: BENCHMARKING + if: ${{ fromJson(inputs.branch).jobs.BENCHMARKING }} + runs-on: ubuntu-${{ fromJson(inputs.branch).config.ubuntu_version }} + timeout-minutes: 50 + steps: + - name: git checkout + uses: actions/checkout@v6 + with: + ref: ${{ fromJson(inputs.branch).ref }} + fetch-depth: 0 + # ASLR can cause a lot of noise due to missed sse opportunities for memcpy + # and other operations, so we disable it during benchmarking. + - name: Disable ASLR + run: echo 0 | sudo tee /proc/sys/kernel/randomize_va_space + - name: apt + run: | + set -x + sudo apt-get update + sudo apt-get install \ + bison \ + libgmp-dev \ + libonig-dev \ + libsqlite3-dev \ + openssl \ + re2c \ + valgrind + - name: ccache + uses: ./.github/actions/ccache + with: + name: "${{ github.job }}" + - name: ./configure + run: | + set -x + ./buildconf --force + ./configure \ + --disable-debug \ + --enable-mbstring \ + --enable-option-checking=fatal \ + --enable-sockets \ + --enable-werror \ + --prefix=/usr \ + --with-config-file-scan-dir=/etc/php.d \ + --with-gmp \ + --with-mysqli=mysqlnd \ + --with-openssl \ + --with-pdo-sqlite \ + --with-valgrind + - name: make + run: make -j$(/usr/bin/nproc) >/dev/null + - name: make install + run: | + set -x + sudo make install + sudo mkdir -p /etc/php.d + sudo chmod 777 /etc/php.d + echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini + echo opcache.enable=1 >> /etc/php.d/opcache.ini + echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini + - name: Setup + run: | + git config --global user.name "Benchmark" + git config --global user.email "benchmark@php.net" + sudo service mysql start + mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS wordpress" + mysql -uroot -proot -e "CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress'; FLUSH PRIVILEGES;" + mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'wordpress'@'localhost' WITH GRANT OPTION;" + - name: git checkout benchmarking-data + uses: actions/checkout@v6 + with: + repository: php/benchmarking-data + ssh-key: ${{ secrets.BENCHMARKING_DATA_DEPLOY_KEY }} + path: benchmark/repos/data + - name: Benchmark + run: php benchmark/benchmark.php true + - name: Store result + if: github.event_name == 'push' + run: | + set -x + cd benchmark/repos/data + git pull --autostash + if [ -e ".git/MERGE_HEAD" ]; then + echo "Merging, can't proceed" + exit 1 + fi + git add . + if git diff --cached --quiet; then + exit 0 + fi + git commit -m "Add result for ${{ github.repository }}@${{ github.sha }}" + git push + - name: Show diff + if: github.event_name == 'pull_request' + run: |- + set -x + php benchmark/generate_diff.php \ + ${{ github.sha }} \ + $(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) \ + > $GITHUB_STEP_SUMMARY + - uses: actions/upload-artifact@v6 + with: + name: profiles + path: ${{ github.workspace }}/benchmark/profiles + retention-days: 30 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000000..4c99f5809b453 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,74 @@ +name: Test +on: + push: + paths-ignore: &ignore_paths + - docs/** + - NEWS + - UPGRADING + - UPGRADING.INTERNALS + - '**/README.*' + - CONTRIBUTING.md + - CODING_STANDARDS.md + - .cirrus.yml + - .circleci/** + branches: + - PHP-8.2 + - PHP-8.3 + - PHP-8.4 + - PHP-8.5 + - master + pull_request: + paths-ignore: *ignore_paths + branches: + - '**' + schedule: + - cron: "0 1 * * *" + workflow_dispatch: ~ +permissions: + contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.url || github.run_id }} + cancel-in-progress: true +env: + CC: ccache gcc + CXX: ccache g++ +jobs: + GENERATE_MATRIX: + name: Generate Matrix + if: github.repository == 'php/php-src' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + outputs: + all_variations: ${{ steps.set-matrix.outputs.all_variations }} + branches: ${{ steps.set-matrix.outputs.branches }} + steps: + - uses: actions/checkout@v6 + with: + # When running nightly, set fetch-depth to 0 to clone the full + # repository including all branches. This is required to find the + # correct commit hashes. + fetch-depth: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && 0 || 1 }} + - name: Grab the commit mapping + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + uses: actions/cache@v5 + with: + path: branch-commit-cache.json + # The cache key needs to change every time for the + # cache to be updated after this job finishes. + key: nightly-${{ github.run_id }}-${{ github.run_attempt }} + restore-keys: | + nightly- + - name: Generate Matrix + id: set-matrix + run: php .github/matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.ref }}" '${{ toJSON(github.event.pull_request.labels) }}' "${{ github.repository }}" + PUSH: + needs: GENERATE_MATRIX + name: ${{ matrix.branch.name }} + uses: ./.github/workflows/test-suite.yml + strategy: + fail-fast: false + matrix: + branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} + with: + all_variations: ${{ needs.GENERATE_MATRIX.outputs.all_variations == 'true' }} + branch: ${{ toJSON(matrix.branch) }} + secrets: inherit diff --git a/EXTENSIONS b/EXTENSIONS index 4f018bfeb2de9..2eec7726c12c4 100644 --- a/EXTENSIONS +++ b/EXTENSIONS @@ -420,7 +420,7 @@ STATUS: Working ------------------------------------------------------------------------------- EXTENSION: random PRIMARY MAINTAINER Go Kudo (2022 - 2024) - Tim Düsterhus (2022 - 2025) + Tim Düsterhus (2022 - 2026) MAINTENANCE: Maintained STATUS: Working SINCE: 8.2.0 @@ -507,7 +507,7 @@ STATUS: Working ------------------------------------------------------------------------------- EXTENSION: uri PRIMARY MAINTAINER Máté Kocsis (2025 - 2025) - Tim Düsterhus (2025 - 2025) + Tim Düsterhus (2025 - 2026) MAINTENANCE: Maintained STATUS: Working SINCE: 8.5.0 diff --git a/docs/release-process.md b/docs/release-process.md index e5a1dd1f658ba..2ce20355e4944 100644 --- a/docs/release-process.md +++ b/docs/release-process.md @@ -983,7 +983,7 @@ feature development that cannot go into the new version. applicable files there to reflect the branch cut, and then upmerge that commit 5 times to get it to `master`. The following files need to be updated: - * `.github/nightly_matrix.php` (add new branch, update version for `master`) + * `.github/matrix.php` (add new branch, update version for `master`) [Updating after 8.5 branch cut](https://github.com/php/php-src/commit/197921a8aa7b2f9af103b439bf913e23d6ed1b98) * `.github/scripts/windows/find-target-branch.bat` (update version for `master`) diff --git a/ext/sqlite3/tests/sqlite3_11_numrows.phpt b/ext/sqlite3/tests/sqlite3_11_numrows.phpt deleted file mode 100644 index 29faea68f8eb2..0000000000000 --- a/ext/sqlite3/tests/sqlite3_11_numrows.phpt +++ /dev/null @@ -1,48 +0,0 @@ ---TEST-- -SQLite3::prepare number of rows ---EXTENSIONS-- -sqlite3 ---SKIPIF-- - ---FILE-- -exec('CREATE TABLE test (time INTEGER, id STRING)')); - -echo "INSERT into table\n"; -var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'a')")); -var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')")); - -echo "SELECTING results\n"; -$results = $db->query("SELECT * FROM test ORDER BY id ASC"); -echo "Number of rows\n"; -var_dump($results->numRows()); -$results->finalize(); - -echo "Closing database\n"; -var_dump($db->close()); -echo "Done\n"; -?> ---EXPECT-- -Creating Table -bool(true) -INSERT into table -bool(true) -bool(true) -SELECTING results -Number of rows -int(2) -Closing database -bool(true) -Done