CI #139
Workflow file for this run
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: | |
runs-on: ubuntu-20.04 | |
if: "!contains(github.event.head_commit.message, '[ci skip]')" | |
name: Tests (PHP ${{ matrix.php }}, Valgrind ${{ matrix.valgrind }}, Debug=${{ matrix.debug }}, ZTS=${{ matrix.zts }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
php: | |
- 8.1.26 | |
- 8.2.13 | |
- 8.3.0 | |
valgrind: [0, 1] | |
debug: [enable, disable] | |
zts: [enable, disable] | |
env: | |
CFLAGS: "-march=x86-64" | |
CXXFLAGS: "-march=x86-64" | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 "PHP_BUILD_CONFIGURE_OPTS=--with-valgrind" >> $GITHUB_ENV | |
- name: Restore PHP build cache | |
uses: actions/cache@v4 | |
id: php-build-cache | |
with: | |
path: ${{ github.workspace }}/php | |
key: php-${{ matrix.php }}-debug-${{ matrix.debug }}-valgrind-${{ matrix.valgrind }}-zts-${{ matrix.zts }}-generic | |
- name: Install PHP build dependencies | |
if: steps.php-build-cache.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get update && sudo apt-get install \ | |
re2c | |
- 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' | |
working-directory: /tmp | |
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: /tmp/php-src-php-${{ matrix.php }} | |
run: | | |
./buildconf --force | |
./configure \ | |
--disable-all \ | |
--enable-cli \ | |
--${{ matrix.zts }}-zts \ | |
--${{ matrix.debug}}-debug \ | |
"$PHP_BUILD_CONFIGURE_OPTS" \ | |
--prefix="${{ github.workspace }}/php" | |
make -j ${{ steps.cpu-cores.outputs.count }} install | |
- 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=encoding.so" > $GITHUB_WORKSPACE/php.ini | |
- name: Run PHPT tests | |
run: | | |
$GITHUB_WORKSPACE/php/bin/php ./run-tests.php $TEST_PHP_ARGS -P -q --show-diff --show-slow 30000 -n -c $GITHUB_WORKSPACE/php.ini | |
- name: Upload test results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{ matrix.php }}-valgrind-${{ matrix.valgrind }} | |
path: | | |
${{ github.workspace }}/tests/* | |
!${{ github.workspace }}/tests/*.phpt |