Skip to content

docs(readme): add fastchart to PHP Performance Toolkit cross-promo #2

docs(readme): add fastchart to PHP Performance Toolkit cross-promo

docs(readme): add fastchart to PHP Performance Toolkit cross-promo #2

Workflow file for this run

name: Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
validate:
name: Validate composer.json
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
tools: composer
coverage: none
- run: composer validate --strict
pie-smoke:
name: PIE install smoke
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
tools: phpize, php-config
coverage: none
- name: Install PIE build prerequisites
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends bison libtool-bin
- name: Cache LibXL
id: cache-libxl
uses: actions/cache@v5
with:
path: libxl-5.1.0
key: libxl-lin-5.1.0-v1
- name: Download LibXL
if: steps.cache-libxl.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://www.libxl.com/download/libxl-lin-5.1.0.tar.gz" -o libxl.tar.gz
tar xzf libxl.tar.gz
extracted=$(ls -d libxl-* | grep -v tar | head -1)
if [ "$extracted" != "libxl-5.1.0" ]; then
mv "$extracted" "libxl-5.1.0"
fi
- name: Download PIE
run: |
curl -fsSL -o /tmp/pie.phar https://github.com/php/pie/releases/latest/download/pie.phar
chmod +x /tmp/pie.phar
- name: PIE build smoke
run: |
php /tmp/pie.phar repository:add path .
php /tmp/pie.phar build iliaal/php-excel:*@dev \
--with-excel \
--with-libxl-incdir=$PWD/libxl-5.1.0/include_c \
--with-libxl-libdir=$PWD/libxl-5.1.0/lib64
linux:
name: PHP ${{ matrix.php }} - libxl ${{ matrix.libxl }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.3', '8.4', '8.5']
libxl: ['5.1.0']
include:
- php: '8.4'
libxl: '4.6.0'
steps:
- uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: phpize, php-config
- name: Cache LibXL
id: cache-libxl
uses: actions/cache@v5
with:
path: libxl-${{ matrix.libxl }}
key: libxl-lin-${{ matrix.libxl }}-v1
- name: Download LibXL
if: steps.cache-libxl.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://www.libxl.com/download/libxl-lin-${{ matrix.libxl }}.tar.gz" -o libxl.tar.gz
tar xzf libxl.tar.gz
# tarball extracts as libxl-X.Y.Z.0, normalize to libxl-X.Y.Z
extracted=$(ls -d libxl-* | grep -v tar | head -1)
if [ "$extracted" != "libxl-${{ matrix.libxl }}" ]; then
mv "$extracted" "libxl-${{ matrix.libxl }}"
fi
ls libxl-${{ matrix.libxl }}/include_c/libxl.h
- name: Build extension
run: |
phpize
./configure \
--with-excel \
--with-libxl-incdir=${{ github.workspace }}/libxl-${{ matrix.libxl }}/include_c \
--with-libxl-libdir=${{ github.workspace }}/libxl-${{ matrix.libxl }}/lib64
WARNINGS=$(make -j$(nproc) 2>&1 | tee /dev/stderr | grep -c 'warning:' || true)
if [ "$WARNINGS" -gt 0 ]; then
echo "::error::Build produced $WARNINGS warning(s)"
exit 1
fi
- name: Run tests
if: matrix.libxl == '5.1.0'
run: |
export LD_LIBRARY_PATH="${{ github.workspace }}/libxl-${{ matrix.libxl }}/lib64"
export TEST_PHP_EXECUTABLE=$(which php)
export TEST_PHP_ARGS="-d extension=$(pwd)/modules/excel.so"
export NO_INTERACTION=1
RESULT=$(php run-tests.php --show-diff -g FAIL,BORK,LEAK,XLEAK tests/ 2>&1)
echo "$RESULT"
FAILED=$(echo "$RESULT" | grep 'Tests failed' | grep -oP '\d+' | head -1)
if [ "$FAILED" -gt 0 ]; then
echo "::error::$FAILED test(s) failed"
exit 1
fi
linux-zts:
name: PHP ${{ matrix.php }} ZTS - Linux (canary)
runs-on: ubuntu-latest
env:
PHPTS: zts
strategy:
fail-fast: false
matrix:
php: ['8.4']
steps:
- uses: actions/checkout@v6
- name: Setup PHP (ZTS)
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: phpize, php-config
coverage: none
- name: Cache LibXL
id: cache-libxl
uses: actions/cache@v5
with:
path: libxl-5.1.0
key: libxl-lin-5.1.0-v1
- name: Download LibXL
if: steps.cache-libxl.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://www.libxl.com/download/libxl-lin-5.1.0.tar.gz" -o libxl.tar.gz
tar xzf libxl.tar.gz
extracted=$(ls -d libxl-* | grep -v tar | head -1)
if [ "$extracted" != "libxl-5.1.0" ]; then
mv "$extracted" "libxl-5.1.0"
fi
- name: Build extension under ZTS
run: |
phpize
./configure \
--with-excel \
--with-libxl-incdir=${{ github.workspace }}/libxl-5.1.0/include_c \
--with-libxl-libdir=${{ github.workspace }}/libxl-5.1.0/lib64 \
--with-php-config=$(which php-config)
make -j$(nproc)
- name: Run tests under ZTS
run: |
export LD_LIBRARY_PATH="${{ github.workspace }}/libxl-5.1.0/lib64"
export TEST_PHP_EXECUTABLE=$(which php)
export TEST_PHP_ARGS="-d extension=$(pwd)/modules/excel.so"
export NO_INTERACTION=1
RESULT=$(php run-tests.php --show-diff -g FAIL,BORK,LEAK,XLEAK tests/ 2>&1)
echo "$RESULT"
FAILED=$(echo "$RESULT" | grep 'Tests failed' | grep -oP '\d+' | head -1)
if [ "$FAILED" -gt 0 ]; then
echo "::error::$FAILED test(s) failed under ZTS"
exit 1
fi
asan:
name: PHP ${{ matrix.php }} - ASAN
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.4']
env:
ASAN_OPTIONS: exitcode=139:verify_asan_link_order=0:detect_odr_violation=0
UBSAN_OPTIONS: print_stacktrace=1
USE_ZEND_ALLOC: 0
USE_TRACKED_ALLOC: 1
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y llvm clang re2c bison autoconf
- name: Build PHP with ASAN
run: |
git clone --depth=1 --branch=PHP-${{ matrix.php }} https://github.com/php/php-src.git /tmp/php-src
cd /tmp/php-src
./buildconf --force
CC=clang CXX=clang++ \
CFLAGS="-fsanitize=address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC" \
LDFLAGS="-fsanitize=address" \
./configure \
--enable-debug \
--enable-zts \
--disable-all \
--enable-cli \
--prefix=/tmp/php-asan
make -j$(nproc)
make install
- name: Cache LibXL
id: cache-libxl
uses: actions/cache@v5
with:
path: libxl-5.1.0
key: libxl-lin-5.1.0-v1
- name: Download LibXL
if: steps.cache-libxl.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://www.libxl.com/download/libxl-lin-5.1.0.tar.gz" -o libxl.tar.gz
tar xzf libxl.tar.gz
extracted=$(ls -d libxl-* | grep -v tar | head -1)
if [ "$extracted" != "libxl-5.1.0" ]; then
mv "$extracted" "libxl-5.1.0"
fi
- name: Build extension with ASAN
run: |
export PATH="/tmp/php-asan/bin:$PATH"
phpize
CC=clang CXX=clang++ \
CFLAGS="-fsanitize=address -DZEND_TRACK_ARENA_ALLOC" \
LDFLAGS="-fsanitize=address" \
./configure \
--with-excel \
--with-libxl-incdir=${{ github.workspace }}/libxl-5.1.0/include_c \
--with-libxl-libdir=${{ github.workspace }}/libxl-5.1.0/lib64 \
--with-php-config=/tmp/php-asan/bin/php-config
make -j$(nproc)
- name: Run tests under ASAN
run: |
export LD_LIBRARY_PATH="${{ github.workspace }}/libxl-5.1.0/lib64"
export LD_PRELOAD=$(clang -print-file-name=libclang_rt.asan-x86_64.so):$(dpkg -L libstdc++-dev | grep 'libstdc++.so$' | head -1 || echo /usr/lib/x86_64-linux-gnu/libstdc++.so)
export TEST_PHP_EXECUTABLE=/tmp/php-asan/bin/php
export TEST_PHP_ARGS="-d extension=$(pwd)/modules/excel.so"
export NO_INTERACTION=1
/tmp/php-asan/bin/php run-tests.php --show-diff --asan -g FAIL,BORK,LEAK,XLEAK tests/ 2>&1 | tee /tmp/test-output.txt || true
if grep -qP 'Tests failed\s*:\s*[1-9]' /tmp/test-output.txt; then
echo "::error::Tests failed under ASAN"
exit 1
fi