Skip to content

chore: modernise dev tooling (Rector, PHPStan 2, PHPUnit 11) #23

chore: modernise dev tooling (Rector, PHPStan 2, PHPUnit 11)

chore: modernise dev tooling (Rector, PHPStan 2, PHPUnit 11) #23

Workflow file for this run

name: Continuous Integration on Pull Request
on:
pull_request:
jobs:
php-cs-fixer:
name: PHP Coding Standards Fixer on ${{ matrix.operating-system }})
strategy:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest ]
php-versions: [ '8.2' ]
runs-on: ubuntu-latest
steps:
# —— Github Checkout 🔎 ——————————————————————————————————————————————————
- uses: actions/checkout@v6
with:
fetch-depth: 0
# —— Setup php —————————————————————————————————————————————————————————
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: php-cs-fixer
# —— php-cs-fixer ——————————————————————————————————————————————————————
- name: Run php-cs-fixer
run: php-cs-fixer fix --dry-run -v
symfony:
name: Symfony ${{ matrix.symfony }} (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
needs: php-cs-fixer
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '8.2', '8.3', '8.4', '8.5' ]
symfony: [ '6.4', '7.4', '8.0', '8.1' ]
exclude:
# Symfony 8.x requires PHP >= 8.4
- php-versions: '8.2'
symfony: '8.0'
- php-versions: '8.3'
symfony: '8.0'
- php-versions: '8.2'
symfony: '8.1'
- php-versions: '8.3'
symfony: '8.1'
runs-on: ${{ matrix.operating-system }}
steps:
# —— Git Checkout PR branch ——————————————————————————————————————————
- name: Git Checkout PR branch (${{ github.ref }})
uses: actions/checkout@v6
with:
fetch-depth: 0
# —— Setup php —————————————————————————————————————————————————————————
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
env:
COMPOSER_AUTH: "${{ secrets.COMPOSER_AUTH }}"
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug
tools: composer:v2
# —— Composer cache ————————————————————————————————————————————————————
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache composer dependencies
uses: actions/cache@v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ matrix.symfony }}
restore-keys: ${{ runner.os }}-composer-
# —— Install composer dependencies —————————————————————————————————————
- name: Install Composer dependencies
env:
COMPOSER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-interaction --no-progress symfony/flex
composer config extra.symfony.require "${{ matrix.symfony }}.*"
composer update --no-progress --no-scripts
# —— Run tests —————————————————————————————————————————————————————————
- name: Run Tests
run: php vendor/bin/phpunit
# —— PHPStan ———————————————————————————————————————————————————————————
- name: PHPStan (static analysis)
run: php vendor/bin/phpstan analyse --no-progress
# —— Rector ————————————————————————————————————————————————————————————
- name: Rector (dry-run)
run: php vendor/bin/rector process --dry-run --no-progress-bar