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