|
5 | 5 | pull_request: |
6 | 6 | workflow_dispatch: |
7 | 7 |
|
| 8 | +env: |
| 9 | + COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist --no-plugins" |
| 10 | + COMPOSER_UPDATE_FLAGS: "" |
| 11 | + |
8 | 12 | jobs: |
9 | | - ci: |
10 | | - uses: ray-di/.github/.github/workflows/continuous-integration.yml@v1 |
11 | | - with: |
12 | | - old_stable: '["8.1", "8.2", "8.3"]' |
13 | | - current_stable: 8.4 |
14 | | - script: demo/run.php |
| 13 | + phpunit: |
| 14 | + name: PHPUnit - PHP ${{ matrix.php-version }} (${{ matrix.os }}, ${{ matrix.dependencies }}) |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + # PHP 8.1 |
| 21 | + - {php-version: "8.1", os: ubuntu-latest, dependencies: highest, experimental: false} |
| 22 | + - {php-version: "8.1", os: ubuntu-latest, dependencies: lowest, experimental: false} |
| 23 | + # PHP 8.2 |
| 24 | + - {php-version: "8.2", os: ubuntu-latest, dependencies: highest, experimental: false} |
| 25 | + - {php-version: "8.2", os: ubuntu-latest, dependencies: lowest, experimental: false} |
| 26 | + # PHP 8.3 |
| 27 | + - {php-version: "8.3", os: ubuntu-latest, dependencies: highest, experimental: false} |
| 28 | + - {php-version: "8.3", os: ubuntu-latest, dependencies: lowest, experimental: false} |
| 29 | + # PHP 8.4 (current stable) |
| 30 | + - {php-version: "8.4", os: windows-latest, dependencies: highest, experimental: false} |
| 31 | + - {php-version: "8.4", os: ubuntu-latest, dependencies: highest, experimental: false} |
| 32 | + # aura/sql 5.x has PDO::connect() incompatibility with PHP 8.4; allowed to fail |
| 33 | + - {php-version: "8.4", os: ubuntu-latest, dependencies: lowest, experimental: true} |
| 34 | + |
| 35 | + continue-on-error: ${{ matrix.experimental }} |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Disable autocrlf on Windows |
| 39 | + if: contains(matrix.os, 'windows') |
| 40 | + run: git config --global core.autocrlf false |
| 41 | + |
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + fetch-depth: 0 |
| 46 | + |
| 47 | + - name: Setup PHP ${{ matrix.php-version }} |
| 48 | + uses: shivammathur/setup-php@v2 |
| 49 | + with: |
| 50 | + php-version: ${{ matrix.php-version }} |
| 51 | + coverage: pcov |
| 52 | + ini-values: | |
| 53 | + zend.assertions=1 |
| 54 | + memory_limit=512M |
| 55 | + opcache.jit=0 |
| 56 | + opcache.jit_buffer_size=0 |
| 57 | + opcache.enable=0 |
| 58 | + opcache.enable_cli=0 |
| 59 | + extensions: fileinfo,pdo,pdo_mysql,pdo_sqlite |
| 60 | + |
| 61 | + - name: Check fileinfo extension |
| 62 | + run: php --ri fileinfo |
| 63 | + |
| 64 | + - name: Get composer cache directory |
| 65 | + id: composer-cache |
| 66 | + shell: bash |
| 67 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 68 | + |
| 69 | + - name: Cache dependencies |
| 70 | + uses: actions/cache@v4 |
| 71 | + with: |
| 72 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 73 | + key: ${{ runner.os }}-php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json', '**/composer.lock') }} |
| 74 | + restore-keys: | |
| 75 | + ${{ runner.os }}-php${{ matrix.php-version }}-composer- |
| 76 | + ${{ runner.os }}-composer- |
| 77 | +
|
| 78 | + - name: Set platform requirements |
| 79 | + shell: bash |
| 80 | + run: composer config platform.php ${{ matrix.php-version }} |
| 81 | + |
| 82 | + - name: Handle lowest dependencies |
| 83 | + if: matrix.dependencies == 'lowest' |
| 84 | + shell: bash |
| 85 | + run: echo COMPOSER_UPDATE_FLAGS="$COMPOSER_UPDATE_FLAGS --prefer-lowest" >> $GITHUB_ENV |
| 86 | + |
| 87 | + - name: Remove platform config for highest resolution |
| 88 | + if: matrix.dependencies == 'highest' |
| 89 | + shell: bash |
| 90 | + run: composer config platform --unset |
| 91 | + |
| 92 | + - name: Update dependencies |
| 93 | + shell: bash |
| 94 | + run: | |
| 95 | + composer validate --no-check-all --strict |
| 96 | + composer update ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_FLAGS }} |
| 97 | +
|
| 98 | + - name: Run test suite |
| 99 | + shell: bash |
| 100 | + run: vendor/bin/phpunit --coverage-clover=coverage.xml |
| 101 | + env: |
| 102 | + XDEBUG_MODE: coverage |
| 103 | + |
| 104 | + - name: Upload coverage report |
| 105 | + uses: codecov/codecov-action@v5 |
| 106 | + with: |
| 107 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 108 | + fail_ci_if_error: false |
| 109 | + |
| 110 | + - name: Run additional script |
| 111 | + shell: bash |
| 112 | + run: php demo/run.php |
0 commit comments