|
| 1 | +name: PHP workflow |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "master" ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint: |
| 15 | + runs-on: ubuntu-24.04 |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + php: [8.3, 8.4] |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Setup PHP |
| 24 | + uses: shivammathur/setup-php@v2 |
| 25 | + with: |
| 26 | + php-version: ${{ matrix.php }} |
| 27 | + tools: composer:v2 |
| 28 | + coverage: none |
| 29 | + |
| 30 | + - name: Validate composer.json and composer.lock |
| 31 | + run: composer validate --strict |
| 32 | + |
| 33 | + - name: Get Composer cache directory |
| 34 | + id: composer-cache-dir |
| 35 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 36 | + |
| 37 | + - name: Cache Composer packages |
| 38 | + uses: actions/cache@v3 |
| 39 | + with: |
| 40 | + path: ${{ steps.composer-cache-dir.outputs.dir }} |
| 41 | + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
| 42 | + restore-keys: | |
| 43 | + ${{ runner.os }}-php-${{ matrix.php }}- |
| 44 | +
|
| 45 | + - name: Install dependencies |
| 46 | + run: composer install --prefer-dist --no-progress --no-interaction |
| 47 | + |
| 48 | + - name: Run PHP Lint |
| 49 | + run: composer lint |
| 50 | + |
| 51 | + - name: Run PHP CodeSniffer |
| 52 | + run: composer cs |
| 53 | + |
| 54 | + static-analysis: |
| 55 | + runs-on: ubuntu-24.04 |
| 56 | + strategy: |
| 57 | + matrix: |
| 58 | + php: [8.3, 8.4] |
| 59 | + |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + |
| 63 | + - name: Setup PHP |
| 64 | + uses: shivammathur/setup-php@v2 |
| 65 | + with: |
| 66 | + php-version: ${{ matrix.php }} |
| 67 | + tools: composer:v2 |
| 68 | + coverage: none |
| 69 | + |
| 70 | + - name: Get Composer cache directory |
| 71 | + id: composer-cache-dir |
| 72 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 73 | + |
| 74 | + - name: Cache Composer packages |
| 75 | + uses: actions/cache@v3 |
| 76 | + with: |
| 77 | + path: ${{ steps.composer-cache-dir.outputs.dir }} |
| 78 | + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
| 79 | + restore-keys: | |
| 80 | + ${{ runner.os }}-php-${{ matrix.php }}- |
| 81 | +
|
| 82 | + - name: Install dependencies |
| 83 | + run: composer install --prefer-dist --no-progress --no-interaction |
| 84 | + |
| 85 | + - name: Run Psalm |
| 86 | + run: composer psalm |
| 87 | + |
| 88 | + - name: Run PHP Mess Detector |
| 89 | + run: composer phpmd |
| 90 | + |
| 91 | + - name: Run Pdepend and Summary Formatter |
| 92 | + run: composer pdepend |
| 93 | + |
| 94 | + tests: |
| 95 | + runs-on: ubuntu-24.04 |
| 96 | + strategy: |
| 97 | + matrix: |
| 98 | + php: [8.3, 8.4] |
| 99 | + |
| 100 | + steps: |
| 101 | + - uses: actions/checkout@v4 |
| 102 | + |
| 103 | + - name: Setup PHP |
| 104 | + uses: shivammathur/setup-php@v2 |
| 105 | + with: |
| 106 | + php-version: ${{ matrix.php }} |
| 107 | + tools: composer:v2 |
| 108 | + coverage: none |
| 109 | + |
| 110 | + - name: Get Composer cache directory |
| 111 | + id: composer-cache-dir |
| 112 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 113 | + |
| 114 | + - name: Cache Composer packages |
| 115 | + uses: actions/cache@v3 |
| 116 | + with: |
| 117 | + path: ${{ steps.composer-cache-dir.outputs.dir }} |
| 118 | + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
| 119 | + restore-keys: | |
| 120 | + ${{ runner.os }}-php-${{ matrix.php }}- |
| 121 | +
|
| 122 | + - name: Install dependencies |
| 123 | + run: composer install --prefer-dist --no-progress --no-interaction |
| 124 | + |
| 125 | + - name: Run PHPUnit test suite |
| 126 | + run: composer test |
0 commit comments