2020 description : ' OS versions to build on'
2121 default : ' ubuntu:22.04 ubuntu:24.04 arm64v8/ubuntu:22.04 arm64v8/ubuntu:24.04 debian:11 debian:12 debian:trixie'
2222 required : false
23+ workflow_call :
24+ inputs :
25+ build-mode :
26+ description : ' Build mode: --build-all or --build-new'
27+ default : ' --build-new'
28+ required : false
29+ type : string
30+ php-source :
31+ description : ' PHP source: --web-php or --php-src'
32+ default : ' '
33+ required : false
34+ type : string
35+ php-version :
36+ description : ' PHP version to build'
37+ default : ' 8.4'
38+ required : false
39+ type : string
40+ container-os-versions :
41+ description : ' OS versions to build on'
42+ default : ' ubuntu:22.04 ubuntu:24.04 arm64v8/ubuntu:22.04 arm64v8/ubuntu:24.04 debian:11 debian:12 debian:trixie'
43+ required : false
44+ type : string
2345
2446env :
2547 CONTAINER_OS_LIST : ubuntu:22.04 ubuntu:24.04 arm64v8/ubuntu:22.04 arm64v8/ubuntu:24.04 debian:11 debian:12 debian:trixie
2648 RUNNER_OS_LIST : ubuntu-22.04 ubuntu-24.04 ubuntu-22.04-arm ubuntu-24.04-arm
27- PHP_LIST : ${{ inputs.php-version }}
49+ PHP_LIST : ${{ inputs.php-version || '8.4' }}
2850 SAPI_LIST : apache2 cgi cli embed fpm phpdbg
2951 BUILD_LIST : nts zts
30- PHP_SOURCE : ${{ inputs.php-source }}
52+ PHP_SOURCE : ${{ inputs.php-source || '--web-php' }}
3153 CONTAINER_BASE : ubuntu-24.04
3254 CONTAINER_BASE_ARM : ubuntu-24.04-arm
3355
5577 CONTAINER_BASE_ARM : ${{ env.CONTAINER_BASE_ARM }}
5678 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5779 RUNNER_OS_LIST : ${{ env.RUNNER_OS_LIST }}
58- PHP_LIST : ${{ inputs.php-version }}
59- PHP_SOURCE : ${{ inputs.php-source || '--web-php' }}
80+ PHP_LIST : ${{ env.PHP_LIST }}
81+ PHP_SOURCE : ${{ env.PHP_SOURCE }}
6082 SAPI_LIST : ${{ env.SAPI_LIST }}
6183 BUILD_LIST : ${{ env.BUILD_LIST }}
6284 run : bash scripts/get-matrix.sh
@@ -82,18 +104,19 @@ jobs:
82104 - name : Build and package SAPI
83105 run : bash scripts/build.sh build_sapi "${SAPI}"
84106 env :
107+ ASAN : ${{ matrix.asan }}
85108 BUILD : ${{ matrix.build }}
86109 GITHUB_MESSAGE : ${{ github.event.head_commit.message || inputs.build-mode }}
87110 GITHUB_REPOSITORY : ${{ github.repository }}
88111 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
89112 PHP_VERSION : ${{ matrix.php-version }}
90- PHP_SOURCE : ${{ github.event.inputs.php-source }}
113+ PHP_SOURCE : ${{ env.PHP_SOURCE }}
91114 SAPI : ${{ matrix.sapi }}
92115
93116 - name : Upload Artifact
94117 uses : actions/upload-artifact@v7
95118 with :
96- name : php-sapi-${{ matrix.sapi }}-${{ matrix.php-version }}-${{ matrix.build }}+${{ matrix.dist }}-${{ matrix.dist-version }}
119+ name : php-sapi-${{ matrix.sapi }}-${{ matrix.php-version }}-${{ matrix.build }}${{ matrix.asan && '-asan' || '' }} +${{ matrix.dist }}-${{ matrix.dist-version }}
97120 path : /tmp/debian/*.zst
98121
99122 package :
@@ -109,6 +132,12 @@ jobs:
109132 - name : Checkout
110133 uses : actions/checkout@v6
111134
135+ - name : Configure ASAN runtime
136+ if : matrix.asan == 'asan'
137+ run : |
138+ echo "ASAN_OPTIONS=detect_leaks=0" >> "$GITHUB_ENV"
139+ echo "ZEND_DONT_UNLOAD_MODULES=1" >> "$GITHUB_ENV"
140+
112141 - name : Install required packages
113142 run : bash scripts/install-requirements.sh
114143 env :
@@ -117,7 +146,7 @@ jobs:
117146
118147 - uses : actions/download-artifact@v8
119148 with :
120- pattern : php-sapi-*-${{ matrix.php-version }}-${{ matrix.build }}+${{ matrix.dist }}-${{ matrix.dist-version }}
149+ pattern : php-sapi-*-${{ matrix.php-version }}-${{ matrix.build }}${{ matrix.asan && '-asan' || '' }} +${{ matrix.dist }}-${{ matrix.dist-version }}
121150 path : /tmp
122151 merge-multiple : true
123152
@@ -133,6 +162,7 @@ jobs:
133162 - name : Merge SAPI builds
134163 run : bash scripts/build.sh merge
135164 env :
165+ ASAN : ${{ matrix.asan }}
136166 BUILD : ${{ matrix.build }}
137167 SAPI_LIST : ${{ env.SAPI_LIST }}
138168 GITHUB_USER : ${{ github.repository_owner }}
@@ -143,20 +173,22 @@ jobs:
143173 GITHUB_REPOSITORY : ${{ github.repository }}
144174 GITHUB_WORKSPACE : ${{ github.workspace }}
145175 PHP_VERSION : ${{ matrix.php-version }}
146- PHP_SOURCE : ${{ github.event.inputs.php-source }}
176+ PHP_SOURCE : ${{ env.PHP_SOURCE }}
147177
148178 - name : Build extensions
149179 run : bash scripts/build.sh build_extensions
150180 env :
181+ ASAN : ${{ matrix.asan }}
151182 BUILD : ${{ matrix.build }}
152183 SAPI_LIST : ${{ env.SAPI_LIST }}
153184 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
154185 PHP_VERSION : ${{ matrix.php-version }}
155- PHP_SOURCE : ${{ github.event.inputs.php-source }}
186+ PHP_SOURCE : ${{ env.PHP_SOURCE }}
156187
157188 - name : Package build
158189 run : bash scripts/build.sh package
159190 env :
191+ ASAN : ${{ matrix.asan }}
160192 BUILD : ${{ matrix.build }}
161193 SAPI_LIST : ${{ env.SAPI_LIST }}
162194 GITHUB_USER : ${{ github.repository_owner }}
@@ -167,12 +199,12 @@ jobs:
167199 GITHUB_REPOSITORY : ${{ github.repository }}
168200 GITHUB_WORKSPACE : ${{ github.workspace }}
169201 PHP_VERSION : ${{ matrix.php-version }}
170- PHP_SOURCE : ${{ github.event.inputs.php-source }}
202+ PHP_SOURCE : ${{ env.PHP_SOURCE }}
171203
172204 - name : Upload Artifact
173205 uses : actions/upload-artifact@v7
174206 with :
175- name : php${{ matrix.php-version }}-${{ matrix.build }}+${{ matrix.dist }}-${{ matrix.dist-version }}
207+ name : php${{ matrix.php-version }}-${{ matrix.build }}${{ matrix.asan && '-asan' || '' }} +${{ matrix.dist }}-${{ matrix.dist-version }}
176208 path : |
177209 /tmp/*.xz
178210 /tmp/*.zst
@@ -219,15 +251,21 @@ jobs:
219251 - name : Checkout
220252 uses : actions/checkout@v6
221253
254+ - name : Configure ASAN runtime
255+ if : matrix.asan == 'asan'
256+ run : |
257+ echo "ASAN_OPTIONS=detect_leaks=0" >> "$GITHUB_ENV"
258+ echo "ZEND_DONT_UNLOAD_MODULES=1" >> "$GITHUB_ENV"
259+
222260 - uses : actions/download-artifact@v8
223261 with :
224- name : php${{ matrix.php-version }}-${{ matrix.build }}+${{ matrix.dist }}-${{ matrix.dist-version }}
262+ name : php${{ matrix.php-version }}-${{ matrix.build }}${{ matrix.asan && '-asan' || '' }} +${{ matrix.dist }}-${{ matrix.dist-version }}
225263 path : /tmp
226264
227265 - name : Install PHP
228266 run : |
229267 sed -i '/download/d' scripts/install.sh
230- bash scripts/install.sh ${{ matrix.php-version }} local ${{ matrix.debug }} ${{ matrix.build }}
268+ bash scripts/install.sh ${{ matrix.php-version }} local ${{ matrix.debug }} ${{ matrix.build }} ${{ matrix.asan }}
231269
232270 - name : Test
233271 run : |
@@ -260,15 +298,21 @@ jobs:
260298 - name : Checkout
261299 uses : actions/checkout@v6
262300
301+ - name : Configure ASAN runtime
302+ if : matrix.asan == 'asan'
303+ run : |
304+ echo "ASAN_OPTIONS=detect_leaks=0" >> "$GITHUB_ENV"
305+ echo "ZEND_DONT_UNLOAD_MODULES=1" >> "$GITHUB_ENV"
306+
263307 - uses : actions/download-artifact@v8
264308 with :
265- name : php${{ matrix.php-version }}-${{ matrix.build }}+${{ matrix.os }}
309+ name : php${{ matrix.php-version }}-${{ matrix.build }}${{ matrix.asan && '-asan' || '' }} +${{ matrix.os }}
266310 path : /tmp
267311
268312 - name : Install PHP
269313 run : |
270314 sed -i '/download/d' scripts/install.sh
271- bash scripts/install.sh ${{ matrix.php-version }} github ${{ matrix.debug }} ${{ matrix.build }}
315+ bash scripts/install.sh ${{ matrix.php-version }} github ${{ matrix.debug }} ${{ matrix.build }} ${{ matrix.asan }}
272316
273317 - name : Test
274318 run : |
@@ -289,7 +333,7 @@ jobs:
289333 release-container-only :
290334 needs : [get-matrix, local-test]
291335 runs-on : ubuntu-latest
292- if : " ! contains(github.event.head_commit.message, 'skip-release') && contains(needs.get-matrix.outputs.container_only, 'true')"
336+ if : github.event_name != 'pull_request' && ! contains(github.event.head_commit.message || inputs.build-mode , 'skip-release') && contains(needs.get-matrix.outputs.container_only, 'true')
293337
294338 steps :
295339 - name : Checkout
@@ -307,13 +351,13 @@ jobs:
307351 env :
308352 GITHUB_MESSAGE : ${{ github.event.head_commit.message || inputs.build-mode }}
309353 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
310- PHP_LIST : ${{ inputs.php-version }}
311- PHP_SOURCE : ${{ github.event.inputs.php-source }}
354+ PHP_LIST : ${{ env.PHP_LIST }}
355+ PHP_SOURCE : ${{ env.PHP_SOURCE }}
312356
313357 release :
314358 needs : [get-matrix, local-test, github-test]
315359 runs-on : ubuntu-latest
316- if : " ! contains(github.event.head_commit.message, 'skip-release') && contains(needs.get-matrix.outputs.container_only, 'false')"
360+ if : github.event_name != 'pull_request' && ! contains(github.event.head_commit.message || inputs.build-mode , 'skip-release') && contains(needs.get-matrix.outputs.container_only, 'false')
317361
318362 steps :
319363 - name : Checkout
@@ -331,5 +375,5 @@ jobs:
331375 env :
332376 GITHUB_MESSAGE : ${{ github.event.head_commit.message || inputs.build-mode }}
333377 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
334- PHP_LIST : ${{ inputs.php-version }}
335- PHP_SOURCE : ${{ github.event.inputs.php-source }}
378+ PHP_LIST : ${{ env.PHP_LIST }}
379+ PHP_SOURCE : ${{ env.PHP_SOURCE }}
0 commit comments