Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Enable rector cache #8655

Merged
merged 9 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/test-rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,12 @@ permissions:

jobs:
build:
name: PHP ${{ matrix.php-versions }} Analyze code (Rector) on ${{ matrix.paths }}
name: PHP ${{ matrix.php-versions }} Analyze code (Rector)
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0']
paths:
- app
- system
- tests
- utils
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -80,5 +75,14 @@ jobs:
- name: Install dependencies
run: composer update --ansi --no-interaction

- name: Rector Cache
uses: actions/cache@v4
with:
path: /tmp/rector
key: ${{ runner.os }}-rector-${{ github.run_id }}
restore-keys: ${{ runner.os }}-rector-

- run: mkdir -p /tmp/rector

- name: Run static analysis
run: vendor/bin/rector process ${{ matrix.paths }} --dry-run --no-progress-bar
run: vendor/bin/rector process --dry-run --no-progress-bar
7 changes: 7 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* the LICENSE file that was distributed with this source code.
*/

use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
Expand Down Expand Up @@ -62,6 +63,12 @@

$rectorConfig->parallel(120, 8, 10);

// Github action cache
$rectorConfig->cacheClass(FileCacheStorage::class);
if (is_dir('/tmp')) {
$rectorConfig->cacheDirectory('/tmp/rector');
}

// paths to refactor; solid alternative to CLI arguments
$rectorConfig->paths([__DIR__ . '/app', __DIR__ . '/system', __DIR__ . '/tests', __DIR__ . '/utils']);

Expand Down