|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [ main, develop ] |
| 7 | + |
| 8 | +jobs: |
| 9 | + run: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + php: |
| 15 | + - '8.3' |
| 16 | + - '8.4' |
| 17 | + coverage: ['none'] |
| 18 | + doctrine-orm-versions: |
| 19 | + - '^2.17' |
| 20 | + - '^3.0' |
| 21 | + symfony-versions: |
| 22 | + - '6.4.*' |
| 23 | + - '7.0.*' |
| 24 | + include: |
| 25 | + - description: 'Log Code Coverage' |
| 26 | + php: '8.3' |
| 27 | + symfony-versions: '^7.0' |
| 28 | + doctrine-orm-versions: '^3.0' |
| 29 | + coverage: xdebug |
| 30 | + |
| 31 | + name: PHP ${{ matrix.php }} Symfony ${{ matrix.symfony-versions }} Doctrine ${{ matrix.doctrine-orm-versions }} ${{ matrix.description }} |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - uses: actions/cache@v4 |
| 37 | + with: |
| 38 | + path: ~/.composer/cache/files |
| 39 | + key: ${{ matrix.php }}-${{ matrix.symfony-versions }} |
| 40 | + |
| 41 | + - name: Setup PHP |
| 42 | + uses: shivammathur/setup-php@v2 |
| 43 | + with: |
| 44 | + php-version: ${{ matrix.php }} |
| 45 | + coverage: xdebug |
| 46 | + |
| 47 | + - name: Add PHPUnit matcher |
| 48 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 49 | + |
| 50 | + - name: Set composer cache directory |
| 51 | + id: composer-cache |
| 52 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 53 | + |
| 54 | + - name: Cache composer |
| 55 | + uses: actions/cache@v4 |
| 56 | + with: |
| 57 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 58 | + key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.symfony-versions }}-composer-${{ hashFiles('composer.json') }} |
| 59 | + restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.symfony-versions }}-composer |
| 60 | + |
| 61 | + - name: Update Symfony version |
| 62 | + if: matrix.symfony-versions != '' |
| 63 | + run: | |
| 64 | + composer require symfony/framework-bundle:${{ matrix.symfony-versions }} --no-update --no-scripts |
| 65 | + composer require doctrine/orm:${{ matrix.doctrine-orm-versions }} --no-update --no-scripts |
| 66 | + composer require --dev symfony/yaml:${{ matrix.symfony-versions }} --no-update --no-scripts |
| 67 | +
|
| 68 | + - name: Install dependencies |
| 69 | + run: composer install |
| 70 | + |
| 71 | + - name: Run PHPUnit tests |
| 72 | + run: vendor/bin/phpunit |
| 73 | + if: matrix.coverage == 'none' |
| 74 | + |
| 75 | + - name: PHPUnit tests and Log Code coverage |
| 76 | + run: vendor/bin/phpunit --coverage-clover=coverage.xml |
| 77 | + if: matrix.coverage == 'xdebug' |
| 78 | + |
| 79 | + - name: Upload coverage reports to Codecov |
| 80 | + if: matrix.coverage == 'xdebug' |
| 81 | + |
| 82 | + with: |
| 83 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments