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