on: push: branches: - master pull_request: name: CI env: REQUIRED_PHP_EXTENSIONS: "ctype, filter, hash, iconv" jobs: phpstan: name: PHPStan runs-on: ubuntu-latest strategy: matrix: php-version: - "8.3" steps: - name: "Checkout code" uses: actions/checkout@v4 - name: "Install PHP with extensions" uses: "shivammathur/setup-php@2.31.1" with: coverage: "none" extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" tools: composer:v2 - name: "Composer install" uses: "ramsey/composer-install@v3" - name: "Run PHPStan" run: vendor/bin/phpstan analyse -c phpstan.neon.dist php-cs-fixer: name: PHP-CS-Fixer runs-on: ubuntu-latest strategy: matrix: php-version: - '8.3' steps: - name: "Checkout code" uses: actions/checkout@v4 - name: Install PHP with extensions uses: shivammathur/setup-php@2.31.1 with: coverage: "none" php-version: ${{ matrix.php-version }} tools: composer:v2 - name: "Composer install" uses: "ramsey/composer-install@v3" with: composer-options: "--prefer-dist" - name: "Run friendsofphp/php-cs-fixer" run: "vendor/bin/php-cs-fixer fix --diff --verbose" composer-normalize: name: composer normalize runs-on: ubuntu-latest strategy: matrix: php-version: - '8.3' steps: - name: "Checkout code" uses: actions/checkout@v4 - name: Install PHP with extensions uses: shivammathur/setup-php@2.31.1 with: coverage: "none" php-version: ${{ matrix.php-version }} tools: composer:v2 - name: "Composer install" uses: "ramsey/composer-install@v3" with: composer-options: "--no-scripts" - name: "composer normalize" run: "composer normalize" tests: name: PHPUnit runs-on: ubuntu-latest strategy: matrix: php-version: - "8.3" steps: - name: "Checkout code" uses: actions/checkout@v4 - name: "Install PHP with extensions" uses: "shivammathur/setup-php@2.31.1" with: coverage: "none" extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" tools: composer:v2 - name: "Composer install" uses: "ramsey/composer-install@v3" with: composer-options: "--no-scripts" - name: "PHPUnit version" run: vendor/bin/phpunit --version - name: "Run tests" run: vendor/bin/phpunit refactoring: name: "Refactoring" runs-on: "ubuntu-latest" strategy: matrix: php-version: - "8.3" steps: # workaround for missing secret in fork PRs - see /~https://github.com/actions/checkout/issues/298 # see /~https://github.com/rectorphp/rector/commit/d395e1c28b8e6a56711dcc2e10490a82965850e4 - if: github.actor != 'dependabot[bot]' name: "Checkout" uses: "actions/checkout@v4" with: ref: "${{ github.head_ref }}" # Must be used to be able to commit changed files token: "${{ secrets.GITHUB_TOKEN }}" # in forks, the token is not available - so we cannot use it - if: github.actor == 'dependabot[bot]' name: "Checkout" uses: "actions/checkout@v4" with: ref: "${{ github.head_ref }}" - name: "Install PHP with extensions" uses: "shivammathur/setup-php@2.31.1" with: coverage: "none" extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" tools: composer:v2 - name: "Composer instal" uses: "ramsey/composer-install@v3" with: composer-options: "--no-scripts" - name: "Run rector/rector" run: "vendor/bin/rector process --config rector.php" dependency-analysis: name: "Dependency Analysis" runs-on: "ubuntu-latest" strategy: matrix: php-version: - "8.3" steps: - name: "Checkout" uses: "actions/checkout@v4" - name: "Install PHP with extensions" uses: "shivammathur/setup-php@2.31.1" with: coverage: "none" extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" tools: composer:v2 - name: "Composer install" uses: "ramsey/composer-install@v3" - name: "Check for unused dependencies" run: 'vendor/bin/composer-unused --no-progress --output-format=github | grep -e "^::error" && exit 1 || :' - name: "Check for implicit dependencies" run: "vendor/bin/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json composer.json"