|
| 1 | +name: 'Continuous Integration' |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: ~ |
| 5 | + workflow_dispatch: ~ |
| 6 | + push: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + composer-validate: |
| 11 | + name: Composer Validate |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: 'Checkout Code' |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: 'Validate composer.json' |
| 18 | + run: composer validate --strict --ansi |
| 19 | + |
| 20 | + code-style: |
| 21 | + needs: composer-validate |
| 22 | + name: ${{ matrix.actions.name }} |
| 23 | + runs-on: ubuntu-latest |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + actions: |
| 28 | + - name: 'Coding Standard' |
| 29 | + run: vendor/bin/ecs check --no-progress-bar --ansi |
| 30 | + - name: 'Rector' |
| 31 | + run: vendor/bin/rector process --dry-run --no-progress-bar --ansi |
| 32 | + steps: |
| 33 | + - name: 'Checkout Code' |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: 'Setup PHP' |
| 37 | + uses: shivammathur/setup-php@v2 |
| 38 | + with: |
| 39 | + php-version: 8.3 |
| 40 | + coverage: none |
| 41 | + tools: composer:v2 |
| 42 | + |
| 43 | + - name: 'Install Dependencies' |
| 44 | + uses: "ramsey/composer-install@v2" |
| 45 | + with: |
| 46 | + composer-options: "--optimize-autoloader" |
| 47 | + |
| 48 | + - run: ${{ matrix.actions.run }} |
| 49 | + static-analysis: |
| 50 | + needs: composer-validate |
| 51 | + runs-on: ubuntu-latest |
| 52 | + name: ${{ matrix.actions.name }} (${{ matrix.php }}, ${{ matrix.dependencies }}) |
| 53 | + strategy: |
| 54 | + fail-fast: false |
| 55 | + matrix: |
| 56 | + php: [ '8.1', '8.3' ] |
| 57 | + dependencies: [ highest, lowest ] |
| 58 | + actions: |
| 59 | + - name: 'PHPStan' |
| 60 | + run: vendor/bin/phpstan analyze --no-progress --error-format=github --ansi --configuration=phpstan.dist.neon |
| 61 | + steps: |
| 62 | + - name: 'Checkout Code' |
| 63 | + uses: actions/checkout@v4 |
| 64 | + |
| 65 | + - name: 'Setup PHP' |
| 66 | + uses: shivammathur/setup-php@v2 |
| 67 | + with: |
| 68 | + php-version: ${{ matrix.php }} |
| 69 | + coverage: none |
| 70 | + tools: composer:v2 |
| 71 | + |
| 72 | + - name: 'Install Dependencies' |
| 73 | + uses: "ramsey/composer-install@v2" |
| 74 | + with: |
| 75 | + composer-options: "--optimize-autoloader" |
| 76 | + dependency-versions: ${{ matrix.dependencies }} |
| 77 | + |
| 78 | + - run: ${{ matrix.actions.run }} |
| 79 | + test: |
| 80 | + needs: composer-validate |
| 81 | + name: PHPUnit |
| 82 | + runs-on: ubuntu-latest |
| 83 | + strategy: |
| 84 | + matrix: |
| 85 | + php: [ '8.1', '8.2' ] |
| 86 | + dependencies: [ highest, lowest ] |
| 87 | + steps: |
| 88 | + - name: 'Checkout Code' |
| 89 | + uses: actions/checkout@v4 |
| 90 | + |
| 91 | + - name: 'Setup PHP' |
| 92 | + uses: shivammathur/setup-php@v2 |
| 93 | + with: |
| 94 | + php-version: ${{ matrix.php }} |
| 95 | + coverage: none |
| 96 | + tools: composer:v2 |
| 97 | + |
| 98 | + - name: 'Install Dependencies' |
| 99 | + uses: "ramsey/composer-install@v2" |
| 100 | + with: |
| 101 | + composer-options: "--optimize-autoloader" |
| 102 | + dependency-versions: ${{ matrix.dependencies }} |
| 103 | + |
| 104 | + - name: 'Run PHPUnit' |
| 105 | + run: vendor/bin/phpunit --testdox --colors=always --configuration=phpunit.xml.dist |
| 106 | + |
| 107 | + code-coverage: |
| 108 | + needs: [ test, static-analysis ] |
| 109 | + name: PHPUnit Coverage |
| 110 | + runs-on: ubuntu-latest |
| 111 | + steps: |
| 112 | + - name: 'Checkout Code' |
| 113 | + uses: actions/checkout@v4 |
| 114 | + |
| 115 | + - name: 'Setup PHP' |
| 116 | + uses: shivammathur/setup-php@v2 |
| 117 | + with: |
| 118 | + php-version: 8.3 |
| 119 | + coverage: xdebug |
| 120 | + tools: composer:v2 |
| 121 | + |
| 122 | + - name: 'Install Dependencies' |
| 123 | + uses: "ramsey/composer-install@v2" |
| 124 | + with: |
| 125 | + composer-options: "--optimize-autoloader" |
| 126 | + |
| 127 | + - name: 'Run PHPUnit with Coverage' |
| 128 | + run: vendor/bin/phpunit --configuration=phpunit.xml.dist --coverage-clover=coverage.xml |
| 129 | + |
| 130 | + - name: 'Upload coverage reports to Codecov' |
| 131 | + uses: codecov/codecov-action@v4 |
| 132 | + with: |
| 133 | + fail_ci_if_error: true |
| 134 | + files: ./coverage.xml |
| 135 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments