diff --git a/.github/actions/ccache/action.yml b/.github/actions/ccache/action.yml new file mode 100644 index 0000000000000..fbd8691c927e2 --- /dev/null +++ b/.github/actions/ccache/action.yml @@ -0,0 +1,13 @@ +name: ccache +inputs: + name: + required: true +runs: + using: composite + steps: + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: "${{ inputs.name }}-${{ hashFiles('main/php_version.h') }}" + append-timestamp: false + save: ${{ github.event_name != 'pull_request' }} diff --git a/.github/nightly_matrix.php b/.github/nightly_matrix.php index 0032da7dbcea8..8e4e9e7606e2f 100644 --- a/.github/nightly_matrix.php +++ b/.github/nightly_matrix.php @@ -46,6 +46,101 @@ function get_current_version(): array { return [$major, $minor]; } +function select_jobs($trigger, $labels, $php_version, $ref, $all_variations) { + $no_jobs = in_array('CI: No jobs', $labels, true); + $all_jobs = in_array('CI: All jobs', $labels, true); + $test_alpine = in_array('CI: Alpine', $labels, true); + $test_community = in_array('CI: Community', $labels, true); + $test_freebsd = in_array('CI: FreeBSD', $labels, true); + $test_libmysqlclient = in_array('CI: libmysqlclient', $labels, true); + $test_linux_ppc64 = in_array('CI: Linux PPC64', $labels, true); + $test_linux_x32 = in_array('CI: Linux X32', $labels, true); + $test_linux_x64 = in_array('CI: Linux X64', $labels, true); + $test_macos = in_array('CI: macOS', $labels, true); + $test_msan = in_array('CI: MSAN', $labels, true); + $test_opcache_variation = in_array('CI: Opcache Variation', $labels, true); + $test_windows = in_array('CI: Windows', $labels, true); + + $jobs = []; + if (version_compare($php_version, '8.4', '>=') && ($all_jobs || !$no_jobs || $test_alpine)) { + $jobs['ALPINE'] = 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 ($trigger === 'schedule' && $ref === 'master') { + $jobs['COVERAGE'] = true; + } + if ($all_jobs || $test_libmysqlclient) { + $jobs['LIBMYSQLCLIENT'] = true; + } + if (version_compare($php_version, '8.4', '>=') && ($all_jobs || $test_linux_ppc64)) { + $jobs['LINUX_PPC64'] = true; + } + if ($all_jobs || !$no_jobs || $test_linux_x64) { + $jobs['LINUX_X64']['matrix'] = $all_variations + ? [ + 'name' => [''], + 'asan' => [false], + 'debug' => [true, false], + 'repeat' => [false], + 'variation' => [false], + 'zts' => [true, false], + 'include' => [ + ['name' => '_ASAN', 'asan' => true, 'debug' => true, 'repeat' => false, 'variation' => false, 'zts' => true], + ['name' => '_REPEAT', 'asan' => false, 'debug' => true, 'repeat' => true, 'variation' => false, 'zts' => false], + ['name' => '_VARIATION', 'asan' => false, 'debug' => true, 'repeat' => false, 'variation' => true, 'zts' => true], + ], + ] + : ['include' => [ + ['name' => '', 'asan' => false, 'debug' => false, 'repeat' => false, 'variation' => false, 'zts' => false], + ['name' => '_ASAN', 'asan' => true, 'debug' => true, 'repeat' => false, 'variation' => false, 'zts' => true], + ]]; + $jobs['LINUX_X64']['config']['variation_enable_zend_max_execution_timers'] = version_compare($php_version, '8.3', '>='); + } + if ($all_jobs || !$no_jobs || $test_linux_x32) { + $jobs['LINUX_X32']['matrix'] = $all_variations + ? ['debug' => [true, false], 'zts' => [true, false]] + : ['debug' => [true], 'zts' => [true]]; + } + if ($all_jobs || !$no_jobs || $test_macos) { + $test_arm = version_compare($php_version, '8.4', '>='); + $jobs['MACOS']['matrix'] = $all_variations + ? ['arch' => $test_arm ? ['X64', 'ARM64'] : ['X64'], 'debug' => [true, false], 'zts' => [true, false]] + : ['include' => [['arch' => $test_arm ? 'ARM64' : 'X64', 'debug' => true, 'zts' => false]]]; + $jobs['MACOS']['config']['arm64_version'] = version_compare($php_version, '8.4', '>=') ? '15' : '14'; + } + if ($all_jobs || $test_msan) { + $jobs['MSAN'] = true; + } + if ($all_jobs || $test_opcache_variation) { + $jobs['OPCACHE_VARIATION'] = true; + } + if ($trigger === 'schedule' && $ref === 'master') { + $jobs['PECL'] = true; + } + if ($all_jobs || !$no_jobs || $test_windows) { + $jobs['WINDOWS']['matrix'] = $all_variations + ? ['include' => [ + ['asan' => true, 'opcache' => true, 'x64' => true, 'zts' => true], + ['asan' => false, 'opcache' => false, 'x64' => false, 'zts' => false], + ]] + : ['include' => [['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true]]]; + $jobs['WINDOWS']['config'] = version_compare($php_version, '8.4', '>=') + ? ['vs_crt_version' => 'vs17'] + : ['vs_crt_version' => 'vs16']; + } + if ($all_jobs || !$no_jobs || $test_freebsd) { + $jobs['FREEBSD']['matrix'] = $all_variations && version_compare($php_version, '8.3', '>=') + ? ['zts' => [true, false]] + : ['zts' => [false]]; + } + return $jobs; +} + $trigger = $argv[1] ?? 'schedule'; $attempt = (int) ($argv[2] ?? 1); $sunday = date('w', time()) === '0'; @@ -60,6 +155,25 @@ function get_current_version(): array { ? get_branches() : [['ref' => $branch, 'version' => get_current_version()]]; -$f = fopen(getenv('GITHUB_OUTPUT'), 'a'); -fwrite($f, 'branches=' . json_encode($branches, JSON_UNESCAPED_SLASHES) . "\n"); -fclose($f); +$labels = json_decode($argv[4] ?? '[]', true); +$labels = array_column($labels, 'name'); +$all_variations = $trigger === 'schedule' || $trigger === 'workflow_dispatch' || in_array('CI: All variations', $labels, true); + +foreach ($branches as &$branch) { + $php_version = $branch['version'][0] . '.' . $branch['version'][1]; + $branch['jobs'] = select_jobs($trigger, $labels, $php_version, $branch['ref'], $all_variations); + $branch['config']['ubuntu_version'] = version_compare($php_version, '8.5', '>=') ? '24.04' : '22.04'; +} + +echo "All variations:"; +echo json_encode($all_variations, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); +echo "\n\nBranches:\n"; +echo json_encode($branches, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); +echo "\n"; + +if (false !== ($github_output = getenv('GITHUB_OUTPUT'))) { + $f = fopen($github_output, 'a'); + fwrite($f, 'branches=' . json_encode($branches, JSON_UNESCAPED_SLASHES) . "\n"); + fwrite($f, 'all_variations=' . json_encode($all_variations, JSON_UNESCAPED_SLASHES) . "\n"); + fclose($f); +} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 97064ad3972d0..dc0f8d3e3b5ff 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -2,64 +2,25 @@ name: Test suite on: workflow_call: inputs: - asan_ubuntu_version: - required: true - type: string - branch: - required: true - type: string - community_verify_type_inference: - required: true - type: boolean - macos_arm64_version: - required: true - type: string - run_alpine: - required: true - type: boolean - run_linux_ppc64: + all_variations: required: true type: boolean - run_macos_arm64: - required: true - type: boolean - run_freebsd_zts: - required: true - type: boolean - ubuntu_version: - required: true - type: string - windows_version: - required: true - type: string - vs_crt_version: - required: true - type: string - skip_laravel: - required: true - type: boolean - symfony_version: + branch: required: true type: string - skip_wordpress: - required: true - type: boolean - variation_enable_zend_max_execution_timers: - required: true - type: boolean permissions: contents: read jobs: LINUX_PPC64: - if: inputs.run_linux_ppc64 - name: LINUX_PPC64_ASAN_UBSAN_DEBUG_ZTS + if: fromJson(inputs.branch).jobs.LINUX_PPC64 + name: LINUX_PPC64_ASAN_DEBUG_ZTS # This runs on a self-hosted runner; see https://wiki.php.net/systems/ci runs-on: [self-hosted, gentoo, ppc64] steps: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: System info run: | echo "::group::Show host CPU info" @@ -91,8 +52,8 @@ jobs: - name: Extra tests uses: ./.github/actions/extra-tests ALPINE: - if: inputs.run_alpine - name: ALPINE_X64_ASAN_UBSAN_DEBUG_ZTS + if: fromJson(inputs.branch).jobs.ALPINE + name: ALPINE_X64_ASAN_DEBUG_ZTS runs-on: ubuntu-24.04 container: image: 'alpine:3.22' @@ -100,7 +61,7 @@ jobs: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: apk uses: ./.github/actions/apk - name: System info @@ -136,6 +97,7 @@ jobs: - name: Extra tests uses: ./.github/actions/extra-tests LINUX_X64: + if: fromJson(inputs.branch).jobs.LINUX_X64 services: mysql: image: mysql:8.4 @@ -161,47 +123,14 @@ jobs: FIREBIRD_PASSWORD: test strategy: fail-fast: false - matrix: - configuration_parameters: [''] - debug: [true, false] - name: [''] - run_tests_parameters: [''] - test_function_jit: [true] - zts: [true, false] - include: - - name: _ASAN_UBSAN - 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 - asan: true - - name: _REPEAT - debug: true - zts: false - run_tests_parameters: --repeat 2 - timeout_minutes: 360 - test_function_jit: true - asan: false - - name: _VARIATION - debug: true - zts: true - configuration_parameters: >- - CFLAGS="-DZEND_RC_DEBUG=1 -DPROFITABILITY_CHECKS=0 -DZEND_VERIFY_FUNC_INFO=1 -DZEND_VERIFY_TYPE_INFERENCE" - ${{ inputs.variation_enable_zend_max_execution_timers && '--enable-zend-max-execution-timers' || '' }} - 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 + matrix: ${{ fromJson(inputs.branch).jobs.LINUX_X64.matrix }} name: "LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - runs-on: ubuntu-${{ matrix.asan && inputs.asan_ubuntu_version || inputs.ubuntu_version }} + runs-on: ubuntu-${{ fromJson(inputs.branch).config.ubuntu_version }} steps: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: Create MSSQL container uses: ./.github/actions/setup-mssql - name: apt @@ -216,64 +145,90 @@ jobs: echo "::group::Show installed package versions" dpkg -l echo "::endgroup::" + - name: Setup Caddy server + uses: ./.github/actions/setup-caddy + - name: ccache + uses: ./.github/actions/ccache + with: + # This duplicates the "job.name" expression above because + # GitHub has no way to query the job name (github.job is the + # job id, not the job name) + name: "LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - name: ./configure uses: ./.github/actions/configure-x64 with: configurationParameters: >- - ${{ matrix.configuration_parameters }} + ${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address"' || '' }} + ${{ matrix.variation && 'CFLAGS="-DZEND_RC_DEBUG=1 -DPROFITABILITY_CHECKS=0 -DZEND_VERIFY_FUNC_INFO=1 -DZEND_VERIFY_TYPE_INFERENCE"' || '' }} + ${{ (matrix.variation && fromJson(inputs.branch).jobs.LINUX_X64.config.variation_enable_zend_max_execution_timers) && '--enable-zend-max-execution-timers' || '' }} --${{ matrix.debug && 'enable' || 'disable' }}-debug + ${{ matrix.debug && 'CXXFLAGS="-D_GLIBCXX_ASSERTIONS"' || '' }} --${{ matrix.zts && 'enable' || 'disable' }}-zts asan: ${{ matrix.asan && 'true' || 'false' }} + skipSlow: ${{ (matrix.asan && !inputs.all_variations) && 'true' || 'false' }} - name: make run: make -j$(/usr/bin/nproc) >/dev/null - name: make install uses: ./.github/actions/install-linux - name: Setup + if: ${{ !matrix.asan || inputs.all_variations }} uses: ./.github/actions/setup-x64 - name: Test + if: ${{ inputs.all_variations || !matrix.asan }} uses: ./.github/actions/test-linux with: runTestsParameters: >- - ${{ matrix.run_tests_parameters }} + ${{ matrix.asan && '--asan' || '' }} + ${{ matrix.repeat && '--repeat 2' || '' }} + ${{ matrix.variation && '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0' || '' }} idleCpu: ${{ matrix.asan && 'true' || 'false' }} - name: Test Tracing JIT uses: ./.github/actions/test-linux with: jitType: tracing runTestsParameters: >- - ${{ matrix.run_tests_parameters }} + ${{ matrix.asan && '--asan' || '' }} + ${{ (matrix.asan && !inputs.all_variations) && '-x' || '' }} + ${{ matrix.repeat && '--repeat 2' || '' }} + ${{ matrix.variation && '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0' || '' }} -d opcache.enable_cli=1 - name: Test OpCache + if: ${{ inputs.all_variations }} uses: ./.github/actions/test-linux with: runTestsParameters: >- - ${{ matrix.run_tests_parameters }} + ${{ matrix.asan && '--asan' || '' }} + ${{ matrix.repeat && '--repeat 2' || '' }} + ${{ matrix.variation && '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0' || '' }} -d opcache.enable_cli=1 - name: Test Function JIT # ASAN frequently timeouts. Each test run takes ~90 minutes, we can # avoid running into the 6 hour timeout by skipping the function JIT. - if: matrix.test_function_jit + if: ${{ inputs.all_variations && !matrix.asan }} uses: ./.github/actions/test-linux with: jitType: function runTestsParameters: >- - ${{ matrix.run_tests_parameters }} + ${{ matrix.repeat && '--repeat 2' || '' }} + ${{ matrix.variation && '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0' || '' }} -d opcache.enable_cli=1 - name: Extra tests uses: ./.github/actions/extra-tests - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files LINUX_X32: + if: fromJson(inputs.branch).jobs.LINUX_X32 strategy: fail-fast: false - matrix: - debug: [true, false] - zts: [true, false] + matrix: ${{ fromJson(inputs.branch).jobs.LINUX_X32.matrix }} name: "LINUX_X32_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" runs-on: ubuntu-latest container: - image: ubuntu:${{ inputs.ubuntu_version }} + image: ubuntu:${{ fromJson(inputs.branch).config.ubuntu_version }} env: + MYSQL_TEST_HOST: mysql + PDO_MYSQL_TEST_DSN: mysql:host=mysql;dbname=test + PDO_MYSQL_TEST_HOST: mysql PDO_FIREBIRD_TEST_DSN: firebird:dbname=firebird:test.fdb services: mysql: @@ -296,9 +251,13 @@ jobs: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: apt uses: ./.github/actions/apt-x32 + - name: ccache + uses: ./.github/actions/ccache + with: + name: "LINUX_X32_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - name: System info run: | echo "::group::Show host CPU info" @@ -318,53 +277,50 @@ jobs: - name: make install uses: ./.github/actions/install-linux-x32 - name: Test + if: ${{ inputs.all_variations }} uses: ./.github/actions/test-linux - with: - runTestsParameters: >- - ${{ matrix.run_tests_parameters }} - name: Test Tracing JIT uses: ./.github/actions/test-linux with: jitType: tracing runTestsParameters: >- - ${{ matrix.run_tests_parameters }} -d opcache.enable_cli=1 - name: Test OpCache + if: ${{ inputs.all_variations }} uses: ./.github/actions/test-linux with: runTestsParameters: >- - ${{ matrix.run_tests_parameters }} -d opcache.enable_cli=1 - name: Test Function JIT + if: ${{ inputs.all_variations }} uses: ./.github/actions/test-linux with: jitType: function runTestsParameters: >- - ${{ matrix.run_tests_parameters }} -d opcache.enable_cli=1 - name: Extra tests uses: ./.github/actions/extra-tests MACOS: + if: fromJson(inputs.branch).jobs.MACOS strategy: fail-fast: false - matrix: - debug: [true, false] - zts: [true, false] - arch: ['X64', 'ARM64'] - exclude: - - arch: ${{ !inputs.run_macos_arm64 && 'ARM64' || '*never*' }} + matrix: ${{ fromJson(inputs.branch).jobs.MACOS.matrix }} name: "MACOS_${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - runs-on: macos-${{ matrix.arch == 'X64' && '15-intel' || inputs.macos_arm64_version }} + runs-on: macos-${{ matrix.arch == 'X64' && '15-intel' || fromJson(inputs.branch).jobs.MACOS.config.arm64_version }} steps: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: Update clang uses: ./.github/actions/macos-update-clang - name: brew timeout-minutes: 10 uses: ./.github/actions/brew + - name: ccache + uses: ./.github/actions/ccache + with: + name: "MACOS_${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - name: ./configure uses: ./.github/actions/configure-macos with: @@ -378,6 +334,7 @@ jobs: - name: make install run: sudo make install - name: Test + if: ${{ inputs.all_variations }} uses: ./.github/actions/test-macos - name: Test Tracing JIT if: matrix.arch == 'X64' || !matrix.zts @@ -387,12 +344,13 @@ jobs: runTestsParameters: >- -d opcache.enable_cli=1 - name: Test OpCache + if: ${{ inputs.all_variations || (matrix.arch == 'ARM64' && matrix.zts) }} uses: ./.github/actions/test-macos with: runTestsParameters: >- -d opcache.enable_cli=1 - name: Test Function JIT - if: matrix.arch == 'X64' || !matrix.zts + if: inputs.all_variations && (matrix.arch == 'X64' || !matrix.zts) uses: ./.github/actions/test-macos with: jitType: function @@ -402,8 +360,8 @@ jobs: uses: ./.github/actions/extra-tests - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files - COVERAGE_DEBUG_NTS: - if: inputs.branch == 'master' + COVERAGE: + if: fromJson(inputs.branch).jobs.COVERAGE services: mysql: image: mysql:8.4 @@ -432,7 +390,7 @@ jobs: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: Create MSSQL container uses: ./.github/actions/setup-mssql - name: apt @@ -463,14 +421,12 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} verbose: true COMMUNITY: + if: fromJson(inputs.branch).jobs.COMMUNITY strategy: fail-fast: false - matrix: - type: ['asan', 'verify_type_inference'] - exclude: - - type: ${{ !inputs.community_verify_type_inference && 'verify_type_inference' || '*never*' }} + matrix: ${{ fromJson(inputs.branch).jobs.COMMUNITY.matrix }} name: "COMMUNITY_${{ matrix.type }}" - runs-on: ubuntu-${{ inputs.ubuntu_version }} + runs-on: ubuntu-${{ fromJson(inputs.branch).config.ubuntu_version }} env: ASAN_OPTIONS: exitcode=139 UBSAN_OPTIONS: print_stacktrace=1 @@ -480,7 +436,7 @@ jobs: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: apt uses: ./.github/actions/apt-x64 - name: ./configure @@ -545,7 +501,7 @@ jobs: done exit $X - name: Test Laravel - if: ${{ !cancelled() && !inputs.skip_laravel }} + if: ${{ !cancelled() }} run: | git clone https://github.com/laravel/framework.git --depth=1 cd framework @@ -590,9 +546,9 @@ jobs: exit 1 fi - name: Test Symfony - if: ${{ !cancelled() && inputs.symfony_version != '' }} + if: ${{ !cancelled() }} run: | - git clone https://github.com/symfony/symfony.git --depth=1 --branch="${{ inputs.symfony_version }}" + git clone https://github.com/symfony/symfony.git --depth=1 --branch="${{ fromJson(inputs.branch).jobs.COMMUNITY.config.symfony_version }}" cd symfony git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-req=php+ @@ -627,7 +583,7 @@ jobs: fi - name: 'Symfony Preloading' # composer create-project will automatically pick the right Symfony version for us. - if: ${{ !cancelled() && inputs.symfony_version != '' }} + if: ${{ !cancelled() }} run: | php /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress --ignore-platform-req=php+ cd symfony_demo @@ -635,7 +591,7 @@ jobs: sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php - name: Test Wordpress - if: ${{ !cancelled() && !inputs.skip_wordpress }} + if: ${{ !cancelled() }} run: | git clone https://github.com/WordPress/wordpress-develop.git wordpress --depth=1 cd wordpress @@ -650,6 +606,7 @@ jobs: exit 1 fi OPCACHE_VARIATION: + if: fromJson(inputs.branch).jobs.OPCACHE_VARIATION services: mysql: image: mysql:8.4 @@ -674,12 +631,12 @@ jobs: FIREBIRD_USER: test FIREBIRD_PASSWORD: test name: OPCACHE_VARIATION - runs-on: ubuntu-${{ inputs.ubuntu_version }} + runs-on: ubuntu-${{ fromJson(inputs.branch).config.ubuntu_version }} steps: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: Create MSSQL container uses: ./.github/actions/setup-mssql - name: apt @@ -731,13 +688,14 @@ jobs: - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files MSAN: + if: fromJson(inputs.branch).jobs.MSAN name: MSAN - runs-on: ubuntu-${{ inputs.ubuntu_version }} + runs-on: ubuntu-${{ fromJson(inputs.branch).config.ubuntu_version }} steps: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: apt uses: ./.github/actions/apt-x64 - name: ./configure @@ -817,13 +775,14 @@ jobs: - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files LIBMYSQLCLIENT: + if: fromJson(inputs.branch).jobs.LIBMYSQLCLIENT name: LIBMYSQLCLIENT - runs-on: ubuntu-${{ inputs.ubuntu_version }} + runs-on: ubuntu-${{ fromJson(inputs.branch).config.ubuntu_version }} steps: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: apt run: | sudo apt-get update -y | true @@ -851,7 +810,7 @@ jobs: - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files PECL: - if: inputs.branch == 'master' + if: fromJson(inputs.branch).jobs.PECL runs-on: ubuntu-24.04 env: CC: ccache gcc @@ -861,7 +820,7 @@ jobs: uses: actions/checkout@v6 with: path: php - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: git checkout apcu uses: actions/checkout@v6 with: @@ -904,11 +863,9 @@ jobs: bison \ re2c - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 + uses: ./.github/actions/ccache with: - key: "${{github.job}}-${{hashFiles('php/main/php_version.h')}}" - append-timestamp: false - save: ${{ github.event_name != 'pull_request' }} + name: "${{ github.job }}" - name: build PHP run: | cd php @@ -960,32 +917,18 @@ jobs: ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config make -j$(/usr/bin/nproc) WINDOWS: + if: fromJson(inputs.branch).jobs.WINDOWS strategy: fail-fast: false - matrix: - include: - - x64: true - zts: true - opcache: true - asan: false - - x64: false - zts: false - opcache: false - asan: false - - x64: true - zts: true - opcache: true - asan: true - branch: 'master' - timeout: 120 + matrix: ${{ fromJson(inputs.branch).jobs.WINDOWS.matrix }} name: "WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || ''}}" - runs-on: windows-${{ inputs.windows_version }} + runs-on: windows-2022 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.5.0 - PHP_BUILD_CRT: ${{ inputs.vs_crt_version }} + PHP_BUILD_CRT: ${{ fromJson(inputs.branch).jobs.WINDOWS.config.vs_crt_version }} PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }} THREAD_SAFE: "${{ matrix.zts && '1' || '0' }}" INTRINSICS: "${{ matrix.zts && 'AVX2' || '' }}" @@ -998,7 +941,7 @@ jobs: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: Setup uses: ./.github/actions/setup-windows - name: Build @@ -1006,12 +949,10 @@ jobs: - name: Test run: .github/scripts/windows/test.bat FREEBSD: + if: fromJson(inputs.branch).jobs.FREEBSD strategy: fail-fast: false - matrix: - zts: [true, false] - exclude: - - zts: ${{ !inputs.run_freebsd_zts && true || '*never*' }} + matrix: ${{ fromJson(inputs.branch).jobs.FREEBSD.matrix }} name: "FREEBSD_${{ matrix.zts && 'ZTS' || 'NTS' }}" runs-on: ubuntu-latest timeout-minutes: 50 @@ -1019,7 +960,7 @@ jobs: - name: git checkout uses: actions/checkout@v6 with: - ref: ${{ inputs.branch }} + ref: ${{ fromJson(inputs.branch).ref }} - name: FreeBSD uses: ./.github/actions/freebsd with: diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4f1c53c023025..7f2bcf2ca9e53 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -31,269 +31,30 @@ env: CC: ccache gcc CXX: ccache g++ jobs: - ALPINE: + GENERATE_MATRIX: + name: Generate Matrix if: github.repository == 'php/php-src' || github.event_name == 'pull_request' - name: ALPINE_X64_ASAN_UBSAN_DEBUG_ZTS - runs-on: ubuntu-24.04 - container: - image: 'alpine:3.22' - steps: - - name: git checkout - uses: actions/checkout@v6 - - name: apk - uses: ./.github/actions/apk - - 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: >- - CFLAGS="-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC" - LDFLAGS="-fsanitize=undefined,address -fno-sanitize=function" - CC=clang-20 - CXX=clang++-20 - --enable-debug - --enable-zts - skipSlow: true # FIXME: This should likely include slow extensions - - name: make - run: make -j$(/usr/bin/nproc) >/dev/null - - name: make install - uses: ./.github/actions/install-alpine - - name: Test Tracing JIT - uses: ./.github/actions/test-alpine - with: - jitType: tracing - runTestsParameters: >- - --asan -x - -d opcache.enable_cli=1 - LINUX_X64: - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' - services: - mysql: - image: mysql:8.4 - ports: - - 3306:3306 - env: - MYSQL_DATABASE: test - MYSQL_ROOT_PASSWORD: root - postgres: - image: postgres - ports: - - 5432:5432 - 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: - include: - - debug: false - zts: false - asan: false - - debug: true - zts: true - asan: true - name: "LINUX_X64_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}" - runs-on: ubuntu-24.04 - timeout-minutes: 50 - steps: - - name: git checkout - uses: actions/checkout@v6 - - name: apt - uses: ./.github/actions/apt-x64 - - name: System info - run: | - echo "::group::Show host CPU info" - lscpu - echo "::endgroup::" - echo "::group::Show installed package versions" - dpkg -l - echo "::endgroup::" - - name: Create MSSQL container - if: ${{ !matrix.asan }} - uses: ./.github/actions/setup-mssql - - name: Setup Caddy server - uses: ./.github/actions/setup-caddy - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - # This duplicates the "job.name" expression above because - # GitHub has no way to query the job name (github.job is the - # job id, not the job name) - key: "LINUX_X64_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}-${{hashFiles('main/php_version.h')}}" - append-timestamp: false - save: ${{ github.event_name != 'pull_request' }} - - name: ./configure - uses: ./.github/actions/configure-x64 - with: - configurationParameters: >- - --${{ matrix.debug && 'enable' || 'disable' }}-debug - ${{ matrix.debug && 'CXXFLAGS="-D_GLIBCXX_ASSERTIONS"' || '' }} - --${{ matrix.zts && 'enable' || 'disable' }}-zts - ${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address -fno-sanitize=function" CC=clang CXX=clang++' || '' }} - skipSlow: ${{ matrix.asan }} - - name: make - run: make -j$(/usr/bin/nproc) >/dev/null - - name: make install - uses: ./.github/actions/install-linux - - name: Setup - if: ${{ !matrix.asan }} - uses: ./.github/actions/setup-x64 - - name: Test - if: matrix.asan == false - uses: ./.github/actions/test-linux - - name: Test Tracing JIT - uses: ./.github/actions/test-linux - with: - jitType: tracing - runTestsParameters: >- - -d opcache.enable_cli=1 - ${{ matrix.asan && '--asan -x' || '' }} - - name: Verify generated files are up to date - if: ${{ !matrix.asan }} - uses: ./.github/actions/verify-generated-files - LINUX_X32: - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' - name: LINUX_X32_DEBUG_ZTS runs-on: ubuntu-latest - timeout-minutes: 50 - container: - image: ubuntu:24.04 - env: - MYSQL_TEST_HOST: mysql - PDO_MYSQL_TEST_DSN: mysql:host=mysql;dbname=test - PDO_MYSQL_TEST_HOST: mysql - PDO_FIREBIRD_TEST_DSN: firebird:dbname=firebird:test.fdb - services: - mysql: - image: mysql:8.4 - ports: - - 3306:3306 - env: - MYSQL_DATABASE: test - MYSQL_ROOT_PASSWORD: root - firebird: - image: jacobalberty/firebird - ports: - - 3050:3050 - env: - ISC_PASSWORD: test - FIREBIRD_DATABASE: test.fdb - FIREBIRD_USER: test - FIREBIRD_PASSWORD: test + outputs: + all_variations: ${{ steps.set-matrix.outputs.all_variations }} + branches: ${{ steps.set-matrix.outputs.branches }} steps: - - name: git checkout - uses: actions/checkout@v6 - - name: apt - uses: ./.github/actions/apt-x32 - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: "${{github.job}}-${{hashFiles('main/php_version.h')}}" - append-timestamp: false - save: ${{ github.event_name != 'pull_request' }} - - name: ./configure - uses: ./.github/actions/configure-x32 - with: - configurationParameters: >- - --enable-debug - --enable-zts - - name: make - run: make -j$(/usr/bin/nproc) >/dev/null - - name: make install - uses: ./.github/actions/install-linux-x32 - - name: Test Tracing JIT - uses: ./.github/actions/test-linux - with: - jitType: tracing - runTestsParameters: >- - -d opcache.enable_cli=1 - MACOS_DEBUG_NTS: - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' + - 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: - include: - - os: 15 - arch: ARM64 - name: MACOS_${{ matrix.arch }}_DEBUG_NTS - runs-on: macos-${{ matrix.os }} - timeout-minutes: 50 - steps: - - name: git checkout - uses: actions/checkout@v6 - - name: Update clang - uses: ./.github/actions/macos-update-clang - - name: brew - timeout-minutes: 10 - uses: ./.github/actions/brew - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: "${{github.job}}-${{matrix.os}}-${{hashFiles('main/php_version.h')}}" - append-timestamp: false - save: ${{ github.event_name != 'pull_request' }} - - name: ./configure - uses: ./.github/actions/configure-macos - with: - configurationParameters: --enable-debug --disable-zts - - name: make - run: |- - 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 Tracing JIT - uses: ./.github/actions/test-macos - with: - jitType: tracing - runTestsParameters: >- - -d opcache.enable_cli=1 - - name: Verify generated files are up to date - uses: ./.github/actions/verify-generated-files - WINDOWS: - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' - name: WINDOWS_X64_ZTS - runs-on: windows-2022 - timeout-minutes: 50 - 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.5.0 - PHP_BUILD_CRT: vs17 - PLATFORM: x64 - THREAD_SAFE: "1" - INTRINSICS: AVX2 - PARALLEL: -j2 - OPCACHE: "1" - steps: - - name: git config - run: git config --global core.autocrlf false && git config --global core.eol lf - - name: git checkout - uses: actions/checkout@v6 - - name: Setup - uses: ./.github/actions/setup-windows - - name: Build - run: .github/scripts/windows/build.bat - - name: Test - run: .github/scripts/windows/test.bat + 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' @@ -321,11 +82,9 @@ jobs: re2c \ valgrind - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 + uses: ./.github/actions/ccache with: - key: "${{github.job}}-${{hashFiles('main/php_version.h')}}" - append-timestamp: false - save: ${{ github.event_name != 'pull_request' }} + name: "${{ github.job }}" - name: ./configure run: | set -x @@ -399,13 +158,3 @@ jobs: name: profiles path: ${{ github.workspace }}/benchmark/profiles retention-days: 30 - FREEBSD: - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' - name: FREEBSD - runs-on: ubuntu-latest - timeout-minutes: 50 - steps: - - name: git checkout - uses: actions/checkout@v6 - - name: FreeBSD - uses: ./.github/actions/freebsd diff --git a/.github/workflows/root.yml b/.github/workflows/root.yml index 8302175d638fb..fff1ac3ac894a 100644 --- a/.github/workflows/root.yml +++ b/.github/workflows/root.yml @@ -11,6 +11,7 @@ jobs: 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 @@ -30,7 +31,7 @@ jobs: 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 }}" + run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.ref }}" '[]' NIGHTLY: needs: GENERATE_MATRIX name: ${{ matrix.branch.ref }} @@ -41,23 +42,6 @@ jobs: matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} with: - asan_ubuntu_version: ${{ - (((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 5) || matrix.branch.version[0] >= 9) && '24.04') - || '22.04' }} - branch: ${{ matrix.branch.ref }} - community_verify_type_inference: ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9 }} - macos_arm64_version: ${{ ((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 5) || matrix.branch.version[0] >= 9) && '15' || '14' }} - run_alpine: ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9 }} - run_linux_ppc64: ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9 }} - run_macos_arm64: ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9 }} - run_freebsd_zts: ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 3) || matrix.branch.version[0] >= 9 }} - ubuntu_version: ${{ - (((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 5) || matrix.branch.version[0] >= 9) && '24.04') - || '22.04' }} - windows_version: '2022' - vs_crt_version: ${{ ((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) && 'vs17') || 'vs16' }} - skip_laravel: false - symfony_version: ${{ (((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9) && '8.1') || '7.4' }} - skip_wordpress: false - variation_enable_zend_max_execution_timers: ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 3) || matrix.branch.version[0] >= 9 }} + all_variations: ${{ needs.GENERATE_MATRIX.outputs.all_variations == 'true' }} + branch: ${{ toJSON(matrix.branch) }} secrets: inherit diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 6338a1cb945db..4cd92ad703bbe 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -36,7 +36,7 @@ jobs: steps: - name: git checkout uses: actions/checkout@v6 - + - name: Install dependencies run: | set -x @@ -53,23 +53,20 @@ jobs: ccache - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 + uses: ./.github/actions/ccache with: - key: "unit-tests-${{hashFiles('main/php_version.h')}}" - append-timestamp: false - save: ${{ github.event_name != 'pull_request' }} - + name: "${{ github.job }}" + - name: ./configure (minimal build) uses: ./.github/actions/configure-unit-tests - + - name: make libphp.a run: | set -x make -j$(/usr/bin/nproc) >/dev/null - + - name: Run unit tests run: | set -x cd tests/unit make test -