From b655451439526e750d4e55898e2ec5f130c0cf42 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Sun, 25 Sep 2022 17:20:31 +0200 Subject: [PATCH] Backport community build to PHP-8.0 branch It doesn't make sense to keep it on azure because it will be run for the PHP-8.0 branch on nightly anyway, as the workflow is triggered on the master branch which will then invoke it for each branch. --- .github/workflows/nightly.yml | 100 ++++++++++++++++++++++++++++++++++ azure/apt.yml | 47 ---------------- azure/community_job.yml | 73 ------------------------- azure/configure.yml | 67 ----------------------- 4 files changed, 100 insertions(+), 187 deletions(-) delete mode 100644 azure/apt.yml delete mode 100644 azure/community_job.yml delete mode 100644 azure/configure.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 012462a14f0..12a5dfd8eeb 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -189,6 +189,106 @@ jobs: - name: Upload Test Coverage to Codecov.io if: always() run: bash <(curl -s https://codecov.io/bash) + COMMUNITY: + needs: GENERATE_MATRIX + if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} + strategy: + fail-fast: false + matrix: + branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} + name: "${{ matrix.branch.name }}_COMMUNITY" + runs-on: ubuntu-20.04 + env: + UBSAN_OPTIONS: print_stacktrace=1 + USE_ZEND_ALLOC: 0 + USE_TRACKED_ALLOC: 1 + steps: + - name: git checkout + uses: actions/checkout@v2 + with: + ref: ${{ matrix.branch.ref }} + - name: apt + uses: ./.github/actions/apt-x64 + - name: ./configure + uses: ./.github/actions/configure-x64 + with: + configurationParameters: >- + --enable-debug + --enable-zts + --enable-address-sanitizer + --enable-undefined-sanitizer + CFLAGS='-DZEND_TRACK_ARENA_ALLOC -fno-sanitize-recover' + - name: make + run: make -j$(/usr/bin/nproc) >/dev/null + - name: make install + uses: ./.github/actions/install-linux + - name: Setup + run: | + sudo service mysql start + mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test" + mysql -uroot -proot -e "SET GLOBAL local_infile = true" + - name: Enable Opcache and JIT + run: | + echo zend_extension=opcache.so > /etc/php.d/opcache.ini + echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini + echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini + echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini + - name: Test Laravel + if: github.ref != 'refs/heads/PHP-8.0' + run: | + git clone https://github.com/laravel/framework.git --branch=master --depth=1 + cd framework + git rev-parse HEAD + php /usr/bin/composer install --no-progress --ignore-platform-reqs + # Hack to disable a test that hangs + php -r '$c = file_get_contents("tests/Filesystem/FilesystemTest.php"); $c = str_replace("*/\n public function testSharedGet()", "* @group skip\n */\n public function testSharedGet()", $c); file_put_contents("tests/Filesystem/FilesystemTest.php", $c);' + export ASAN_OPTIONS=exitcode=139 + php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$? + if [ $EXIT_CODE -gt 128 ]; then + exit 1 + fi + - name: Test Symfony + if: github.ref != 'refs/heads/PHP-8.0' + run: | + git clone https://github.com/symfony/symfony.git --depth=1 + cd symfony + git rev-parse HEAD + php /usr/bin/composer install --no-progress --ignore-platform-reqs + php ./phpunit install + # Test causes a heap-buffer-overflow but I cannot reproduce it locally... + 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);' + # Buggy FFI test in Symfony, see https://github.com/symfony/symfony/issues/47668 + php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("*/\n public function testCastNonTrailingCharPointer()", "* @group skip\n */\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);' + export ASAN_OPTIONS=exitcode=139 + export SYMFONY_DEPRECATIONS_HELPER=max[total]=999 + X=0 + for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do + php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$? + if [ $EXIT_CODE -gt 128 ]; then + X=1; + fi + done + exit $X + - name: Test PHPUnit + if: always() + run: | + git clone https://github.com/sebastianbergmann/phpunit.git --branch=main --depth=1 + cd phpunit + git rev-parse HEAD + export ASAN_OPTIONS=exitcode=139 + php /usr/bin/composer install --no-progress --ignore-platform-reqs + php ./phpunit || EXIT_CODE=$? + if [ $EXIT_CODE -gt 128 ]; then + exit 1 + fi + - name: 'Symfony Preloading' + if: always() + run: | + php /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress --ignore-platform-reqs + cd symfony_demo + git rev-parse HEAD + sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php + php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php OPCACHE_VARIATION: needs: GENERATE_MATRIX if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} diff --git a/azure/apt.yml b/azure/apt.yml deleted file mode 100644 index 71f58ce8da2..00000000000 --- a/azure/apt.yml +++ /dev/null @@ -1,47 +0,0 @@ -parameters: - packages: '' - -steps: - - script: | - sudo apt-get update -y | true - sudo apt install bison \ - re2c \ - locales \ - ldap-utils \ - openssl \ - slapd \ - language-pack-de \ - re2c \ - libgmp-dev \ - libicu-dev \ - libtidy-dev \ - libenchant-dev \ - libaspell-dev \ - libpspell-dev \ - libsasl2-dev \ - libxpm-dev \ - libzip-dev \ - libsqlite3-dev \ - libwebp-dev \ - libonig-dev \ - libkrb5-dev \ - libgssapi-krb5-2 \ - libcurl4-openssl-dev \ - libxml2-dev \ - libxslt1-dev \ - libpq-dev \ - libreadline-dev \ - libldap2-dev \ - libsodium-dev \ - libargon2-0-dev \ - libmm-dev \ - libsnmp-dev \ - postgresql \ - postgresql-contrib \ - snmpd \ - snmp-mibs-downloader \ - unixodbc-dev \ - llvm \ - libc-client-dev libkrb5-dev dovecot-core dovecot-pop3d dovecot-imapd \ - ${{ parameters.packages }} - displayName: 'APT' diff --git a/azure/community_job.yml b/azure/community_job.yml deleted file mode 100644 index b1aacdea933..00000000000 --- a/azure/community_job.yml +++ /dev/null @@ -1,73 +0,0 @@ -parameters: - configurationName: '' - configurationParameters: '' - timeoutInMinutes: 60 - -# The purpose of the job is to test open-source community projects against an aggressive -# debug build, that enables assertions, as well as the address and UB sanitizers. However, -# we are only interested in finding assertion failures, segfaults and sanitizer violations, -# and don't care about the actual test results, as there will commonly be failures for -# pre-release versions of PHP. -# -# Because exit() in PHP results in an unclean shutdown, test runs are patching phpunit to -# avoid the exit, which allows us to also check for memory leaks. Otherwise we use -# USE_TRACKED_ALLOC=1 to avoid reporting of leaks that will be handled by ZMM. -jobs: - - job: ${{ parameters.configurationName }} - timeoutInMinutes: ${{ parameters.timeoutInMinutes }} - pool: - vmImage: 'ubuntu-20.04' - variables: - ubsan_options: 'print_stacktrace=1' - steps: - - template: apt.yml - - template: configure.yml - parameters: - configurationParameters: ${{ parameters.configurationParameters }} - - script: make -j$(/usr/bin/nproc) >/dev/null - displayName: 'Make Build' - - script: | - sudo make install - sudo mkdir /etc/php.d - sudo chmod 777 /etc/php.d - echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini - echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/pdo_mysql.ini - # Run with opcache to also catch optimizer bugs. - echo zend_extension=opcache.so > /etc/php.d/opcache.ini - echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini - echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini - echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini - displayName: 'Install Build' - - script: | - git clone https://github.com/amphp/amp.git --branch=master --depth=1 - cd amp - git rev-parse HEAD - php /usr/bin/composer install --no-progress --ignore-platform-reqs - export USE_ZEND_ALLOC=0 - sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php - php vendor/bin/phpunit - displayName: 'Test Amphp' - condition: or(succeeded(), failed()) - - script: | - git clone https://github.com/sebastianbergmann/phpunit.git --branch=master --depth=1 - cd phpunit - git rev-parse HEAD - export USE_ZEND_ALLOC=0 - export USE_TRACKED_ALLOC=1 - export ASAN_OPTIONS=exitcode=139 - php8.0 /usr/bin/composer install --no-progress - php ./phpunit - if [ $? -gt 128 ]; then - exit 1 - fi - displayName: 'Test PHPUnit' - - script: | - php8.0 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress - cd symfony_demo - git rev-parse HEAD - export USE_ZEND_ALLOC=0 - export USE_TRACKED_ALLOC=1 - sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php - php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php - displayName: 'Symfony Preloading' - condition: or(succeeded(), failed()) diff --git a/azure/configure.yml b/azure/configure.yml deleted file mode 100644 index 0bfbf6d92e0..00000000000 --- a/azure/configure.yml +++ /dev/null @@ -1,67 +0,0 @@ -parameters: - configurationParameters: '' - -steps: -- script: | - ./buildconf --force - ./configure ${{ parameters.configurationParameters }} \ - --enable-option-checking=fatal \ - --prefix=/usr \ - --enable-phpdbg \ - --enable-fpm \ - --with-pdo-mysql=mysqlnd \ - --with-mysqli=mysqlnd \ - --with-pgsql \ - --with-pdo-pgsql \ - --with-pdo-sqlite \ - --enable-intl \ - --without-pear \ - --enable-gd \ - --with-jpeg \ - --with-webp \ - --with-freetype \ - --with-xpm \ - --enable-exif \ - --with-zip \ - --with-zlib \ - --with-zlib-dir=/usr \ - --enable-soap \ - --enable-xmlreader \ - --with-xsl \ - --with-tidy \ - --enable-sysvsem \ - --enable-sysvshm \ - --enable-shmop \ - --enable-pcntl \ - --with-readline \ - --enable-mbstring \ - --with-curl \ - --with-gettext \ - --enable-sockets \ - --with-bz2 \ - --with-openssl \ - --with-gmp \ - --enable-bcmath \ - --enable-calendar \ - --enable-ftp \ - --with-pspell=/usr \ - --with-enchant=/usr \ - --with-kerberos \ - --enable-sysvmsg \ - --with-ffi \ - --enable-zend-test \ - --with-ldap \ - --with-ldap-sasl \ - --with-password-argon2 \ - --with-mhash \ - --with-sodium \ - --enable-dba \ - --with-snmp \ - --with-unixODBC \ - --with-imap \ - --with-kerberos \ - --with-imap-ssl \ - --enable-werror \ - --with-config-file-path=/etc \ - --with-config-file-scan-dir=/etc/php.d - displayName: 'Configure Build'