|
| 1 | +name: "CI" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + cs: |
| 15 | + name: "Code style" |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: "Git: checkout" |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: "PHP: setup 8.3" |
| 22 | + uses: shivammathur/setup-php@v2 |
| 23 | + with: |
| 24 | + php-version: '8.3' |
| 25 | + coverage: none |
| 26 | + tools: php-cs-fixer |
| 27 | + |
| 28 | + - name: "Composer: validate" |
| 29 | + run: composer validate --strict |
| 30 | + |
| 31 | + - name: "Composer: install" |
| 32 | + run: composer install --prefer-dist --no-interaction --no-progress |
| 33 | + |
| 34 | + - name: "Php-CS-Fixer: version" |
| 35 | + run: vendor/bin/php-cs-fixer -V |
| 36 | + |
| 37 | + - name: "Php-CS-Fixer: check" |
| 38 | + run: vendor/bin/php-cs-fixer fix --diff --dry-run |
| 39 | + |
| 40 | + sa: |
| 41 | + name: "Static Analysis" |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - name: "Git: checkout" |
| 45 | + uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: "PHP: setup 8.4" |
| 48 | + uses: shivammathur/setup-php@v2 |
| 49 | + with: |
| 50 | + php-version: '8.4' |
| 51 | + coverage: pcov |
| 52 | + tools: phpstan |
| 53 | + |
| 54 | + - name: "Composer: install" |
| 55 | + run: composer install --prefer-dist --no-interaction --no-progress |
| 56 | + |
| 57 | + - name: "PHPStan: version" |
| 58 | + run: vendor/bin/phpstan --version |
| 59 | + |
| 60 | + - name: "PHPStan: analyze" |
| 61 | + run: vendor/bin/phpstan |
| 62 | + |
| 63 | + tests: |
| 64 | + name: "Tests (PHP ${{ matrix.php-version }})" |
| 65 | + runs-on: ubuntu-latest |
| 66 | + strategy: |
| 67 | + matrix: |
| 68 | + php-version: ['8.3', '8.4'] |
| 69 | + fail-fast: false |
| 70 | + steps: |
| 71 | + - name: "Git: checkout" |
| 72 | + uses: actions/checkout@v4 |
| 73 | + |
| 74 | + - name: "PHP: setup ${{ matrix.php-version }}" |
| 75 | + uses: shivammathur/setup-php@v2 |
| 76 | + with: |
| 77 | + php-version: ${{ matrix.php-version }} |
| 78 | + coverage: pcov |
| 79 | + tools: phpunit |
| 80 | + |
| 81 | + - name: "Composer: install" |
| 82 | + run: composer install --prefer-dist --no-interaction --no-progress |
| 83 | + |
| 84 | + - name: "PHPUnit: unit tests" |
| 85 | + run: vendor/bin/phpunit |
| 86 | + |
| 87 | + - name: "PHPUnit: all tests with coverage" |
| 88 | + run: vendor/bin/phpunit --coverage-clover=coverage.xml |
| 89 | + |
| 90 | + - name: "Codecov: upload coverage" |
| 91 | + uses: codecov/codecov-action@v5 |
| 92 | + if: matrix.php-version == '8.4' |
| 93 | + with: |
| 94 | + files: ./coverage.xml |
0 commit comments