diff --git a/.github/workflows/code-analysis.yaml b/.github/workflows/code-analysis.yaml new file mode 100644 index 00000000..f43d555d --- /dev/null +++ b/.github/workflows/code-analysis.yaml @@ -0,0 +1,40 @@ +name: Code Analysis + +on: + pull_request: null + push: + branches: + - develop + workflow_dispatch: +permissions: + contents: read +jobs: + code_analysis: + strategy: + fail-fast: false + matrix: + actions: + - name: 'PHPStan' + run: composer phpstan + - name: 'Coding Standards' + run: composer fix-cs + name: ${{ matrix.actions.name }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: /tmp/composer-cache + key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} + - name: Setup PHP + id: setup-php + uses: shivammathur/setup-php@v2 + with: + php-version: 8.0.2 + extensions: 'ctype,curl,dom,iconv,imagick,intl,json,mbstring,openssl,pcre,pdo,reflection,spl,zip' + ini-values: post_max_size=256M, max_execution_time=180, memory_limit=512M + tools: composer:v2 + - name: Install Composer dependencies + run: composer install --no-interaction --no-ansi --no-progress + - run: ${{ matrix.actions.run }} diff --git a/ecs.php b/ecs.php index b93104ad..e8d61035 100644 --- a/ecs.php +++ b/ecs.php @@ -4,12 +4,11 @@ use Symplify\EasyCodingStandard\Config\ECSConfig; return static function(ECSConfig $ecsConfig): void { - $ecsConfig->parallel(); $ecsConfig->paths([ __DIR__ . '/src', __DIR__ . '/tests/pest', __FILE__, ]); - + $ecsConfig->parallel(); $ecsConfig->sets([SetList::CRAFT_CMS_4]); }; diff --git a/phpstan.neon b/phpstan.neon index 4514cd7c..57164925 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ includes: - - %currentWorkingDirectory%/vendor/craftcms/phpstan/phpstan.neon + - vendor/craftcms/phpstan/phpstan.neon parameters: level: 5 paths: