|
| 1 | +name: Test and Static Analysis (Pull Request) |
| 2 | + |
| 3 | +on: pull_request |
| 4 | + |
| 5 | +jobs: |
| 6 | + test-and-static-analysis: |
| 7 | + name: Test and Lint |
| 8 | + runs-on: ubuntu-latest |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + php: ['8.1', '8.2', '8.3', '8.4'] |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Set up PHP |
| 15 | + uses: shivammathur/setup-php@v2 |
| 16 | + with: |
| 17 | + php-version: ${{ matrix.php }} |
| 18 | + coverage: xdebug |
| 19 | + tools: composer:v2 |
| 20 | + |
| 21 | + - name: Set up Node |
| 22 | + uses: actions/setup-node@v4 |
| 23 | + with: |
| 24 | + node-version: '22.x' |
| 25 | + |
| 26 | + - name: Checkout code |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + |
| 31 | + - name: PHP Version Check |
| 32 | + run: php -v |
| 33 | + |
| 34 | + - name: Validate Composer JSON |
| 35 | + run: composer validate |
| 36 | + |
| 37 | + - name: Run Composer Install |
| 38 | + id: composerinstall |
| 39 | + run: composer install --no-interaction |
| 40 | + |
| 41 | + - name: PHP Lint |
| 42 | + run: ./vendor/bin/parallel-lint src tests playground |
| 43 | + |
| 44 | + - name: PHP Code Sniffer |
| 45 | + run: | |
| 46 | + ./vendor/bin/phpcs --version |
| 47 | + ./vendor/bin/phpcs --ignore=vendor --standard=phpcs.xml -s -p . |
| 48 | +
|
| 49 | + - name: PHPStan |
| 50 | + run: | |
| 51 | + ./vendor/bin/phpstan --version |
| 52 | + ./vendor/bin/phpstan analyze -c phpstan.neon |
| 53 | +
|
| 54 | + - name: Unit tests |
| 55 | + run: | |
| 56 | + mkdir -p build/logs |
| 57 | + ./vendor/bin/phpunit --version |
| 58 | + echo "Test suite All" |
| 59 | + ./vendor/bin/phpunit ./tests/ |
| 60 | + |
| 61 | + code-coverage: |
| 62 | + name: Code coverage |
| 63 | + runs-on: ubuntu-latest |
| 64 | + strategy: |
| 65 | + matrix: |
| 66 | + php: ['8.4'] |
| 67 | + |
| 68 | + steps: |
| 69 | + - name: Set up PHP |
| 70 | + uses: shivammathur/setup-php@v2 |
| 71 | + with: |
| 72 | + php-version: ${{ matrix.php }} |
| 73 | + coverage: xdebug |
| 74 | + tools: composer:v2 |
| 75 | + |
| 76 | + - name: Set up Node |
| 77 | + uses: actions/setup-node@v4 |
| 78 | + with: |
| 79 | + node-version: '22.x' |
| 80 | + |
| 81 | + - name: Checkout code |
| 82 | + uses: actions/checkout@v4 |
| 83 | + with: |
| 84 | + fetch-depth: 0 |
| 85 | + |
| 86 | + - name: Run Composer |
| 87 | + run: composer install --no-interaction |
| 88 | + |
| 89 | + - name: Update PHPUnit for Code Coverage |
| 90 | + run: composer require phpunit/phpunit:^10.5 sebastian/version:* --with-all-dependencies |
| 91 | + |
| 92 | + - name: PHP Lint |
| 93 | + run: ./vendor/bin/parallel-lint src tests playground |
| 94 | + |
| 95 | + - name: Unit tests |
| 96 | + run: | |
| 97 | + mkdir -p build/logs |
| 98 | + XDEBUG_MODE=coverage ./vendor/bin/phpunit ./tests/ --coverage-clover build/logs/clover.xml --coverage-filter=./src/ |
0 commit comments