From 18f8b1e0db90ff2d041a436d0b86ee6f7742957e Mon Sep 17 00:00:00 2001 From: butschster Date: Tue, 30 Apr 2024 10:20:38 +0400 Subject: [PATCH] Fixes phpunit --- .github/workflows/phpunit-database.yml | 21 ---------------- .github/workflows/phpunit-memory.yml | 20 --------------- .github/workflows/phpunit.yml | 34 ++++++++++++++++++++++++++ .gitignore | 2 +- .php-cs-fixer.php | 20 +++++++++++++++ .styleci.yml | 18 -------------- composer.json | 4 +-- deptrac.yaml | 2 +- phpunit.xml | 2 +- psalm.xml | 5 ++-- rector.php | 1 + 11 files changed, 63 insertions(+), 66 deletions(-) delete mode 100644 .github/workflows/phpunit-database.yml delete mode 100644 .github/workflows/phpunit-memory.yml create mode 100644 .github/workflows/phpunit.yml create mode 100644 .php-cs-fixer.php delete mode 100644 .styleci.yml diff --git a/.github/workflows/phpunit-database.yml b/.github/workflows/phpunit-database.yml deleted file mode 100644 index 1fa02ae6..00000000 --- a/.github/workflows/phpunit-database.yml +++ /dev/null @@ -1,21 +0,0 @@ -on: - pull_request: null - -name: phpunit - -env: - PERSISTENCE_DRIVER: db - DB_DRIVER: sqlite - -jobs: - phpunit-db: - uses: spiral/gh-actions/.github/workflows/phpunit.yml@master - with: - extensions: >- - ['sockets', 'mongodb', 'pgsql', 'pdo_pgsql', 'pdo_mysql'] - os: >- - ['ubuntu-latest'] - php: >- - ['8.3'] - stability: >- - ['prefer-stable'] diff --git a/.github/workflows/phpunit-memory.yml b/.github/workflows/phpunit-memory.yml deleted file mode 100644 index 3860f176..00000000 --- a/.github/workflows/phpunit-memory.yml +++ /dev/null @@ -1,20 +0,0 @@ -on: - pull_request: null - -name: phpunit - -env: - PERSISTENCE_DRIVER: memory - -jobs: - phpunit-memory: - uses: spiral/gh-actions/.github/workflows/phpunit.yml@master - with: - extensions: >- - ['sockets', 'mongodb', 'pgsql', 'pdo_pgsql', 'pdo_mysql'] - os: >- - ['ubuntu-latest'] - php: >- - ['8.3'] - stability: >- - ['prefer-stable'] diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml new file mode 100644 index 00000000..c24f8739 --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -0,0 +1,34 @@ +on: + pull_request: null + +name: phpunit + +jobs: + phpunit-db: + uses: buggregator/gh-actions/.github/workflows/phpunit.yml@master + with: + extensions: >- + ['sockets', 'mongodb', 'pgsql', 'pdo_pgsql', 'pdo_mysql'] + os: >- + ['ubuntu-latest'] + php: >- + ['8.3'] + stability: >- + ['prefer-stable'] + env: + PERSISTENCE_DRIVER: db + DB_DRIVER: sqlite + + phpunit-memory: + uses: buggregator/gh-actions/.github/workflows/phpunit.yml@master + with: + extensions: >- + ['sockets', 'mongodb', 'pgsql', 'pdo_pgsql', 'pdo_mysql'] + os: >- + ['ubuntu-latest'] + php: >- + ['8.3'] + stability: >- + ['prefer-stable'] + env: + PERSISTENCE_DRIVER: memory diff --git a/.gitignore b/.gitignore index 67f99ece..3b16c5e5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,4 @@ protoc-gen-php-grpc* .php-cs-fixer.cache .deptrac.cache .phpunit.cache -build +.cache diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 00000000..4d64c2d2 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,20 @@ +setRules([ + '@PER-CS2.0' => true, + ]) + ->setRiskyAllowed(true) + ->setFinder( + (new PhpCsFixer\Finder()) + ->files() + ->name('*.php') + ->in([__DIR__ . '/app/src', __DIR__ . '/app/modules']), + ) + ->setCacheFile('.cache/.php-cs-fixer.cache'); diff --git a/.styleci.yml b/.styleci.yml deleted file mode 100644 index aa7f13df..00000000 --- a/.styleci.yml +++ /dev/null @@ -1,18 +0,0 @@ -risky: false -preset: psr12 -enabled: - # Risky Fixers - # - declare_strict_types - # - void_return - - ordered_class_elements - - linebreak_after_opening_tag - - single_quote - - no_blank_lines_after_phpdoc - - unary_operator_spaces - - no_useless_else - - no_useless_return - - trailing_comma_in_multiline_array -finder: - exclude: - - "tests" - - "public" diff --git a/composer.json b/composer.json index 19c91fd6..cc8d4adb 100644 --- a/composer.json +++ b/composer.json @@ -93,8 +93,8 @@ "rr get-binary" ], "psalm": "vendor/bin/psalm --config=psalm.xml ./app", - "cs-check": "vendor/bin/php-cs-fixer fix ./app/src --rules=@PER-CS2.0 --dry-run", - "cs-fix": "vendor/bin/php-cs-fixer fix ./app/src --rules=@PER-CS2.0", + "cs-check": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run", + "cs-fix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -vvv --dry-run --using-cache=no", "deptrack": [ "deptrac analyze --report-uncovered" ] diff --git a/deptrac.yaml b/deptrac.yaml index d82905cf..46d7eff3 100644 --- a/deptrac.yaml +++ b/deptrac.yaml @@ -1,4 +1,4 @@ -# deptrac.yaml +# deptrac deptrac: paths: - ./app/src diff --git a/phpunit.xml b/phpunit.xml index e843f853..083c0b67 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,7 +1,7 @@ diff --git a/psalm.xml b/psalm.xml index 95a84a27..ff5d28dd 100644 --- a/psalm.xml +++ b/psalm.xml @@ -5,11 +5,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + cacheDirectory=".cache/psalm" > - + - + diff --git a/rector.php b/rector.php index 86651d2a..9e4cb526 100644 --- a/rector.php +++ b/rector.php @@ -21,6 +21,7 @@ __DIR__ . '/app', __DIR__ . '/tests', ]) + ->withCache(cacheDirectory: __DIR__ . '.cache/rector') // uncomment to reach your current PHP version // ->withPhpSets() ->withRules([