Added an example of using ThreadSafeArray as a channel #738
This file contains 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: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build-php: | |
name: Build PHP ${{ matrix.php }}, Valgrind ${{ matrix.valgrind }} | |
concurrency: php-debug-${{ matrix.php }}-valgrind-${{ matrix.valgrind }}-ubuntu2004-${{ github.ref }} | |
strategy: | |
matrix: | |
php: | |
- 8.1.23 | |
- 8.2.10 | |
- 8.3.0RC1 | |
valgrind: [0, 1] | |
runs-on: ubuntu-20.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@v3 | |
id: php-build-cache | |
with: | |
path: ${{ github.workspace }}/php | |
key: php-debug-${{ matrix.php }}-valgrind-${{ matrix.valgrind }}-ubuntu2004 | |
- 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@v1 | |
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/refs/tags/php-${{ matrix.php }}.tar.gz | tar -xz | |
- name: Compile PHP | |
if: steps.php-build-cache.outputs.cache-hit != 'true' | |
working-directory: php-src-php-${{ matrix.php }} | |
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 (PHP ${{ matrix.php }}, OPcache ${{ matrix.opcache }}, Valgrind ${{ matrix.valgrind }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
php: | |
- 8.1.23 | |
- 8.2.10 | |
- 8.3.0RC1 | |
valgrind: [0, 1] | |
opcache: | |
- "off" | |
- "on" | |
- "jit" | |
#- "jit-tracing" #borked until 8.3 due to php-src bugs | |
needs: build-php | |
runs-on: ubuntu-20.04 | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Restore PHP build cache | |
uses: actions/cache@v3 | |
id: php-build-cache | |
with: | |
path: ${{ github.workspace }}/php | |
key: php-debug-${{ matrix.php }}-valgrind-${{ matrix.valgrind }}-ubuntu2004 | |
- name: Install Valgrind | |
if: matrix.valgrind == '1' | |
run: | | |
sudo apt-get update && sudo apt-get install valgrind | |
echo "TEST_PHP_ARGS=-m" >> $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 | |
make install | |
- name: Generate php.ini | |
run: | | |
echo "extension=pmmpthread.so" > $GITHUB_WORKSPACE/php.ini | |
if [[ "${{ matrix.opcache }}" != "off" ]]; then | |
echo "Enabling OPcache" | |
echo "zend_extension=opcache.so" >> $GITHUB_WORKSPACE/php.ini | |
echo "opcache.enable=1" >> $GITHUB_WORKSPACE/php.ini | |
echo "opcache.enable_cli=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@v3 | |
with: | |
name: test-results-${{ matrix.php }}-valgrind-${{ matrix.valgrind }}-opcache-${{ matrix.opcache }} | |
path: | | |
${{ github.workspace }}/tests/*.log | |
${{ github.workspace }}/tests/*.diff | |
${{ github.workspace }}/tests/*.mem | |
if-no-files-found: ignore |