PHP master branch build #104
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHP master branch build | |
on: | |
schedule: | |
- cron: 0 12 * * MON | |
workflow_dispatch: | |
jobs: | |
build-php: | |
name: Build PHP (Valgrind ${{ matrix.valgrind }}) | |
concurrency: php-debug-master-valgrind-${{ matrix.valgrind }}-ubuntu2204-${{ github.ref }} | |
strategy: | |
matrix: | |
valgrind: [0, 1] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install PHP build dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install \ | |
re2c | |
- name: Restore PHP build cache | |
uses: actions/cache@v4 | |
id: php-build-cache | |
with: | |
path: ${{ github.workspace }}/php | |
key: php-debug-master-valgrind-${{ matrix.valgrind }}-ubuntu2204-${{ github.run_id }} | |
- name: Install Valgrind | |
if: matrix.valgrind == '1' && steps.php-build-cache.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get update && sudo apt-get install valgrind | |
echo "CFLAGS=-DZEND_TRACK_ARENA_ALLOC=1" >> $GITHUB_ENV | |
echo "PHP_BUILD_CONFIGURE_OPTS=--with-valgrind" >> $GITHUB_ENV | |
- name: Get number of CPU cores | |
if: steps.php-build-cache.outputs.cache-hit != 'true' | |
uses: SimenB/github-actions-cpu-cores@v2 | |
id: cpu-cores | |
- name: Download PHP | |
if: steps.php-build-cache.outputs.cache-hit != 'true' | |
run: curl -L https://github.com/php/php-src/archive/master.tar.gz | tar -xz | |
- name: Compile PHP | |
if: steps.php-build-cache.outputs.cache-hit != 'true' | |
working-directory: php-src-master | |
run: | | |
./buildconf --force | |
./configure \ | |
--disable-all \ | |
--enable-cli \ | |
--enable-zts \ | |
--enable-debug \ | |
--enable-sockets \ | |
--enable-opcache \ | |
--enable-opcache-jit \ | |
"$PHP_BUILD_CONFIGURE_OPTS" \ | |
--prefix="${{ github.workspace }}/php" | |
make -j ${{ steps.cpu-cores.outputs.count }} install | |
test-extension: | |
name: Test (OPcache ${{ matrix.opcache }}, Valgrind tool ${{ matrix.valgrind-tool }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
opcache: | |
- "off" | |
- "on" | |
- "jit" | |
#- "jit-tracing" #borked until 8.3 due to php-src bugs | |
valgrind-tool: | |
- none | |
- memcheck | |
- drd | |
needs: build-php | |
runs-on: ubuntu-22.04 | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Restore PHP build cache | |
uses: actions/cache@v4 | |
id: php-build-cache | |
with: | |
path: ${{ github.workspace }}/php | |
key: php-debug-master-valgrind-${{ matrix.valgrind-tool != 'none' && 1 || 0 }}-ubuntu2204 | |
- name: Install Valgrind | |
if: matrix.valgrind-tool != 'none' | |
run: | | |
sudo apt-get update && sudo apt-get install valgrind | |
echo "TEST_PHP_ARGS=-M ${{ matrix.valgrind-tool }}" >> $GITHUB_ENV | |
echo "CFLAGS=-DZEND_TRACK_ARENA_ALLOC=1" >> $GITHUB_ENV | |
- name: Compile extension | |
run: | | |
$GITHUB_WORKSPACE/php/bin/phpize | |
./configure --with-php-config=$GITHUB_WORKSPACE/php/bin/php-config --with-pmmpthread-sockets | |
make install | |
- name: Generate php.ini | |
run: | | |
echo "extension=pmmpthread.so" > $GITHUB_WORKSPACE/php.ini | |
if [[ "${{ matrix.opcache }}" != "off" ]]; then | |
echo "Enabling OPcache" | |
#opcache is now statically compiled and mandatory in 8.5 | |
echo "opcache.enable=1" >> $GITHUB_WORKSPACE/php.ini | |
echo "opcache.enable_cli=1" >> $GITHUB_WORKSPACE/php.ini | |
echo "opcache.protect_memory=1" >> $GITHUB_WORKSPACE/php.ini | |
if [[ "${{ matrix.opcache }}" == "jit" ]]; then | |
echo "opcache.jit=1205" >> $GITHUB_WORKSPACE/php.ini | |
echo "opcache.jit_buffer_size=128M" >> $GITHUB_WORKSPACE/php.ini | |
elif [[ "${{ matrix.opcache }}" == "jit-tracing" ]]; then | |
echo "opcache.jit=tracing" >> $GITHUB_WORKSPACE/php.ini | |
echo "opcache.jit_buffer_size=128M" >> $GITHUB_WORKSPACE/php.ini | |
fi | |
else | |
echo "OPcache is not enabled for this run" | |
fi | |
- name: Run PHPT tests | |
run: | | |
$GITHUB_WORKSPACE/php/bin/php ./run-tests.php $TEST_PHP_ARGS -P -j$(nproc) -q --show-diff --show-slow 30000 -n -c $GITHUB_WORKSPACE/php.ini | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-master-valgrind-${{ matrix.valgrind-tool }}-opcache-${{ matrix.opcache }} | |
path: | | |
${{ github.workspace }}/tests/*.log | |
${{ github.workspace }}/tests/*.diff | |
${{ github.workspace }}/tests/*.mem | |
if-no-files-found: ignore |