From 8e35f7f19b59ed868d850e309304b58fe6fd8c84 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Sun, 30 Oct 2022 11:20:12 +0100 Subject: [PATCH] Migrate i386 to GitHub actions --- .github/actions/apt-x32/action.yml | 52 ++++++++++++++ .../actions/configure-x32/action.yml | 50 ++++--------- .github/actions/install-linux-x32/action.yml | 15 ++++ .github/actions/test-linux/action.yml | 4 +- {azure => .github}/lsan-suppressions.txt | 0 .github/workflows/nightly.yml | 71 +++++++++++++++++++ .github/workflows/push.yml | 41 +++++++++++ azure-pipelines.yml | 51 ------------- azure/i386/apt.yml | 46 ------------ azure/test.yml | 33 --------- azure/tests.yml | 35 --------- ext/ffi/tests/300.phpt | 2 + ext/ffi/tests/bug78761.phpt | 2 + ext/pcntl/tests/pcntl_unshare_04.phpt | 5 ++ ext/standard/tests/mail/gh7875.phpt | 5 ++ run-tests.php | 2 +- 16 files changed, 209 insertions(+), 205 deletions(-) create mode 100644 .github/actions/apt-x32/action.yml rename azure/i386/job.yml => .github/actions/configure-x32/action.yml (52%) create mode 100644 .github/actions/install-linux-x32/action.yml rename {azure => .github}/lsan-suppressions.txt (100%) delete mode 100644 azure-pipelines.yml delete mode 100644 azure/i386/apt.yml delete mode 100644 azure/test.yml delete mode 100644 azure/tests.yml diff --git a/.github/actions/apt-x32/action.yml b/.github/actions/apt-x32/action.yml new file mode 100644 index 0000000000000..2cde60fce55b0 --- /dev/null +++ b/.github/actions/apt-x32/action.yml @@ -0,0 +1,52 @@ +name: apt +runs: + using: composite + steps: + - shell: bash + run: | + set -x + + export DEBIAN_FRONTEND=noninteractive + dpkg --add-architecture i386 + apt-get update -y | true + # TODO: Reenable postgresql + postgresql-contrib packages once they work again. + apt-get install -y \ + autoconf \ + bison \ + g++-multilib \ + gcc-multilib \ + language-pack-de \ + libaspell-dev:i386 \ + libbz2-dev:i386 \ + libc6:i386 \ + libcurl4-openssl-dev:i386 \ + libffi-dev:i386 \ + libfreetype6-dev:i386 \ + libgmp-dev:i386 \ + libgssapi-krb5-2:i386 \ + libicu-dev:i386 \ + libjpeg-dev:i386 \ + libkrb5-dev:i386 \ + libonig-dev:i386 \ + libpng-dev:i386 \ + libpq-dev:i386 \ + libpspell-dev:i386 \ + libreadline-dev:i386 \ + libsasl2-dev:i386 \ + libsodium-dev:i386 \ + libsqlite3-dev:i386 \ + libssl-dev:i386 \ + libtidy-dev:i386 \ + libwebp-dev:i386 \ + libxml2-dev:i386 \ + libxml2-dev:i386 \ + libxpm-dev:i386 \ + libxslt1-dev:i386 \ + libzip-dev:i386 \ + locales \ + make \ + pkg-config:i386 \ + re2c \ + unzip \ + wget \ + zlib1g-dev:i386 diff --git a/azure/i386/job.yml b/.github/actions/configure-x32/action.yml similarity index 52% rename from azure/i386/job.yml rename to .github/actions/configure-x32/action.yml index 6f677bc9310b6..bbe819c23af24 100644 --- a/azure/i386/job.yml +++ b/.github/actions/configure-x32/action.yml @@ -1,22 +1,20 @@ -parameters: - configurationName: '' - configurationParameters: '' - timeoutInMinutes: 75 +name: ./configure +inputs: + configurationParameters: + default: '' + required: false +runs: + using: composite + steps: + - shell: bash + run: | + set -x -jobs: - - job: ${{ parameters.configurationName }} - timeoutInMinutes: ${{ parameters.timeoutInMinutes }} - pool: - vmImage: 'ubuntu-20.04' - steps: - - template: apt.yml - - script: | ./buildconf --force export CFLAGS="-m32 -msse2" export CXXFLAGS="-m32 -msse2" export LDFLAGS=-L/usr/lib/i386-linux-gnu - export PKG_CONFIG=/usr/bin/i686-linux-gnu-pkg-config - ./configure ${{ parameters.configurationParameters }} \ + ./configure ${{ inputs.configurationParameters }} \ --enable-option-checking=fatal \ --prefix=/usr \ --enable-phpdbg \ @@ -67,27 +65,3 @@ jobs: --enable-werror \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d - displayName: 'Configure Build' - - script: make -j$(/usr/bin/nproc) >/dev/null - displayName: 'Make Build' - - script: | - set -e - 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 - echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini - echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini - displayName: 'Install Build' - - script: | - set -e - sudo service mysql start - mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test" - #sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" - #sudo -u postgres psql -c "CREATE DATABASE test;" - displayName: 'Setup' - - template: ../tests.yml - parameters: - configurationName: ${{ parameters.configurationName }} - runTestsParameters: ${{ parameters.runTestsParameters }} diff --git a/.github/actions/install-linux-x32/action.yml b/.github/actions/install-linux-x32/action.yml new file mode 100644 index 0000000000000..bf5f09cd779d4 --- /dev/null +++ b/.github/actions/install-linux-x32/action.yml @@ -0,0 +1,15 @@ +name: Install +runs: + using: composite + steps: + - shell: bash + run: | + set -x + make install + mkdir /etc/php.d + 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 + echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini + echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini + echo opcache.preload_user=root >> /etc/php.d/opcache.ini diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index 7db8fa58900d3..a4b71e21d6957 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -11,7 +11,9 @@ runs: set -x export MYSQL_TEST_USER=root export MYSQL_TEST_PASSWD=root - export PDO_MYSQL_TEST_DSN="mysql:host=localhost;dbname=test" + if [[ -z "$PDO_MYSQL_TEST_DSN" ]]; then + export PDO_MYSQL_TEST_DSN="mysql:host=localhost;dbname=test" + fi export PDO_MYSQL_TEST_USER=root export PDO_MYSQL_TEST_PASS=root export PDO_DBLIB_TEST_DSN="dblib:host=127.0.0.1;dbname=master;version=7.0" diff --git a/azure/lsan-suppressions.txt b/.github/lsan-suppressions.txt similarity index 100% rename from azure/lsan-suppressions.txt rename to .github/lsan-suppressions.txt diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index eb78fef3bea95..4e8162c7b6990 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -102,6 +102,77 @@ jobs: -d opcache.jit=1205 - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files + LINUX_X32: + needs: GENERATE_MATRIX + if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} + strategy: + fail-fast: false + matrix: + branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} + debug: [true, false] + zts: [true, false] + name: "${{ matrix.branch.name }}_LINUX_X32_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" + runs-on: ubuntu-latest + container: + image: ubuntu:20.04 + env: + MYSQL_TEST_HOST: mysql + PDO_MYSQL_TEST_DSN: mysql:host=mysql;dbname=test + PDO_MYSQL_TEST_HOST: mysql + services: + mysql: + image: mysql:8 + ports: + - 3306:3306 + env: + MYSQL_DATABASE: test + MYSQL_ROOT_PASSWORD: root + steps: + - name: git checkout + uses: actions/checkout@v3 + with: + ref: ${{ matrix.branch.ref }} + - name: apt + uses: ./.github/actions/apt-x32 + - name: ./configure + uses: ./.github/actions/configure-x32 + with: + configurationParameters: >- + --${{ matrix.debug && 'enable' || 'disable' }}-debug + --${{ matrix.zts && 'enable' || 'disable' }}-zts + - name: make + run: make -j$(/usr/bin/nproc) >/dev/null + - name: make install + uses: ./.github/actions/install-linux-x32 + - name: Test + uses: ./.github/actions/test-linux + with: + runTestsParameters: >- + ${{ matrix.run_tests_parameters }} + - name: Test Tracing JIT + uses: ./.github/actions/test-linux + with: + runTestsParameters: >- + ${{ matrix.run_tests_parameters }} + -d zend_extension=opcache.so + -d opcache.enable_cli=1 + -d opcache.jit_buffer_size=16M + - name: Test OpCache + uses: ./.github/actions/test-linux + with: + runTestsParameters: >- + ${{ matrix.run_tests_parameters }} + -d zend_extension=opcache.so + -d opcache.enable_cli=1 + - name: Test Function JIT + uses: ./.github/actions/test-linux + with: + runTestsParameters: >- + ${{ matrix.run_tests_parameters }} + -d zend_extension=opcache.so + -d opcache.enable_cli=1 + -d opcache.jit_buffer_size=16M + -d opcache.jit=1205 MACOS: needs: GENERATE_MATRIX if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index f779237c2b15f..0e29c87e55034 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -61,6 +61,47 @@ jobs: -d opcache.jit_buffer_size=16M - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files + LINUX_X32: + name: LINUX_X32_DEBUG_ZTS + runs-on: ubuntu-latest + container: + image: ubuntu:20.04 + env: + MYSQL_TEST_HOST: mysql + PDO_MYSQL_TEST_DSN: mysql:host=mysql;dbname=test + PDO_MYSQL_TEST_HOST: mysql + services: + mysql: + image: mysql:8 + ports: + - 3306:3306 + env: + MYSQL_DATABASE: test + MYSQL_ROOT_PASSWORD: root + steps: + - name: git checkout + uses: actions/checkout@v3 + - name: apt + uses: ./.github/actions/apt-x32 + - name: ./configure + uses: ./.github/actions/configure-x32 + with: + configurationParameters: >- + --enable-debug + --enable-zts + - name: make + run: make -j$(/usr/bin/nproc) >/dev/null + - name: make install + uses: ./.github/actions/install-linux-x32 + - name: Test + uses: ./.github/actions/test-linux + - name: Test Tracing JIT + uses: ./.github/actions/test-linux + with: + runTestsParameters: >- + -d zend_extension=opcache.so + -d opcache.enable_cli=1 + -d opcache.jit_buffer_size=16M MACOS_DEBUG_NTS: runs-on: macos-11 steps: diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 76552b4853315..0000000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,51 +0,0 @@ -trigger: - batch: true - branches: - include: - - PHP-7.4 - - PHP-8.0 - - PHP-8.1 - - master - paths: - exclude: - - docs/* - - NEWS - - UPGRADING - - UPGRADING.INTERNALS - -schedules: - - cron: "0 1 * * *" - displayName: Nightly build - branches: - include: - - PHP-7.4 - - PHP-8.0 - - PHP-8.1 - - master - -jobs: - - template: azure/i386/job.yml - parameters: - configurationName: I386_DEBUG_ZTS - configurationParameters: '--enable-debug --enable-zts' - - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: - - template: azure/i386/job.yml - parameters: - configurationName: I386_DEBUG_NTS - configurationParameters: '--enable-debug --disable-zts' - - template: azure/i386/job.yml - parameters: - configurationName: I386_RELEASE_NTS - configurationParameters: '--disable-debug --disable-zts' - - template: azure/i386/job.yml - parameters: - configurationName: I386_RELEASE_ZTS - configurationParameters: '--disable-debug --enable-zts' - - template: azure/community_job.yml - parameters: - configurationName: COMMUNITY - configurationParameters: >- - --enable-debug --enable-zts - CFLAGS='-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC' - LDFLAGS='-fsanitize=undefined,address' - timeoutInMinutes: 90 diff --git a/azure/i386/apt.yml b/azure/i386/apt.yml deleted file mode 100644 index e9aa38681209f..0000000000000 --- a/azure/i386/apt.yml +++ /dev/null @@ -1,46 +0,0 @@ -parameters: - packages: '' - -steps: - - script: | - sudo dpkg --add-architecture i386 - sudo apt-get update -y | true - sudo apt-get install -y gcc-multilib - sudo apt-get install -y g++-multilib - sudo apt-get purge -y libxml2 - # TODO: Reenable postgresql + postgresql-contrib packages once they work again. - sudo apt-get purge -y libpq5 - sudo apt-get install -y libc6:i386 - sudo apt-get install -y bison \ - re2c \ - locales \ - language-pack-de \ - libssl-dev:i386 \ - zlib1g-dev:i386 \ - libxml2-dev:i386 \ - libgmp-dev:i386 \ - libicu-dev:i386 \ - libtidy-dev:i386 \ - libaspell-dev:i386 \ - libpspell-dev:i386 \ - libsasl2-dev:i386 \ - libxpm-dev:i386 \ - libjpeg-dev:i386 \ - libpng-dev:i386 \ - libzip-dev:i386 \ - libbz2-dev:i386 \ - libsqlite3-dev:i386 \ - libwebp-dev:i386 \ - libonig-dev:i386 \ - libkrb5-dev:i386 \ - libgssapi-krb5-2:i386 \ - libcurl4-openssl-dev:i386 \ - libxml2-dev:i386 \ - libxslt1-dev:i386 \ - libpq-dev:i386 \ - libreadline-dev:i386 \ - libffi-dev:i386 \ - libfreetype6-dev:i386 \ - libsodium-dev:i386 \ - ${{ parameters.packages }} - displayName: 'APT' diff --git a/azure/test.yml b/azure/test.yml deleted file mode 100644 index 1e2e1d6a1e3ed..0000000000000 --- a/azure/test.yml +++ /dev/null @@ -1,33 +0,0 @@ -parameters: - runTestsName: '' - runTestsParameters: '' - -steps: - - script: | - export MYSQL_TEST_USER=root - export MYSQL_TEST_PASSWD=root - export PDO_MYSQL_TEST_DSN="mysql:host=localhost;dbname=test" - export PDO_MYSQL_TEST_USER=root - export PDO_MYSQL_TEST_PASS=root - export TEST_PHP_JUNIT=junit.xml - export REPORT_EXIT_STATUS=no - export SKIP_IO_CAPTURE_TESTS=1 - rm -rf junit.xml | true - php run-tests.php -P -q \ - -j$(/usr/bin/nproc) \ - -g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP \ - --offline \ - --show-diff \ - --show-slow 1000 \ - --set-timeout 120 \ - ${{ parameters.runTestsParameters }} - displayName: 'Test ${{ parameters.configurationName }} ${{ parameters.runTestsName }}' - condition: or(succeeded(), failed()) - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'JUnit' - testResultsFiles: junit.xml - testRunTitle: '${{ parameters.configurationName }} ${{ parameters.runTestsName }}' - failTaskOnFailedTests: true - displayName: 'Export ${{ parameters.configurationName }} ${{ parameters.runTestsName }} Results' - condition: or(succeeded(), failed()) diff --git a/azure/tests.yml b/azure/tests.yml deleted file mode 100644 index 7cbd1e56360b4..0000000000000 --- a/azure/tests.yml +++ /dev/null @@ -1,35 +0,0 @@ -parameters: - configurationName: '' - runTestsParameters: '' - -steps: - - template: test.yml - parameters: - configurationName: ${{ parameters.configurationName }} - runTestsParameters: ${{ parameters.runTestsParameters }} - - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: - - template: test.yml - parameters: - configurationName: ${{ parameters.configurationName }} - runTestsName: 'OpCache' - runTestsParameters: >- - ${{ parameters.runTestsParameters }} - -d zend_extension=opcache.so - - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: - - template: test.yml - parameters: - configurationName: ${{ parameters.configurationName }} - runTestsName: 'Function JIT' - runTestsParameters: >- - ${{ parameters.runTestsParameters }} - -d zend_extension=opcache.so - -d opcache.jit_buffer_size=16M - -d opcache.jit=1205 - - template: test.yml - parameters: - configurationName: ${{ parameters.configurationName }} - runTestsName: 'Tracing JIT' - runTestsParameters: >- - ${{ parameters.runTestsParameters }} - -d zend_extension=opcache.so - -d opcache.jit_buffer_size=16M diff --git a/ext/ffi/tests/300.phpt b/ext/ffi/tests/300.phpt index fd81498026669..f1cab3bd552cd 100644 --- a/ext/ffi/tests/300.phpt +++ b/ext/ffi/tests/300.phpt @@ -4,6 +4,8 @@ FFI 300: FFI preloading + + --INI-- ffi.enable=1 opcache.enable=1 diff --git a/ext/ffi/tests/bug78761.phpt b/ext/ffi/tests/bug78761.phpt index 0e6ae1b3b84f1..0d3e047b34ae5 100644 --- a/ext/ffi/tests/bug78761.phpt +++ b/ext/ffi/tests/bug78761.phpt @@ -4,6 +4,8 @@ Bug #78761 (Zend memory heap corruption with preload and casting) --INI-- opcache.enable_cli=1 diff --git a/ext/pcntl/tests/pcntl_unshare_04.phpt b/ext/pcntl/tests/pcntl_unshare_04.phpt index fdd47d5d668dd..0151b4f6358eb 100644 --- a/ext/pcntl/tests/pcntl_unshare_04.phpt +++ b/ext/pcntl/tests/pcntl_unshare_04.phpt @@ -5,6 +5,11 @@ pcntl_unshare() with wrong flag if (!extension_loaded("pcntl")) die("skip"); if (!extension_loaded("posix")) die("skip posix extension not available"); if (!function_exists("pcntl_unshare")) die("skip pcntl_unshare is not available"); +try { + if (@pcntl_unshare(42) == false && pcntl_get_last_error() == PCNTL_EPERM) { + die('skip Insufficient previleges'); + } +} catch (\ValueError $e) {} ?> --FILE-- --FILE--