Updated Lint as per MB #1024
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: ['8.3'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer:v2, cs2pr | |
- name: Lint PHP Files | |
run: | | |
if find upload -type f -name "*.php" ! -path 'upload/system/storage/vendor/*' -exec php -l -n {} + | grep -q "Errors parsing"; then | |
echo "Syntax errors were found." | |
exit 1 | |
else | |
echo "No syntax errors were detected." | |
fi | |
- name: Install dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/composer/files | |
./.cache | |
./.php-cs-fixer.cache | |
key: ${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} | |
restore-keys: OC3.2-PHP${{ matrix.php }}- | |
- name: Run PHPStan | |
run: | | |
composer require --dev phpstan/phpstan 2.02 | |
./upload/system/storage/vendor/bin/phpstan analyze --no-progress | |
- name: Check Code style | |
run: | | |
composer require --dev friendsofphp/php-cs-fixer v3.64.0 | |
./upload/system/storage/vendor/bin/php-cs-fixer fix --dry-run --diff --ansi || true | |
./upload/system/storage/vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr |