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