name: tests on: push: pull_request: workflow_dispatch: permissions: contents: read concurrency: group: tests-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: COMPOSER_NO_INTERACTION: 1 COMPOSER_PROCESS_TIMEOUT: 0 jobs: build-phpx: name: Build PHPX (PHP ${{ matrix.php }}) runs-on: ubuntu-latest timeout-minutes: 30 strategy: fail-fast: false matrix: php: ["8.4", "8.5"] env: PHPX_HOME: ${{ github.workspace }}/vendor/swoole/phpx steps: - name: Checkout TypePHP uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} coverage: none extensions: embed tools: composer:v2 - name: Patch php_hash.h C++ compatibility uses: ./.github/actions/patch-php-headers - name: Install native build dependencies run: | sudo apt-get update sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config - name: Install Composer dependencies run: composer install --prefer-dist --no-progress - name: Build PHPX shell: bash run: | cmake -S "${PHPX_HOME}" -B "${PHPX_HOME}/build" \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_TESTS=OFF \ -D BUILD_EXT=OFF \ -D GITHUB_ACTION=ON cmake --build "${PHPX_HOME}/build" --target phpx --parallel 2 test -f "${PHPX_HOME}/lib/libphpx.so" - name: Upload PHPX library uses: actions/upload-artifact@v4 with: name: libphpx-php-${{ matrix.php }} if-no-files-found: error retention-days: 1 path: vendor/swoole/phpx/lib/libphpx.so phpunit: name: PHPUnit (PHP ${{ matrix.php }}) runs-on: ubuntu-latest timeout-minutes: 30 needs: build-phpx strategy: fail-fast: false matrix: php: ["8.4", "8.5"] env: PHPX_HOME: ${{ github.workspace }}/vendor/swoole/phpx steps: - name: Checkout TypePHP uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} coverage: none extensions: embed, curl, redis, mbstring, ffi ini-values: ffi.enable=1 tools: composer:v2 - name: Patch php_hash.h C++ compatibility uses: ./.github/actions/patch-php-headers - name: Install native build dependencies run: | sudo apt-get update sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config - name: Install Composer dependencies run: composer install --prefer-dist --no-progress - name: Download PHPX library uses: actions/download-artifact@v4 with: name: libphpx-php-${{ matrix.php }} path: vendor/swoole/phpx/lib - name: Configure native library path shell: bash run: echo "LD_LIBRARY_PATH=${PHPX_HOME}/lib:$(php-config --prefix)/lib" >> "${GITHUB_ENV}" - name: Run PHPUnit run: vendor/bin/phpunit phpt: name: PHPT (PHP ${{ matrix.php }}) runs-on: ubuntu-latest timeout-minutes: 180 needs: build-phpx strategy: fail-fast: false matrix: php: ["8.4", "8.5"] env: PHPX_HOME: ${{ github.workspace }}/vendor/swoole/phpx NO_INTERACTION: 1 REPORT_EXIT_STATUS: 1 steps: - name: Checkout TypePHP uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} coverage: none extensions: embed, curl, redis, mbstring, ffi ini-values: ffi.enable=1 tools: composer:v2 - name: Patch php_hash.h C++ compatibility uses: ./.github/actions/patch-php-headers - name: Install native build dependencies run: | sudo apt-get update sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config - name: Install Composer dependencies run: composer install --prefer-dist --no-progress - name: Download PHPX library uses: actions/download-artifact@v4 with: name: libphpx-php-${{ matrix.php }} path: vendor/swoole/phpx/lib - name: Configure native library path shell: bash run: | test -f "${PHPX_HOME}/lib/libphpx.so" echo "LD_LIBRARY_PATH=${PHPX_HOME}/lib:$(php-config --prefix)/lib" >> "${GITHUB_ENV}" - name: Show build environment run: | php -v php --ini cmake --version c++ --version - name: Run compiler PHPT suite run: | mkdir -p build php run-tests.php -q -j2 -w build/failed-tests.txt -W build/test-results.txt tests/compiler - name: Upload PHPT failure artifacts if: failure() uses: actions/upload-artifact@v4 with: name: phpt-failures-php-${{ matrix.php }} if-no-files-found: ignore retention-days: 7 path: | build/failed-tests.txt build/test-results.txt php_test_results_*.txt tests/compiler/**/*.diff tests/compiler/**/*.log tests/compiler/**/*.out