name: Tests

on:
    push:
    pull_request:

jobs:

    test:
        name: PHPUnit Tests
        runs-on: ubuntu-latest

        env:
            COMPOSER_ROOT_VERSION: 1.x-dev

        strategy:
            matrix:
                include:
                    - php: '7.2'
                    - php: '7.3'
                    - php: '7.4'
                    - php: '8.0'
                    - php: '8.1'
                    - php: '8.2'
                    - php: '8.3'
                    - php: '8.4'
                    - php: '8.5'
            fail-fast: false

        steps:
            -   name: Checkout
                uses: actions/checkout@v4

            -   name: Setup PHP
                uses: shivammathur/setup-php@v2
                with:
                    coverage: "none"
                    extensions: "apcu, intl-73.2, mbstring, odbc, uuid"
                    ini-values: "memory_limit=-1, session.gc_probability=0, apc.enable_cli=1"
                    php-version: "${{ matrix.php }}"
                    tools: "composer:v2"

            -   name: Install dependencies
                run: |
                    composer --prefer-source --no-progress --ansi install
                    ./phpunit install

            -   name: Run tests
                run: |
                    ok=0
                    ./phpunit || ok=1
                    [[ "${{ matrix.mode }}" = experimental ]] || (exit $ok)
