xref: /PHP-8.3/.github/workflows/nightly.yml (revision f598b587)
1name: Nightly
2on:
3  schedule:
4   - cron: "0 1 * * *"
5  workflow_dispatch: ~
6permissions:
7  contents: read
8jobs:
9  GENERATE_MATRIX:
10    name: Generate Matrix
11    if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch'
12    runs-on: ubuntu-latest
13    outputs:
14      branches: ${{ steps.set-matrix.outputs.branches }}
15      matrix-include: ${{ steps.set-matrix.outputs.matrix-include }}
16      windows-matrix-include: ${{ steps.set-matrix.outputs.windows-matrix-include }}
17    steps:
18      - uses: actions/checkout@v4
19        with:
20          # Set fetch-depth to 0 to clone the full repository
21          # including all branches. This is required to find
22          # the correct commit hashes.
23          fetch-depth: 0
24      - name: Grab the commit mapping
25        uses: actions/cache@v3
26        with:
27          path: branch-commit-cache.json
28          # The cache key needs to change every time for the
29          # cache to be updated after this job finishes.
30          key: nightly-${{ github.run_id }}-${{ github.run_attempt }}
31          restore-keys: |
32            nightly-
33      - name: Generate Matrix
34        id: set-matrix
35        run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}"
36      - name: Notify Slack
37        if: failure()
38        uses: ./.github/actions/notify-slack
39        with:
40          token: ${{ secrets.ACTION_MONITORING_SLACK }}
41  LINUX_X64:
42    needs: GENERATE_MATRIX
43    if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
44    services:
45      postgres:
46        image: postgres
47        env:
48          POSTGRES_USER: postgres
49          POSTGRES_PASSWORD: postgres
50          POSTGRES_DB: test
51    strategy:
52      fail-fast: false
53      matrix:
54        branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
55        configuration_parameters: ['']
56        debug: [true, false]
57        name: ['']
58        run_tests_parameters: ['']
59        test_function_jit: [true]
60        zts: [true, false]
61        include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.matrix-include) }}
62    name: "${{ matrix.branch.name }}_LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
63    runs-on: ubuntu-${{ (matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && '22.04' || '20.04' }}
64    steps:
65      # https://stackoverflow.com/a/76921482/1320374
66      - name: Increase swapfile
67        if: matrix.asan
68        run: |
69          sudo swapoff -a
70          sudo fallocate -l 8G /swapfile
71          sudo chmod 600 /swapfile
72          sudo mkswap /swapfile
73          sudo swapon /swapfile
74          sudo swapon --show
75      - name: git checkout
76        uses: actions/checkout@v4
77        with:
78          ref: ${{ matrix.branch.ref }}
79      - name: Create MSSQL container
80        uses: ./.github/actions/setup-mssql
81      - name: Create Oracle container
82        uses: ./.github/actions/setup-oracle
83      - name: apt
84        uses: ./.github/actions/apt-x64
85      - name: System info
86        run: |
87          echo "::group::Show host CPU info"
88          lscpu
89          echo "::endgroup::"
90          echo "::group::Show installed package versions"
91          dpkg -l
92          echo "::endgroup::"
93      - name: ./configure
94        uses: ./.github/actions/configure-x64
95        with:
96          configurationParameters: >-
97            ${{ matrix.configuration_parameters }}
98            --${{ matrix.debug && 'enable' || 'disable' }}-debug
99            --${{ matrix.zts && 'enable' || 'disable' }}-zts
100      - name: make
101        run: make -j$(/usr/bin/nproc) >/dev/null
102      - name: make install
103        uses: ./.github/actions/install-linux
104      - name: Setup
105        uses: ./.github/actions/setup-x64
106      - name: Test
107        uses: ./.github/actions/test-linux
108        with:
109          runTestsParameters: >-
110            ${{ matrix.run_tests_parameters }}
111          idleCpu: ${{ matrix.asan && 'true' || 'false' }}
112      - name: Test Tracing JIT
113        uses: ./.github/actions/test-linux
114        with:
115          jitType: tracing
116          runTestsParameters: >-
117            ${{ matrix.run_tests_parameters }}
118            -d zend_extension=opcache.so
119            -d opcache.enable_cli=1
120      - name: Test OpCache
121        uses: ./.github/actions/test-linux
122        with:
123          runTestsParameters: >-
124            ${{ matrix.run_tests_parameters }}
125            -d zend_extension=opcache.so
126            -d opcache.enable_cli=1
127      - name: Test Function JIT
128        # ASAN frequently timeouts. Each test run takes ~90 minutes, we can
129        # avoid running into the 6 hour timeout by skipping the function JIT.
130        if: matrix.test_function_jit
131        uses: ./.github/actions/test-linux
132        with:
133          jitType: function
134          runTestsParameters: >-
135            ${{ matrix.run_tests_parameters }}
136            -d zend_extension=opcache.so
137            -d opcache.enable_cli=1
138      - name: Verify generated files are up to date
139        uses: ./.github/actions/verify-generated-files
140      - name: Notify Slack
141        if: failure()
142        uses: ./.github/actions/notify-slack
143        with:
144          token: ${{ secrets.ACTION_MONITORING_SLACK }}
145  LINUX_X32:
146    needs: GENERATE_MATRIX
147    if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
148    strategy:
149      fail-fast: false
150      matrix:
151        branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
152        debug: [true, false]
153        zts: [true, false]
154    name: "${{ matrix.branch.name }}_LINUX_X32_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
155    runs-on: ubuntu-latest
156    container:
157      image: ubuntu:${{ (matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && '22.04' || '20.04' }}
158    services:
159      mysql:
160        image: mysql:8.3
161        ports:
162          - 3306:3306
163        env:
164          MYSQL_DATABASE: test
165          MYSQL_ROOT_PASSWORD: root
166    steps:
167      - name: git checkout
168        uses: actions/checkout@v4
169        with:
170          ref: ${{ matrix.branch.ref }}
171      - name: apt
172        uses: ./.github/actions/apt-x32
173      - name: System info
174        run: |
175          echo "::group::Show host CPU info"
176          lscpu
177          echo "::endgroup::"
178          echo "::group::Show installed package versions"
179          dpkg -l
180          echo "::endgroup::"
181      - name: ./configure
182        uses: ./.github/actions/configure-x32
183        with:
184          configurationParameters: >-
185            --${{ matrix.debug && 'enable' || 'disable' }}-debug
186            --${{ matrix.zts && 'enable' || 'disable' }}-zts
187      - name: make
188        run: make -j$(/usr/bin/nproc) >/dev/null
189      - name: make install
190        uses: ./.github/actions/install-linux-x32
191      - name: Test
192        uses: ./.github/actions/test-linux
193        with:
194          runTestsParameters: >-
195            ${{ matrix.run_tests_parameters }}
196      - name: Test Tracing JIT
197        uses: ./.github/actions/test-linux
198        with:
199          jitType: tracing
200          runTestsParameters: >-
201            ${{ matrix.run_tests_parameters }}
202            -d zend_extension=opcache.so
203            -d opcache.enable_cli=1
204      - name: Test OpCache
205        uses: ./.github/actions/test-linux
206        with:
207          runTestsParameters: >-
208            ${{ matrix.run_tests_parameters }}
209            -d zend_extension=opcache.so
210            -d opcache.enable_cli=1
211      - name: Test Function JIT
212        uses: ./.github/actions/test-linux
213        with:
214          jitType: function
215          runTestsParameters: >-
216            ${{ matrix.run_tests_parameters }}
217            -d zend_extension=opcache.so
218            -d opcache.enable_cli=1
219      - name: Notify Slack
220        if: failure()
221        uses: ./.github/actions/notify-slack
222        with:
223          token: ${{ secrets.ACTION_MONITORING_SLACK }}
224  MACOS:
225    needs: GENERATE_MATRIX
226    if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
227    strategy:
228      fail-fast: false
229      matrix:
230        branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
231        debug: [true, false]
232        zts: [true, false]
233    name: "${{ matrix.branch.name }}_MACOS_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
234    runs-on: macos-12
235    steps:
236      - name: git checkout
237        uses: actions/checkout@v4
238        with:
239          ref: ${{ matrix.branch.ref }}
240      - name: brew
241        uses: ./.github/actions/brew
242      - name: ./configure
243        uses: ./.github/actions/configure-macos
244        with:
245          configurationParameters: >-
246            --${{ matrix.debug && 'enable' || 'disable' }}-debug
247            --${{ matrix.zts && 'enable' || 'disable' }}-zts
248      - name: make
249        run: |-
250          export PATH="/usr/local/opt/bison/bin:$PATH"
251          make -j$(sysctl -n hw.logicalcpu) >/dev/null
252      - name: make install
253        run: sudo make install
254      - name: Test
255        uses: ./.github/actions/test-macos
256      - name: Test Tracing JIT
257        uses: ./.github/actions/test-macos
258        with:
259          jitType: tracing
260          runTestsParameters: >-
261            -d zend_extension=opcache.so
262            -d opcache.enable_cli=1
263            -d opcache.protect_memory=1
264      - name: Test OpCache
265        uses: ./.github/actions/test-macos
266        with:
267          runTestsParameters: >-
268            -d zend_extension=opcache.so
269            -d opcache.enable_cli=1
270            -d opcache.protect_memory=1
271      - name: Test Function JIT
272        uses: ./.github/actions/test-macos
273        with:
274          jitType: function
275          runTestsParameters: >-
276            -d zend_extension=opcache.so
277            -d opcache.enable_cli=1
278            -d opcache.protect_memory=1
279      - name: Verify generated files are up to date
280        uses: ./.github/actions/verify-generated-files
281      - name: Notify Slack
282        if: failure()
283        uses: ./.github/actions/notify-slack
284        with:
285          token: ${{ secrets.ACTION_MONITORING_SLACK }}
286  COVERAGE_DEBUG_NTS:
287    if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch'
288    services:
289      postgres:
290        image: postgres
291        env:
292          POSTGRES_USER: postgres
293          POSTGRES_PASSWORD: postgres
294          POSTGRES_DB: test
295    runs-on: ubuntu-22.04
296    steps:
297      - name: git checkout
298        uses: actions/checkout@v4
299      - name: Create MSSQL container
300        uses: ./.github/actions/setup-mssql
301      - name: apt
302        uses: ./.github/actions/apt-x64
303      - name: Install gcovr
304        run: sudo -H pip install gcovr
305      - name: ./configure
306        uses: ./.github/actions/configure-x64
307        with:
308          configurationParameters: --enable-debug --disable-zts --enable-gcov
309      - name: make
310        run: make -j$(/usr/bin/nproc) >/dev/null
311      - name: make install
312        uses: ./.github/actions/install-linux
313      - name: Setup
314        uses: ./.github/actions/setup-x64
315      # We only test with OpCache, the difference in coverage is negligible
316      - name: Test OpCache
317        uses: ./.github/actions/test-linux
318        with:
319          runTestsParameters: >-
320            -d zend_extension=opcache.so
321            -d opcache.enable_cli=1
322      - name: Upload Test Coverage to Codecov.io
323        if: always()
324        run: bash <(curl -s https://codecov.io/bash)
325      - name: Notify Slack
326        if: failure()
327        uses: ./.github/actions/notify-slack
328        with:
329          token: ${{ secrets.ACTION_MONITORING_SLACK }}
330  COMMUNITY:
331    needs: GENERATE_MATRIX
332    if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
333    strategy:
334      fail-fast: false
335      matrix:
336        branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
337    name: "${{ matrix.branch.name }}_COMMUNITY"
338    runs-on: ubuntu-${{ (matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && '22.04' || '20.04' }}
339    env:
340      UBSAN_OPTIONS: print_stacktrace=1
341      USE_ZEND_ALLOC: 0
342      USE_TRACKED_ALLOC: 1
343    steps:
344      - name: git checkout
345        uses: actions/checkout@v4
346        with:
347          ref: ${{ matrix.branch.ref }}
348      - name: apt
349        uses: ./.github/actions/apt-x64
350      - name: ./configure
351        uses: ./.github/actions/configure-x64
352        with:
353          configurationParameters: >-
354            --enable-debug
355            --enable-zts
356            CFLAGS='-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC'
357            LDFLAGS='-fsanitize=undefined,address'
358      - name: make
359        run: make -j$(/usr/bin/nproc) >/dev/null
360      - name: make install
361        uses: ./.github/actions/install-linux
362      - name: Setup
363        run: |
364          sudo service mysql start
365          mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
366          mysql -uroot -proot -e "SET GLOBAL local_infile = true"
367      - name: Enable Opcache and JIT
368        run: |
369          echo zend_extension=opcache.so > /etc/php.d/opcache.ini
370          echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
371          echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
372          echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini
373      - name: Test AMPHP
374        if: matrix.branch.ref != 'PHP-8.0'
375        run: |
376          repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server"
377          X=0
378          for repository in $repositories; do
379            printf "Testing amp/%s\n" "$repository"
380            git clone "https://github.com/amphp/$repository.git" "amphp-$repository" --depth 1
381            cd "amphp-$repository"
382            git rev-parse HEAD
383            php /usr/bin/composer install --no-progress --ignore-platform-reqs
384            export ASAN_OPTIONS=exitcode=139
385            vendor/bin/phpunit || EXIT_CODE=$?
386            if [ ${EXIT_CODE:-0} -gt 128 ]; then
387              X=1;
388            fi
389            cd ..
390          done
391          exit $X
392      - name: Test Laravel
393        if: matrix.branch.ref != 'PHP-8.0'
394        run: |
395          git clone https://github.com/laravel/framework.git --branch=master --depth=1
396          cd framework
397          git rev-parse HEAD
398          php /usr/bin/composer install --no-progress --ignore-platform-reqs
399          # Hack to disable a test that hangs
400          php -r '$c = file_get_contents("tests/Filesystem/FilesystemTest.php"); $c = str_replace("public function testSharedGet()", "#[\\PHPUnit\\Framework\\Attributes\\Group('"'"'skip'"'"')]\n    public function testSharedGet()", $c); file_put_contents("tests/Filesystem/FilesystemTest.php", $c);'
401          export ASAN_OPTIONS=exitcode=139
402          php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$?
403          if [ ${EXIT_CODE:-0} -gt 128 ]; then
404            exit 1
405          fi
406      - name: Test ReactPHP
407        if: matrix.branch.ref != 'PHP-8.0'
408        run: |
409          repositories="async cache child-process datagram dns event-loop promise promise-stream promise-timer stream"
410          X=0
411          for repository in $repositories; do
412            printf "Testing reactphp/%s\n" "$repository"
413            git clone "https://github.com/reactphp/$repository.git" "reactphp-$repository" --depth 1
414            cd "reactphp-$repository"
415            git rev-parse HEAD
416            php /usr/bin/composer install --no-progress --ignore-platform-reqs
417            export ASAN_OPTIONS=exitcode=139
418            vendor/bin/phpunit || EXIT_CODE=$?
419            if [ $[EXIT_CODE:-0} -gt 128 ]; then
420              X=1;
421            fi
422            cd ..
423          done
424          exit $X
425      - name: Test Revolt PHP
426        if: matrix.branch.ref != 'PHP-8.0'
427        run: |
428          git clone https://github.com/revoltphp/event-loop.git --depth=1
429          cd event-loop
430          git rev-parse HEAD
431          php /usr/bin/composer install --no-progress --ignore-platform-reqs
432          export ASAN_OPTIONS=exitcode=139
433          vendor/bin/phpunit || EXIT_CODE=$?
434          if [ ${EXIT_CODE:-0} -gt 128 ]; then
435            exit 1
436          fi
437      - name: Test Symfony
438        if: matrix.branch.ref != 'PHP-8.0'
439        run: |
440          git clone https://github.com/symfony/symfony.git --depth=1
441          cd symfony
442          git rev-parse HEAD
443          php /usr/bin/composer install --no-progress --ignore-platform-reqs
444          php ./phpunit install
445          # Test causes a heap-buffer-overflow but I cannot reproduce it locally...
446          php -r '$c = file_get_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php"); $c = str_replace("public function testSanitizeDeepNestedString()", "/** @group skip */\n    public function testSanitizeDeepNestedString()", $c); file_put_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php", $c);'
447          # Buggy FFI test in Symfony, see https://github.com/symfony/symfony/issues/47668
448          php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("*/\n    public function testCastNonTrailingCharPointer()", "* @group skip\n     */\n    public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);'
449          export ASAN_OPTIONS=exitcode=139
450          export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
451          X=0
452          for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do
453            php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$?
454            if [ ${EXIT_CODE:-0} -gt 128 ]; then
455              X=1;
456            fi
457          done
458          exit $X
459      - name: Test PHPUnit
460        if: always()
461        run: |
462          git clone https://github.com/sebastianbergmann/phpunit.git --branch=main --depth=1
463          cd phpunit
464          git rev-parse HEAD
465          export ASAN_OPTIONS=exitcode=139
466          php /usr/bin/composer install --no-progress --ignore-platform-reqs
467          php ./phpunit || EXIT_CODE=$?
468          if [ ${EXIT_CODE:-0} -gt 128 ]; then
469            exit 1
470          fi
471      - name: 'Symfony Preloading'
472        if: matrix.branch.ref != 'PHP-8.0'
473        run: |
474          php /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress --ignore-platform-reqs
475          cd symfony_demo
476          git rev-parse HEAD
477          sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php
478          php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php
479      - name: Test Wordpress
480        if: always()
481        run: |
482          git clone https://github.com/WordPress/wordpress-develop.git wordpress --depth=1
483          cd wordpress
484          git rev-parse HEAD
485          export ASAN_OPTIONS=exitcode=139
486          php /usr/bin/composer install --no-progress --ignore-platform-reqs
487          cp wp-tests-config-sample.php wp-tests-config.php
488          sed -i 's/youremptytestdbnamehere/test/g' wp-tests-config.php
489          sed -i 's/yourusernamehere/root/g' wp-tests-config.php
490          sed -i 's/yourpasswordhere/root/g' wp-tests-config.php
491          php vendor/bin/phpunit || EXIT_CODE=$?
492          if [ $EXIT_CODE -gt 128 ]; then
493            exit 1
494          fi
495      - name: Notify Slack
496        if: failure()
497        uses: ./.github/actions/notify-slack
498        with:
499          token: ${{ secrets.ACTION_MONITORING_SLACK }}
500  OPCACHE_VARIATION:
501    needs: GENERATE_MATRIX
502    if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
503    services:
504      postgres:
505        image: postgres
506        env:
507          POSTGRES_USER: postgres
508          POSTGRES_PASSWORD: postgres
509          POSTGRES_DB: test
510    strategy:
511      fail-fast: false
512      matrix:
513        branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
514    name: "${{ matrix.branch.name }}_OPCACHE_VARIATION"
515    runs-on: ubuntu-${{ (matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && '22.04' || '20.04' }}
516    steps:
517      - name: git checkout
518        uses: actions/checkout@v4
519        with:
520          ref: ${{ matrix.branch.ref }}
521      - name: Create MSSQL container
522        uses: ./.github/actions/setup-mssql
523      - name: Create Oracle container
524        uses: ./.github/actions/setup-oracle
525      - name: apt
526        uses: ./.github/actions/apt-x64
527      - name: ./configure
528        uses: ./.github/actions/configure-x64
529        with:
530          configurationParameters: >-
531            --enable-debug --disable-zts
532      - name: make
533        run: make -j$(/usr/bin/nproc) >/dev/null
534      - name: make install
535        uses: ./.github/actions/install-linux
536      - name: Setup
537        uses: ./.github/actions/setup-x64
538      - name: Test File Cache (prime shm)
539        uses: ./.github/actions/test-linux
540        with:
541          runTestsParameters: >-
542            -d zend_extension=opcache.so
543            -d opcache.enable_cli=1
544            --file-cache-prime
545      - name: Test File Cache (prime shm, use shm)
546        uses: ./.github/actions/test-linux
547        with:
548          runTestsParameters: >-
549            -d zend_extension=opcache.so
550            -d opcache.enable_cli=1
551            --file-cache-use
552      - name: Test File Cache (prime shm, use file)
553        uses: ./.github/actions/test-linux
554        with:
555          runTestsParameters: >-
556            -d zend_extension=opcache.so
557            -d opcache.enable_cli=1
558            --file-cache-use
559            -d opcache.file_cache_only=1
560      - name: Test File Cache Only (prime)
561        uses: ./.github/actions/test-linux
562        with:
563          runTestsParameters: >-
564            -d zend_extension=opcache.so
565            -d opcache.enable_cli=1
566            --file-cache-prime
567            -d opcache.file_cache_only=1
568      - name: Test File Cache Only (use)
569        uses: ./.github/actions/test-linux
570        with:
571          runTestsParameters: >-
572            -d zend_extension=opcache.so
573            -d opcache.enable_cli=1
574            --file-cache-use
575            -d opcache.file_cache_only=1
576      - name: Verify generated files are up to date
577        uses: ./.github/actions/verify-generated-files
578      - name: Notify Slack
579        if: failure()
580        uses: ./.github/actions/notify-slack
581        with:
582          token: ${{ secrets.ACTION_MONITORING_SLACK }}
583  MSAN:
584    needs: GENERATE_MATRIX
585    if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
586    strategy:
587      fail-fast: false
588      matrix:
589        branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
590    name: "${{ matrix.branch.name }}_MSAN"
591    runs-on: ubuntu-${{ (matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && '22.04' || '20.04' }}
592    steps:
593      - name: git checkout
594        uses: actions/checkout@v4
595        with:
596          ref: ${{ matrix.branch.ref }}
597      - name: apt
598        uses: ./.github/actions/apt-x64
599      - name: ./configure
600        run: |
601          export CC=clang
602          export CXX=clang++
603          export CFLAGS="-DZEND_TRACK_ARENA_ALLOC"
604          ./buildconf --force
605          # msan requires all used libraries to be instrumented,
606          # so we should avoiding linking against anything but libc here
607          ./configure \
608            --enable-debug \
609            --enable-zts \
610            --enable-option-checking=fatal \
611            --prefix=/usr \
612            --without-sqlite3 \
613            --without-pdo-sqlite \
614            --without-libxml \
615            --disable-dom \
616            --disable-simplexml \
617            --disable-xml \
618            --disable-xmlreader \
619            --disable-xmlwriter \
620            --without-pcre-jit \
621            --disable-opcache-jit \
622            --enable-phpdbg \
623            --enable-fpm \
624            --with-pdo-mysql=mysqlnd \
625            --with-mysqli=mysqlnd \
626            --disable-mysqlnd-compression-support \
627            --without-pear \
628            --enable-exif \
629            --enable-sysvsem \
630            --enable-sysvshm \
631            --enable-shmop \
632            --enable-pcntl \
633            --enable-mbstring \
634            --disable-mbregex \
635            --enable-sockets \
636            --enable-bcmath \
637            --enable-calendar \
638            --enable-ftp \
639            --enable-zend-test \
640            --enable-werror \
641            --enable-memory-sanitizer \
642            --with-config-file-path=/etc \
643            --with-config-file-scan-dir=/etc/php.d \
644            ${{ matrix.branch.ref != 'PHP-8.0' && '--enable-dl-test=shared' || '' }}
645      - name: make
646        run: make -j$(/usr/bin/nproc) >/dev/null
647      - name: make install
648        run: |
649          sudo make install
650          sudo mkdir -p /etc/php.d
651          sudo chmod 777 /etc/php.d
652          echo mysqli.default_socket=/var/run/mysqld/mysqld.sock    > /etc/php.d/mysqli.ini
653          echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/pdo_mysql.ini
654      - name: Setup
655        run: |
656          set -x
657          sudo service mysql start
658          mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
659          # Ensure local_infile tests can run.
660          mysql -uroot -proot -e "SET GLOBAL local_infile = true"
661          sudo locale-gen de_DE
662      - name: Test
663        uses: ./.github/actions/test-linux
664        with:
665          runTestsParameters: >-
666            --msan
667      - name: Test Opcache
668        uses: ./.github/actions/test-linux
669        with:
670          runTestsParameters: >-
671            --msan
672            -d zend_extension=opcache.so
673            -d opcache.enable_cli=1
674      - name: Verify generated files are up to date
675        uses: ./.github/actions/verify-generated-files
676      - name: Notify Slack
677        if: failure()
678        uses: ./.github/actions/notify-slack
679        with:
680          token: ${{ secrets.ACTION_MONITORING_SLACK }}
681  LIBMYSQLCLIENT:
682    needs: GENERATE_MATRIX
683    if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
684    strategy:
685      fail-fast: false
686      matrix:
687        branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
688        exclude:
689          - branch: { name: 'PHP-80', ref: 'PHP-8.0' }
690    name: "${{ matrix.branch.name }}_LIBMYSQLCLIENT"
691    runs-on: ubuntu-${{ (matrix.branch.ref == 'PHP-8.3' || matrix.branch.ref == 'master') && '22.04' || '20.04' }}
692    steps:
693      - name: git checkout
694        uses: actions/checkout@v4
695        with:
696          ref: ${{ matrix.branch.ref }}
697      - name: apt
698        run: |
699          sudo apt-get update -y | true
700          sudo apt install bison re2c
701      - name: Setup
702        run: |
703          sudo service mysql start
704          mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
705          # Ensure local_infile tests can run.
706          mysql -uroot -proot -e "SET GLOBAL local_infile = true"
707      # Does not support caching_sha2_auth :(
708      # - name: Build mysql-5.6
709      #  uses: ./.github/actions/build-libmysqlclient
710      #  with:
711      #    libmysql: mysql-5.6.49-linux-glibc2.12-x86_64.tar.gz
712      # - name: Test mysql-5.6
713      #   uses: ./.github/actions/test-libmysqlclient
714      - name: Build mysql-5.7
715        uses: ./.github/actions/build-libmysqlclient
716        with:
717          libmysql: mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz
718          withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }}
719      - name: Test mysql-5.7
720        uses: ./.github/actions/test-libmysqlclient
721        with:
722          withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }}
723      - name: Build mysql-8.0
724        uses: ./.github/actions/build-libmysqlclient
725        with:
726          # FIXME: There are new warnings
727          # configurationParameters: --enable-werror
728          libmysql: mysql-8.0.33-linux-glibc2.12-x86_64.tar.xz
729          withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }}
730      - name: Test mysql-8.0
731        uses: ./.github/actions/test-libmysqlclient
732        with:
733          withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }}
734      - name: Verify generated files are up to date
735        uses: ./.github/actions/verify-generated-files
736      - name: Notify Slack
737        if: failure()
738        uses: ./.github/actions/notify-slack
739        with:
740          token: ${{ secrets.ACTION_MONITORING_SLACK }}
741  PECL:
742    if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch'
743    runs-on: ubuntu-22.04
744    env:
745      CC: ccache gcc
746      CXX: ccache g++
747    steps:
748      - name: git checkout PHP
749        uses: actions/checkout@v4
750        with:
751          path: php
752      - name: git checkout apcu
753        uses: actions/checkout@v4
754        with:
755          repository: krakjoe/apcu
756          path: apcu
757      - name: git checkout imagick
758        uses: actions/checkout@v4
759        with:
760          repository: Imagick/imagick
761          path: imagick
762      - name: git checkout memcached
763        uses: actions/checkout@v4
764        with:
765          repository: php-memcached-dev/php-memcached
766          path: memcached
767      - name: git checkout redis
768        uses: actions/checkout@v4
769        with:
770          repository: phpredis/phpredis
771          path: redis
772      - name: git checkout xdebug
773        uses: actions/checkout@v4
774        with:
775          repository: xdebug/xdebug
776          path: xdebug
777      - name: git checkout yaml
778        uses: actions/checkout@v4
779        with:
780          repository: php/pecl-file_formats-yaml
781          path: yaml
782      - name: apt
783        run: |
784          sudo apt-get update
785          sudo apt-get install -y --no-install-recommends \
786            ccache \
787            libmemcached-dev \
788            bison \
789            re2c
790      - name: ccache
791        uses: hendrikmuhs/ccache-action@v1.2
792        with:
793          key: "${{github.job}}-${{hashFiles('php/main/php_version.h')}}"
794          append-timestamp: false
795          save: ${{ github.event_name != 'pull_request' }}
796      - name: build PHP
797        run: |
798          cd php
799          ./buildconf --force
800          ./configure \
801            --enable-option-checking=fatal \
802            --prefix=/opt/php \
803            --enable-cli \
804            --disable-all \
805            --enable-session \
806            --enable-werror
807          make -j$(/usr/bin/nproc)
808          sudo make install
809      - name: build apcu
810        run: |
811          cd apcu
812          /opt/php/bin/phpize
813          ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config
814          make -j$(/usr/bin/nproc)
815      - name: build imagick
816        run: |
817          cd imagick
818          /opt/php/bin/phpize
819          ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config
820          make -j$(/usr/bin/nproc)
821      - name: build memcached
822        run: |
823          cd memcached
824          /opt/php/bin/phpize
825          ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config
826          make -j$(/usr/bin/nproc)
827      - name: build redis
828        run: |
829          cd redis
830          /opt/php/bin/phpize
831          ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config
832          make -j$(/usr/bin/nproc)
833      - name: build xdebug
834        run: |
835          cd xdebug
836          /opt/php/bin/phpize
837          ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config
838          make -j$(/usr/bin/nproc)
839      - name: build yaml
840        run: |
841          cd yaml
842          /opt/php/bin/phpize
843          ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config
844          make -j$(/usr/bin/nproc)
845      - name: Notify Slack
846        if: failure()
847        uses: ./.github/actions/notify-slack
848        with:
849          token: ${{ secrets.ACTION_MONITORING_SLACK }}
850  WINDOWS:
851    needs: GENERATE_MATRIX
852    if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
853    strategy:
854      fail-fast: false
855      matrix:
856        include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.windows-matrix-include) }}
857    name: "${{ matrix.branch.name }}_WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
858    runs-on: windows-2019
859    env:
860      PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
861      PHP_BUILD_OBJ_DIR: C:\obj
862      PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk
863      PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0
864      PHP_BUILD_CRT: vs16
865      PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }}
866      THREAD_SAFE: "${{ matrix.zts && '1' || '0' }}"
867      INTRINSICS: "${{ matrix.zts && 'AVX2' || '' }}"
868      PARALLEL: -j2
869      OPCACHE: "${{ matrix.opcache && '1' || '0' }}"
870    steps:
871      - name: git config
872        run: git config --global core.autocrlf false && git config --global core.eol lf
873      - name: git checkout
874        uses: actions/checkout@v4
875        with:
876          ref: ${{ matrix.branch.ref }}
877      - name: Setup
878        uses: ./.github/actions/setup-windows
879      - name: Build
880        run: .github/scripts/windows/build.bat
881      - name: Test
882        run: .github/scripts/windows/test.bat
883