|
| 1 | +name: Lint (PHPStan + PHPCS) |
| 2 | + |
| 3 | +# Run on pushes and pull requests to main and feature branches |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [ main ] |
| 7 | + pull_request: |
| 8 | + branches: [ main ] |
| 9 | + |
| 10 | +jobs: |
| 11 | + lint: |
| 12 | + name: Lint (PHP ${{ matrix.php-version }}) |
| 13 | + runs-on: ubuntu-latest |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + php-version: [ '8.1', '8.2' ] # adjust versions you want to test |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Setup PHP ${{ matrix.php-version }} |
| 26 | + uses: shivammathur/setup-php@v4 |
| 27 | + with: |
| 28 | + php-version: ${{ matrix.php-version }} |
| 29 | + extensions: mbstring, json, xml, pdo, tokenizer |
| 30 | + coverage: none |
| 31 | + |
| 32 | + - name: Validate composer.json |
| 33 | + run: composer validate --no-check-publish |
| 34 | + |
| 35 | + - name: Get Composer Cache directory |
| 36 | + id: composer-cache |
| 37 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 38 | + |
| 39 | + - name: Cache Composer dependencies |
| 40 | + uses: actions/cache@v4 |
| 41 | + with: |
| 42 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 43 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 44 | + restore-keys: | |
| 45 | + ${{ runner.os }}-composer- |
| 46 | +
|
| 47 | + - name: Install composer dependencies |
| 48 | + run: composer install --no-progress --no-suggest --prefer-dist --no-interaction |
| 49 | + |
| 50 | + - name: Ensure make is installed (Ubuntu has make preinstalled) |
| 51 | + run: make --version |
| 52 | + |
| 53 | + - name: Run lint (phpstan + phpcs) |
| 54 | + run: make lint |
| 55 | + working-directory: app |
| 56 | + |
| 57 | + - name: Upload PHPCS report (optional) |
| 58 | + if: always() |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: phpcs-report |
| 62 | + path: phpcs-report.xml |
0 commit comments