|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main", "develop" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main", "develop" ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + include: |
| 15 | + - php-version: '8.2' |
| 16 | + symfony-version: '6.4.*' |
| 17 | + - php-version: '8.2' |
| 18 | + symfony-version: '7.0.*' |
| 19 | + |
| 20 | + name: PHP ${{ matrix.php-version }} · SF ${{ matrix.symfony-version }} |
| 21 | + |
| 22 | + services: |
| 23 | + mysql: |
| 24 | + image: mysql:8.0 |
| 25 | + env: |
| 26 | + MYSQL_ROOT_PASSWORD: root |
| 27 | + MYSQL_DATABASE: test |
| 28 | + ports: |
| 29 | + - 3306:3306 |
| 30 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Setup PHP |
| 36 | + uses: shivammathur/setup-php@v2 |
| 37 | + with: |
| 38 | + php-version: ${{ matrix.php-version }} |
| 39 | + extensions: mbstring, xml, ctype, iconv, intl, json |
| 40 | + coverage: ${{ matrix.symfony-version == '7.0.*' && 'pcov' || 'none' }} |
| 41 | + |
| 42 | + - name: Constrain Symfony version |
| 43 | + run: | |
| 44 | + sed -ri 's/"symfony\/([^"]+)": "[^"]+"/"symfony\/\1": "${{ matrix.symfony-version }}"/g' composer.json |
| 45 | +
|
| 46 | + - name: Install Composer dependencies |
| 47 | + uses: ramsey/composer-install@v3 |
| 48 | + with: |
| 49 | + composer-options: "--prefer-dist --no-progress --no-interaction --optimize-autoloader" |
| 50 | + |
| 51 | + - name: Run PHP-CS-Fixer |
| 52 | + if: matrix.symfony-version == '7.0.*' |
| 53 | + run: vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --using-cache=no |
| 54 | + |
| 55 | + - name: Run PHPStan |
| 56 | + if: matrix.symfony-version == '7.0.*' |
| 57 | + run: vendor/bin/phpstan analyse src tests --configuration=phpstan.neon --memory-limit=1G |
| 58 | + |
| 59 | + - name: Run PHPUnit tests |
| 60 | + env: |
| 61 | + DATABASE_URL: mysql://root:root@127.0.0.1:3306/test?serverVersion=8.0 |
| 62 | + run: vendor/bin/phpunit ${{ matrix.symfony-version == '7.0.*' && '--coverage-clover coverage.xml' || '' }} |
| 63 | + |
| 64 | + - name: Upload coverage to Codecov |
| 65 | + if: matrix.symfony-version == '7.0.*' |
| 66 | + uses: codecov/codecov-action@v4 |
| 67 | + with: |
| 68 | + files: ./coverage.xml |
| 69 | + fail_ci_if_error: false |
0 commit comments