Support Symfony 8 #10
This file contains hidden or 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: | |
| branches: [ "main", "develop" ] | |
| pull_request: | |
| branches: [ "main", "develop" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php-version: ['8.2', '8.4', '8.5'] | |
| symfony-version: ['5.4.*', '6.4.*', '7.0.*', '8.0.*'] | |
| doctrine-orm-version: ['2.20.*', '3.0.*'] | |
| exclude: | |
| # Doctrine ORM 3.0 requires PHP 8.4+ | |
| - php-version: '8.2' | |
| doctrine-orm-version: '3.0.*' | |
| # Symfony 8.0 requires PHP 8.4+ | |
| - php-version: '8.2' | |
| symfony-version: '8.0.*' | |
| # Symfony 8 only works with doctrine-bundle 3.1+, which conflicts with ORM 2.x | |
| - symfony-version: '8.0.*' | |
| doctrine-orm-version: '2.20.*' | |
| name: PHP ${{ matrix.php-version }} · SF ${{ matrix.symfony-version }} · Doctrine ORM ${{ matrix.doctrine-orm-version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: mbstring, xml, ctype, iconv, intl, json, pdo_sqlite, sqlite3 | |
| coverage: ${{ matrix.php-version == '8.5' && (matrix.symfony-version == '7.0.*' || matrix.symfony-version == '8.0.*') && matrix.doctrine-orm-version == '3.0.*' && 'pcov' || 'none' }} | |
| - name: Constrain Symfony version | |
| run: | | |
| sed -ri 's/"symfony\/([^"]+)": "[^"]+"/"symfony\/\1": "${{ matrix.symfony-version }}"/g' composer.json | |
| # symfony/clock does not exist for 5.4 (added in 6.2); keep it installable on 5.4 jobs | |
| if [ "${{ matrix.symfony-version }}" = "5.4.*" ]; then | |
| sed -ri 's/"symfony\/clock": "[^"]+"/"symfony\/clock": "^6.2 | ^7.0"/' composer.json | |
| fi | |
| - name: Constrain Doctrine ORM version | |
| run: | | |
| sed -ri 's/"doctrine\/orm": "[^"]+"/"doctrine\/orm": "${{ matrix.doctrine-orm-version }}"/' composer.json | |
| # Symfony 8 requires doctrine-bundle 3.1+, which requires doctrine/persistence ^4. ORM 3.0/3.1 only support persistence ^3. Use ORM 3.5.* (supports ^3.3.1 || ^4) for SF 8. | |
| if [ "${{ matrix.symfony-version }}" = "8.0.*" ] && [ "${{ matrix.doctrine-orm-version }}" = "3.0.*" ]; then | |
| sed -ri 's/"doctrine\/orm": "[^"]+"/"doctrine\/orm": "3.5.*"/' composer.json | |
| fi | |
| - name: Install Composer dependencies | |
| uses: ramsey/composer-install@v3 | |
| with: | |
| composer-options: "--prefer-dist --no-progress --no-interaction --optimize-autoloader" | |
| - name: Run PHP-CS-Fixer | |
| if: matrix.php-version == '8.2' && matrix.symfony-version == '5.4.*' && matrix.doctrine-orm-version == '2.20.*' | |
| run: vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --using-cache=no | |
| - name: Run PHPStan | |
| if: matrix.php-version == '8.5' && (matrix.symfony-version == '7.0.*' || matrix.symfony-version == '8.0.*') && matrix.doctrine-orm-version == '3.0.*' | |
| run: vendor/bin/phpstan analyse src tests --configuration=phpstan.neon --memory-limit=1G | |
| - name: Run PHPUnit tests | |
| run: vendor/bin/phpunit ${{ matrix.php-version == '8.5' && (matrix.symfony-version == '7.0.*' || matrix.symfony-version == '8.0.*') && matrix.doctrine-orm-version == '3.0.*' && '--coverage-clover coverage.xml' || '' }} | |
| - name: Upload coverage to Codecov | |
| if: matrix.php-version == '8.5' && (matrix.symfony-version == '7.0.*' || matrix.symfony-version == '8.0.*') && matrix.doctrine-orm-version == '3.0.*' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage.xml | |
| fail_ci_if_error: false |