From 5d83cbec505951025e1abdd81878773333df192e Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 4 Apr 2026 11:01:16 +0700 Subject: [PATCH 1/4] add clang-cl to windows nightly CI --- .github/matrix.php | 1 + .github/scripts/windows/build_task.bat | 4 ++++ .github/workflows/test-suite.yml | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/matrix.php b/.github/matrix.php index dec8c7d249c68..408850e99f445 100644 --- a/.github/matrix.php +++ b/.github/matrix.php @@ -148,6 +148,7 @@ function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $re ? ['include' => [ ['asan' => true, 'opcache' => true, 'x64' => true, 'zts' => true], ['asan' => false, 'opcache' => false, 'x64' => false, 'zts' => false], + ['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true, 'clang' => true], ]] : ['include' => [['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true]]]; $jobs['WINDOWS']['config'] = version_compare($php_version, '8.4', '>=') diff --git a/.github/scripts/windows/build_task.bat b/.github/scripts/windows/build_task.bat index e8d84b8c0bfd6..19fe546a8b3cd 100644 --- a/.github/scripts/windows/build_task.bat +++ b/.github/scripts/windows/build_task.bat @@ -30,10 +30,14 @@ if %errorlevel% neq 0 exit /b 3 if "%THREAD_SAFE%" equ "0" set ADD_CONF=%ADD_CONF% --disable-zts if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS% +if "%CLANG_TOOLSET%" equ "1" set ADD_CONF=%ADD_CONF% --with-toolset=clang rem Some undefined behavior is reported on 32-bit, this should be fixed if "%PLATFORM%" == "x86" ( set CFLAGS=/W1 +) else if "%CLANG_TOOLSET%" equ "1" ( + rem Clang is much stricter than MSVC, produces too many warnings that would fail the build with /WX + set CFLAGS=/W1 ) else ( set CFLAGS=/W1 /WX ) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 9eeff1455f8f9..4f7ed957fceea 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -935,7 +935,7 @@ jobs: strategy: fail-fast: false matrix: ${{ fromJson(inputs.branch).jobs.WINDOWS.matrix }} - name: "WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || ''}}" + name: "WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || ''}}${{ matrix.clang && '_CLANG' || ''}}" runs-on: windows-2022 env: PHP_BUILD_CACHE_BASE_DIR: C:\build-cache @@ -949,6 +949,7 @@ jobs: PARALLEL: -j2 OPCACHE: "${{ matrix.opcache && '1' || '0' }}" ASAN: "${{ matrix.asan && '1' || '0' }}" + CLANG_TOOLSET: "${{ matrix.clang && '1' || '0' }}" steps: - name: git config run: git config --global core.autocrlf false && git config --global core.eol lf From 5cc836eb3fe30ddafacd7cc994d60c8cc968efa6 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 4 Apr 2026 11:07:22 +0700 Subject: [PATCH 2/4] run clang on "CI: Windows" label too --- .github/matrix.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/matrix.php b/.github/matrix.php index 408850e99f445..c9c64566a5cae 100644 --- a/.github/matrix.php +++ b/.github/matrix.php @@ -144,13 +144,18 @@ function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $re $jobs['SOLARIS'] = true; } if ($all_jobs || !$no_jobs || $test_windows) { - $jobs['WINDOWS']['matrix'] = $all_variations - ? ['include' => [ + $windows_include = $all_variations + ? [ ['asan' => true, 'opcache' => true, 'x64' => true, 'zts' => true], ['asan' => false, 'opcache' => false, 'x64' => false, 'zts' => false], - ['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true, 'clang' => true], - ]] - : ['include' => [['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true]]]; + ] + : [ + ['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true], + ]; + if ($all_variations || $test_windows) { + $windows_include[] = ['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true, 'clang' => true]; + } + $jobs['WINDOWS']['matrix'] = ['include' => $windows_include]; $jobs['WINDOWS']['config'] = version_compare($php_version, '8.4', '>=') ? ['vs_crt_version' => 'vs17'] : ['vs_crt_version' => 'vs16']; From 9f51aab614e26dd87cd67506a31351fb973eb8cb Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 4 Apr 2026 18:10:20 +0700 Subject: [PATCH 3/4] feedback --- .github/matrix.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/matrix.php b/.github/matrix.php index c9c64566a5cae..75cd7a7a45b77 100644 --- a/.github/matrix.php +++ b/.github/matrix.php @@ -144,18 +144,13 @@ function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $re $jobs['SOLARIS'] = true; } if ($all_jobs || !$no_jobs || $test_windows) { - $windows_include = $all_variations - ? [ + $jobs['WINDOWS']['matrix'] = $all_variations + ? ['include' => [ ['asan' => true, 'opcache' => true, 'x64' => true, 'zts' => true], ['asan' => false, 'opcache' => false, 'x64' => false, 'zts' => false], - ] - : [ - ['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true], - ]; - if ($all_variations || $test_windows) { - $windows_include[] = ['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true, 'clang' => true]; - } - $jobs['WINDOWS']['matrix'] = ['include' => $windows_include]; + ['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true, 'clang' => true] + ]] + : ['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']; From 17b848587a4cf57987634a5b41c597e8f616fe13 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 4 Apr 2026 18:33:37 +0700 Subject: [PATCH 4/4] only for 8.5+ I guess --- .github/matrix.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/matrix.php b/.github/matrix.php index 75cd7a7a45b77..73768123be678 100644 --- a/.github/matrix.php +++ b/.github/matrix.php @@ -144,13 +144,14 @@ function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $re $jobs['SOLARIS'] = 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], - ['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true, 'clang' => true] - ]] - : ['include' => [['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true]]]; + $matrix = [['asan' => true, 'opcache' => true, 'x64' => true, 'zts' => true]]; + if ($all_variations) { + $matrix[] = ['asan' => false, 'opcache' => false, 'x64' => false, 'zts' => false]; + if (version_compare($php_version, '8.5', '>=')) { + $matrix[] = ['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true, 'clang' => true]; + } + } + $jobs['WINDOWS']['matrix'] = ['include' => $matrix]; $jobs['WINDOWS']['config'] = version_compare($php_version, '8.4', '>=') ? ['vs_crt_version' => 'vs17'] : ['vs_crt_version' => 'vs16'];