5454 uses : ./.github/actions/extra-tests
5555 ALPINE :
5656 if : ${{ fromJson(inputs.branch).jobs.ALPINE }}
57- name : ALPINE_X64_ASAN_DEBUG_ZTS
57+ strategy :
58+ fail-fast : false
59+ matrix : ${{ fromJson(inputs.branch).jobs.ALPINE.matrix }}
60+ name : " ALPINE_X64_ASAN_DEBUG_ZTS${{ matrix.test_shards > 1 && format('_SHARD_{0}_OF_{1}', matrix.test_shard, matrix.test_shards) || '' }}"
5861 runs-on : ubuntu-24.04
5962 timeout-minutes : 180
6063 container :
8083 name : " ${{ github.job }}"
8184 cc : clang-20
8285 cxx : clang++-20
86+ save : ${{ matrix.test_shard == 1 && 'true' || 'false' }}
8387 - name : ./configure
8488 uses : ./.github/actions/configure-alpine
8589 with :
@@ -100,7 +104,10 @@ jobs:
100104 jitType : tracing
101105 runTestsParameters : >-
102106 --asan -x
107+ testShard : ${{ matrix.test_shard }}
108+ testShards : ${{ matrix.test_shards }}
103109 - name : Extra tests
110+ if : ${{ matrix.test_shard == 1 }}
104111 uses : ./.github/actions/extra-tests
105112 LINUX_X64 :
106113 if : ${{ fromJson(inputs.branch).jobs.LINUX_X64 }}
@@ -130,7 +137,7 @@ jobs:
130137 strategy :
131138 fail-fast : false
132139 matrix : ${{ fromJson(inputs.branch).jobs.LINUX_X64.matrix }}
133- name : " LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.test_mode == 'function-jit' && '_FUNCTION_JIT' || '' }}"
140+ name : " LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.test_mode == 'function-jit' && '_FUNCTION_JIT' || '' }}${{ matrix.test_shards > 1 && format('_SHARD_{0}_OF_{1}', matrix.test_shard, matrix.test_shards) || '' }} "
134141 runs-on : ubuntu-${{ fromJson(inputs.branch).config.ubuntu_version }}
135142 timeout-minutes : 180
136143 steps :
@@ -163,9 +170,9 @@ jobs:
163170 # GitHub has no way to query the job name (github.job is the
164171 # job id, not the job name)
165172 name : " LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
166- # Both test modes build the same configuration and share a cache.
167- # Only the normal job saves it to avoid concurrent writes.
168- save : ${{ matrix.test_mode != 'function-jit' && 'true' || 'false' }}
173+ # Test modes and shards of the same configuration share a cache.
174+ # Only the normal job's first shard saves it to avoid concurrent writes.
175+ save : ${{ ( matrix.test_mode != 'function-jit' && (!matrix.test_shard || matrix.test_shard == 1)) && 'true' || 'false' }}
169176 - name : ./configure
170177 uses : ./.github/actions/configure-x64
171178 with :
@@ -205,6 +212,8 @@ jobs:
205212 ${{ (matrix.asan && !inputs.all_variations) && '-x' || '' }}
206213 ${{ matrix.repeat && '--repeat 2' || '' }}
207214 ${{ matrix.variation && '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0' || '' }}
215+ testShard : ${{ matrix.test_shard || 1 }}
216+ testShards : ${{ matrix.test_shards || 1 }}
208217 - name : Test OpCache
209218 if : ${{ inputs.all_variations && matrix.test_mode != 'function-jit' }}
210219 uses : ./.github/actions/test-linux
@@ -226,10 +235,10 @@ jobs:
226235 ${{ matrix.repeat && '--repeat 2' || '' }}
227236 ${{ matrix.variation && '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0' || '' }}
228237 - name : Extra tests
229- if : ${{ matrix.test_mode != 'function-jit' }}
238+ if : ${{ matrix.test_mode != 'function-jit' && (!matrix.test_shard || matrix.test_shard == 1) }}
230239 uses : ./.github/actions/extra-tests
231240 - name : Verify generated files are up to date
232- if : ${{ matrix.test_mode != 'function-jit' }}
241+ if : ${{ matrix.test_mode != 'function-jit' && (!matrix.test_shard || matrix.test_shard == 1) }}
233242 uses : ./.github/actions/verify-generated-files
234243 LINUX_X32 :
235244 if : ${{ fromJson(inputs.branch).jobs.LINUX_X32 }}
@@ -852,7 +861,7 @@ jobs:
852861 strategy :
853862 fail-fast : false
854863 matrix : ${{ fromJson(inputs.branch).jobs.WINDOWS.matrix }}
855- name : " WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || ''}}${{ matrix.clang && '_CLANG' || ''}}"
864+ name : " WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || ''}}${{ matrix.clang && '_CLANG' || ''}}${{ matrix.test_shards > 1 && format('_SHARD_{0}_OF_{1}', matrix.test_shard, matrix.test_shards) || '' }} "
856865 runs-on : ${{ fromJson(inputs.branch).jobs.WINDOWS.config.runs_on }}
857866 timeout-minutes : 180
858867 env :
@@ -868,6 +877,8 @@ jobs:
868877 OPCACHE : " ${{ matrix.opcache && '1' || '0' }}"
869878 ASAN : " ${{ matrix.asan && '1' || '0' }}"
870879 CLANG_TOOLSET : " ${{ matrix.clang && '1' || '0' }}"
880+ TEST_SHARD : " ${{ matrix.test_shard }}"
881+ TEST_SHARDS : " ${{ matrix.test_shards }}"
871882 SCCACHE_CACHE_SIZE : 1G
872883 SCCACHE_IGNORE_SERVER_IO_ERROR : " 1"
873884 SCCACHE_CACHE_KEY : windows-sccache-v2-php${{ join(fromJson(inputs.branch).version, '.') }}-${{ fromJson(inputs.branch).jobs.WINDOWS.config.vs_crt_version }}-${{ matrix.x64 && 'x64' || 'x86' }}-zts${{ matrix.zts && '1' || '0' }}-asan${{ matrix.asan && '1' || '0' }}-${{ github.sha }}
@@ -895,7 +906,7 @@ jobs:
895906 # Pull request caches are isolated to the PR merge ref and cannot update
896907 # caches used by the base branch or other pull requests.
897908 - name : Save MSVC compiler cache
898- if : ${{ !matrix.clang }}
909+ if : ${{ !matrix.clang && matrix.test_shard == 1 }}
899910 continue-on-error : true
900911 uses : actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
901912 with :
0 commit comments