Skip to content

Test suite

Test suite #251

Workflow file for this run

name: Nightly
on:
schedule:
- cron: "0 1 * * *"
workflow_dispatch: ~
permissions:
contents: read
jobs:
GENERATE_MATRIX:
name: Generate Matrix
if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.set-matrix.outputs.branches }}
matrix-include: ${{ steps.set-matrix.outputs.matrix-include }}
windows-matrix-include: ${{ steps.set-matrix.outputs.windows-matrix-include }}
macos-matrix-include: ${{ steps.set-matrix.outputs.macos-matrix-include }}
steps:
- uses: actions/checkout@v4
with:
# Set fetch-depth to 0 to clone the full repository
# including all branches. This is required to find
# the correct commit hashes.
fetch-depth: 0
- name: Grab the commit mapping
uses: actions/cache@v3
with:
path: branch-commit-cache.json
# The cache key needs to change every time for the
# cache to be updated after this job finishes.
key: nightly-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
nightly-
- name: Generate Matrix
id: set-matrix
run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.head_ref || github.ref_name }}"
- name: Notify Slack
if: failure()
uses: ./.github/actions/notify-slack
with:
token: ${{ secrets.ACTION_MONITORING_SLACK }}
COMMUNITY:
needs: GENERATE_MATRIX
if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }}
strategy:
fail-fast: false
matrix:
branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
type: ['asan', 'verify_type_inference']
# These branches don't include type verification
exclude:
- { branch: { name: 'PHP-8.1', ref: 'PHP-8.1', major: 8, minor: 1 }, type: 'verify_type_inference' }
- { branch: { name: 'PHP-8.2', ref: 'PHP-8.2', major: 8, minor: 2 }, type: 'verify_type_inference' }
- { branch: { name: 'PHP-8.3', ref: 'PHP-8.3', major: 8, minor: 3 }, type: 'verify_type_inference' }
name: "${{ matrix.branch.name }}_COMMUNITY_${{ matrix.type }}"
runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }}
env:
ASAN_OPTIONS: exitcode=139
UBSAN_OPTIONS: print_stacktrace=1
USE_ZEND_ALLOC: 0
USE_TRACKED_ALLOC: 1
steps:
- name: git checkout
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch.ref }}
- name: apt
uses: ./.github/actions/apt-x64
- name: ./configure
uses: ./.github/actions/configure-x64
with:
# CFLAGS removes O2, so we have to add it again...
configurationParameters: >-
--enable-zts
${{ matrix.type == 'asan' && '--enable-debug CFLAGS="-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address"' || '' }}
${{ matrix.type == 'verify_type_inference' && 'CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE -O2"' || '' }}
- 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"
git fetch origin
git checkout origin/master .github/jit_check.php .github/nightly.php
- name: Enable Opcache
run: |
echo memory_limit=-1 >> /etc/php.d/opcache.ini
echo zend_extension=opcache.so > /etc/php.d/opcache.ini
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
echo opcache.enable=1 >> /etc/php.d/opcache.ini
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
echo opcache.memory_consumption=256M >> /etc/php.d/opcache.ini
echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini
echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini
echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini
- name: Enable JIT
run: |
echo opcache.jit=tracing >> /etc/php.d/opcache.ini
echo opcache.jit_buffer_size=128M >> /etc/php.d/opcache.ini
echo opcache.jit_max_root_traces=100000 >> /etc/php.d/opcache.ini
echo opcache.jit_max_side_traces=100000 >> /etc/php.d/opcache.ini
echo opcache.jit_max_exit_counters=100000 >> /etc/php.d/opcache.ini
echo opcache.jit_hot_loop=1 >> /etc/php.d/opcache.ini
echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini
echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini
echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini
php -v
- name: Test PHPSeclib
if: always()
run: |
git clone https://github.com/phpseclib/phpseclib --branch=master
cd phpseclib
git checkout 259bd9f1e8af11726ed74acf527c2c046549061b
export ASAN_OPTIONS=exitcode=139
export PHPSECLIB_ALLOW_JIT=1
php /usr/bin/composer install --no-progress --ignore-platform-reqs
php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $?
- name: Test Psalm
if: always()
run: |
git clone https://github.com/vimeo/psalm --depth 1
cd psalm
git rev-parse HEAD
export ASAN_OPTIONS=exitcode=139
# Needed to avoid overwriting JIT config
export PSALM_ALLOW_XDEBUG=1
php /usr/bin/composer install --no-progress --ignore-platform-reqs
php $GITHUB_WORKSPACE/.github/jit_check.php ./psalm --no-cache || exit $?
- name: Test PHPStan
if: matrix.branch.ref != 'PHP-8.2'
run: |
git clone https://github.com/phpstan/phpstan-src --depth 1
cd phpstan-src
git rev-parse HEAD
sed -E 's/phpVersion(.*)max[^)]+/phpVersion\1max(89999/g' conf/parametersSchema.neon -i
php /usr/bin/composer install --no-progress --ignore-platform-reqs
sed -i 's/public const IS/public const int IS/g' vendor/ondrejmirtes/better-reflection/src/Reflection/Adapter/*php
export ASAN_OPTIONS=exitcode=139
php $GITHUB_WORKSPACE/.github/jit_check.php bin/phpstan clear-result-cache
php $GITHUB_WORKSPACE/.github/jit_check.php bin/phpstan || exit $?
- name: Test multiple libraries and frameworks in parallel
if: matrix.branch.ref != 'PHP-8.0'
run: |
sudo prlimit --pid $$ --nofile=1048576:1048576
php $GITHUB_WORKSPACE/.github/nightly.php || exit $?
- name: 'Symfony Preloading'
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
- name: Notify Slack
if: failure()
uses: ./.github/actions/notify-slack
with:
token: ${{ secrets.ACTION_MONITORING_SLACK }}