Code cleanup #185
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 }} | |
- 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: Dump PHP info | |
run: $GITHUB_WORKSPACE/php/bin/php -i | |
- name: Build extension | |
run: | | |
$GITHUB_WORKSPACE/php/bin/phpize | |
./configure --with-php-config=$GITHUB_WORKSPACE/php/bin/php-config | |
make install | |
- name: Run .phpt tests | |
run: REPORT_EXIT_STATUS=1 NO_INTERACTION=1 TEST_PHP_ARGS="$TEST_PHP_ARGS --show-diff" make test | |
- name: Upload test results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{ matrix.php }}-debug-${{ matrix.debug }}-valgrind-${{ matrix.valgrind }}-zts-${{ matrix.zts }} | |
path: | | |
${{ github.workspace }}/tests/* | |
!${{ github.workspace }}/tests/*.phpt |