name: Tests on: push: branches: [5.x] pull_request: schedule: - cron: '0 9 * * *' concurrency: group: tests-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true permissions: contents: read jobs: tests: if: github.event_name != 'schedule' || github.repository == 'pestphp/pest' runs-on: ${{ matrix.os }} timeout-minutes: 15 strategy: fail-fast: true matrix: os: [ubuntu-latest, macos-latest] # windows-latest symfony: ['8.0'] php: ['8.4', '8.5'] dependency_version: [prefer-stable] name: PHP ${{ matrix.php }} - Symfony ^${{ matrix.symfony }} - ${{ matrix.os }} - ${{ matrix.dependency_version }} steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Setup PHP uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2 with: php-version: ${{ matrix.php }} tools: composer:v2 coverage: none extensions: sockets - name: Get Composer cache directory id: composer-cache shell: bash run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ matrix.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json', '**/composer.lock') }} restore-keys: | ${{ matrix.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- ${{ matrix.os }}-php-${{ matrix.php }}-composer- - name: Setup Problem Matches run: | echo "::add-matcher::${{ runner.tool_cache }}/php.json" echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Install PHP dependencies shell: bash env: COMPOSER_ROOT_VERSION: 5.x-dev run: composer update --${{ matrix.dependency_version }} --no-interaction --no-progress --ansi --with="symfony/console:^${{ matrix.symfony }}" - name: Unit Tests run: composer test:unit - name: Parallel Tests run: composer test:parallel - name: Integration Tests run: composer test:integration tia: if: github.event_name != 'schedule' || github.repository == 'pestphp/pest' runs-on: ubuntu-latest timeout-minutes: 30 strategy: fail-fast: true matrix: php: ['8.4'] coverage: [xdebug] name: TIA - PHP ${{ matrix.php }} - ${{ matrix.coverage }} - ubuntu-latest # The `tests` matrix runs with `coverage: none`, which leaves half of TIA # untested: recording a dependency graph needs a coverage driver, and the # scenarios fall back to a seeded graph without one. This job is the other # half — and the only place the driver-specific recording code runs at all. # # Off for *this* suite, on for the subprocesses each scenario spawns (see # `Project::pestWithEnvironment()`): they are the ones that record, and # collecting Pest's own ~2000 tests under xdebug costs more than every # scenario put together. env: XDEBUG_MODE: 'off' steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Setup PHP uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2 with: php-version: ${{ matrix.php }} tools: composer:v2 coverage: ${{ matrix.coverage }} extensions: sockets - name: Get Composer cache directory id: composer-cache shell: bash run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5 with: path: ${{ steps.composer-cache.outputs.dir }} key: ubuntu-latest-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json', '**/composer.lock') }} restore-keys: | ubuntu-latest-php-${{ matrix.php }}-composer- - name: Install PHP dependencies shell: bash env: COMPOSER_ROOT_VERSION: 5.x-dev run: composer update --prefer-stable --no-interaction --no-progress --ansi # A missing driver would not fail these rows — they fall back to a seeded # graph and stay green — so the job has to check for itself that the thing # it exists to exercise is present, and that a scenario subprocess gets it. - name: Assert xdebug is present, and reaches a scenario subprocess run: | php -r 'exit(extension_loaded("xdebug") ? 0 : 1);' XDEBUG_MODE=coverage php -r 'exit(in_array("coverage", (array) xdebug_info("mode"), true) ? 0 : 1);' - name: TIA Scenario Tests run: composer test:tia