|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master, main] |
| 6 | + pull_request: |
| 7 | + branches: [master, main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + php: ['8.1', '8.2', '8.3'] |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Setup PHP |
| 20 | + uses: shivammathur/setup-php@v2 |
| 21 | + with: |
| 22 | + php-version: ${{ matrix.php }} |
| 23 | + extensions: mbstring, json |
| 24 | + coverage: pcov |
| 25 | + |
| 26 | + - name: Get Composer cache directory |
| 27 | + id: composer-cache |
| 28 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 29 | + |
| 30 | + - name: Cache Composer dependencies |
| 31 | + uses: actions/cache@v4 |
| 32 | + with: |
| 33 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 34 | + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
| 35 | + restore-keys: | |
| 36 | + ${{ runner.os }}-php-${{ matrix.php }}- |
| 37 | +
|
| 38 | + - name: Install dependencies |
| 39 | + run: composer install --prefer-dist --no-progress |
| 40 | + |
| 41 | + - name: Run tests with coverage |
| 42 | + run: vendor/bin/phpunit --coverage-clover coverage.xml |
| 43 | + |
| 44 | + - name: Upload coverage to Codecov |
| 45 | + if: matrix.php == '8.3' |
| 46 | + uses: codecov/codecov-action@v4 |
| 47 | + with: |
| 48 | + files: coverage.xml |
| 49 | + fail_ci_if_error: false |
| 50 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 51 | + |
| 52 | + static-analysis: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Setup PHP |
| 59 | + uses: shivammathur/setup-php@v2 |
| 60 | + with: |
| 61 | + php-version: '8.3' |
| 62 | + |
| 63 | + - name: Install dependencies |
| 64 | + run: composer install --prefer-dist --no-progress |
| 65 | + |
| 66 | + - name: Run PHPStan |
| 67 | + run: vendor/bin/phpstan analyse src --level=5 |
0 commit comments