Skip to content

Merge branch 'assets' into dev #50

Merge branch 'assets' into dev

Merge branch 'assets' into dev #50

name: Static Analysis
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
paths:
# Any change to a PHP file should run checks.
- '**.php'
# These files configure Composer. Changes could affect the outcome.
- 'composer.*'
# This file configures PHPStan. Changes could affect the outcome.
- 'phpstan.neon'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:
jobs:
# Runs PHPStan Static Analysis.
#
# Violations are reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP.
# - Logs debug information.
# - Installs Composer dependencies (use cache if possible).
# - Make Composer packages available globally.
# - Runs PHPStan on the full codebase.
phpstan:
name: Static Analysis (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3'] # 7.4 is the minimum supported version.
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@2.29.0
with:
php-version: ${{ matrix.php-versions }}
coverage: none
tools: cs2pr, phpstan
env:
fail-fast: false
- name: Log debug information
run: |
php --version
composer --version
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- name: Run PHPStan static analysis (PHP ${{ matrix.php-versions }})
run: phpstan analyse -c phpstan.neon --error-format=checkstyle --memory-limit=1G | cs2pr